MAJOR=4 MINOR=15 DEVNAME=tty15 ?÷ak elseif o.boolean and name == "no-" .. o.long then -- -no-option opt = o param = false break end elseif o.long and #name >= 2 and (o.long == name or (o.boolean and name == "no-" .. o.long)) then error("You must supply two hyphens (i.e. --" .. name .. ") for long option") end end if opt == nil then -- Short option name = arg[i]:sub(2,2) for _,o in ipairs(options) do if o.short then if o.short == name then if o.param then if #arg[i] > 2 then -- -oparam param = arg[i]:sub(3) else -- -o param assert(i + 1 <= #arg, "argument missing after " .. arg[i] .. " option") param = arg[i + 1] i = i + 1 end else -- -o assert(#arg[i] == 2, "combining multiple short options like -abc is not supported") param = true end opt = o break end end end end if opt then table.insert(option_and_params, {opt.long or opt.short, param}) else error("unknown short option: " .. arg[i]) end else -- arg[i] is not an option break end i = i + 1 end return option_and_params, i end return { parseoption = parseoption; } end package.preload["texrunner.tex_engine"] = function(...) --[[ Copyright 2016,2019 ARATA Mizuki This file is part of ClutTeX. ClutTeX is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. ClutTeX is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with ClutTeX. If not, see . ]] local table = table local setmetatable = setmetatable local ipairs = ipairs local shellutil = require "texrunner.shellutil" --[[ engine.name: string engine.type = "onePass" or "twoPass" engine:build_command(inputline, options) options: halt_on_error: boolean interaction: string file_line_error: boolean synctex: string shell_escape: boolean shell_restricted: boolean jobname: string output_directory: string extraoptions: a list of strings output_format: "pdf" or "dvi" draftmode: boolean (pdfTeX / XeTeX / LuaTeX) fmt: string lua_initialization_script: string (LuaTeX only) engine.executable: string engine.supports_pdf_generation: boolean engine.dvi_extension: string engine.supports_draftmode: boolean engine.is_luatex: true or nil ]] local engine_meta = {} engine_meta.__index = engine_meta engine_meta.dvi_extension = "dvi" function engine_meta:build_command(inputline, options) local executable = options.engine_executable or self.executable local command = {executable, "-recorder"} if options.fmt then table.insert(command, "-fmt=" .. options.fmt) end if options.halt_on_error then table.insert(command, "-halt-on-error") end if options.interaction then table.insert(command, "-interaction=" .. options.interaction) end if options.file_line_error then table.insert(command, "-file-line-error") end if options.synctex then table.insert(command, "-synctex=" .. shellutil.escape(options.synctex)) end if options.shell_escape == false then table.insert(command, "-no-shell-escape") elseif options.shell_restricted == true then table.insert(command, "-shell-restricted") elseif options.shell_escape == true then table.insert(command, "-shell-escape") en