<commit_before>{$, ScrollView} = require 'atom'
exec = require('child_process').exec;

module.exports =
    class ManView extends ScrollView

        @deserialize: (state) ->
            new ManView(state)

        @content: ->
            @div class: 'man-view native-key-bindings', tabindex: -1, =>
                @div outlet: "manViewContent"

        constructor: ({@filePath, @uri}) ->
            super
            wcmd = "man -w #{@filePath}"
            exec wcmd, (error, stdout, stderr) =>
                file = stdout.replace("\n", "")
                if file.match(/\.gz$/)
                    cmd = "gzcat '#{file}' | groff -mandoc -T html"
                else
                    cmd = "groff -mandoc -T html '#{file}'"
                exec cmd, (error, stdout, stderr) =>
                    fudged = stdout.replace('<body>', '<div class="manpage-body">').replace('</body>','</div>');
                    dom = $(fudged).filter('div.manpage-body')
                    dom.css('fontFamily', atom.config.get('editor.fontFamily'))
                    dom.css('fontSize', atom.config.get('editor.fontSize'))
                    dom.css('lineHeight', atom.config.get('editor.lineHeight'))<commit_msg>Error handling: at least log them to the console.<commit_after>{$, ScrollView} = require 'atom'
exec = require('child_process').exec;

module.exports =
    class ManView extends ScrollView

        @deserialize: (state) ->
            new ManView(state)

        @content: ->
            @div class: 'man-view native-key-bindings', tabindex: -1, =>
                @div class: 'man-view-error', outlet: "manViewError"
                @div outlet: "manViewContent"

        constructor: ({@filePath, @uri}) ->
            super
            wcmd = "man -w #{@filePath}"
            exec wcmd, (error, stdout, stderr) =>
                if error
                    console.error error
                if stderr
                    console.error stderr
                file = stdout.replace("\n", "")
                if file.match(/\.gz$/)
                    cmd = "gzcat '#{file}' | groff -mandoc -T html"
                else
                    cmd = "groff -mandoc -T html '#{file}'"
                exec cmd, (error, stdout, stderr) =>
                    if error
                        console.error error
                    if stderr
                        console.error stderr
                    fudged = stdout.replace('<body>', '<div class="manpage-body">').replace('</body>','</div>');
                    dom = $(fudged).filter('div.manpage-body')
                    dom.css('fontFamily', atom.config.get('editor.fontFamily'))
                    dom.css('fontSize', atom.config.get('editor.fontSize'))
                    dom.css('lineHeight', atom.config.get('editor.lineHeight'))
{'fraction_non_alphanumeric': 0.1487015297047314, 'fraction_numerical': 0.000711490572749911, 'mean_word_length': 1.5633546034639927, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '724711', 'n_tokens_mistral': 796, 'n_tokens_neox': 753, 'n_words': 174}