<commit_before>child_process = require "child_process"
path = require "path"

module.exports =
  executable: "latexmk"

  run: (args) ->
    # TODO: Add support for killing the process.
    proc = child_process.exec("#{@executable} #{args.join(" ")}")
    proc.on "close", (code, signal) =>
      if code == 0
        # TODO: Display a more visible success message.
        console.info "Success!" unless atom.inSpecMode()
      else
        # TODO: Introduce proper error and warning handling.
        console.error "TeXification failed! Check the log file for more info..." unless atom.inSpecMode()
    proc

  constructArgs: (filePath) ->
    args = [
      "-interaction=nonstopmode"
      "-f"
      "-cd"
      "-pdf"
    ]

    pdfOpts = [
      "-synctex=1"
      "-file-line-error"
    ]

    enableShellEscape = atom.config.get("latex.enableShellEscape")
    pdfOpts.push("-shell-escape %O %S") if enableShellEscape?
    args.push("-pdflatex=\"pdflatex #{pdfOpts.join(" ")}\"")

    outdir = atom.config.get("latex.outputDirectory")
    if outdir?.length
      dir = path.dirname(filePath)
      outdir = path.join(dir, outdir)
      args.push("-outdir=#{outdir}")<commit_msg>Always use latexmk placeholders (%S %O)<commit_after>child_process = require "child_process"
path = require "path"

module.exports =
  executable: "latexmk"

  run: (args) ->
    # TODO: Add support for killing the process.
    proc = child_process.exec("#{@executable} #{args.join(" ")}")
    proc.on "close", (code, signal) =>
      if code == 0
        # TODO: Display a more visible success message.
        console.info "Success!" unless atom.inSpecMode()
      else
        # TODO: Introduce proper error and warning handling.
        console.error "TeXification failed! Check the log file for more info..." unless atom.inSpecMode()
    proc

  constructArgs: (filePath) ->
    args = [
      "-interaction=nonstopmode"
      "-f"
      "-cd"
      "-pdf"
    ]

    pdfOpts = [
      "-synctex=1"
      "-file-line-error"
    ]

    enableShellEscape = atom.config.get("latex.enableShellEscape")
    pdfOpts.push("-shell-escape") if enableShellEscape?
    args.push("-pdflatex=\"pdflatex #{pdfOpts.join(" ")} %O %S\"")

    outdir = atom.config.get("latex.outputDirectory")
    if outdir?.length
      dir = path.dirname(filePath)
      outdir = path.join(dir, outdir)
      args.push("-outdir=#{outdir}")
{'fraction_non_alphanumeric': 0.14595496246872394, 'fraction_numerical': 0.0016680567139282735, 'mean_word_length': 2.760188087774295, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '5351440', 'n_tokens_mistral': 777, 'n_tokens_neox': 771, 'n_words': 182}