diff options
-rwxr-xr-x | Build/source/texk/texlive/linked_scripts/cluttex/cluttex.lua | 77 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/cluttex/CHANGELOG.md | 8 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/cluttex/Makefile | 2 | ||||
-rwxr-xr-x | Master/texmf-dist/doc/support/cluttex/bin/cluttex.bat | 77 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/cluttex/doc/cluttex-ja.pdf | bin | 480358 -> 152472 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/support/cluttex/doc/cluttex-ja.tex | 15 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/cluttex/doc/cluttex.pdf | bin | 174976 -> 193671 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/support/cluttex/doc/cluttex.tex | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/cluttex/src/cluttex.lua | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/cluttex/src/texrunner/checkdriver.lua | 51 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/cluttex/src/texrunner/handleoption.lua | 2 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/cluttex/src/texrunner/isatty.lua | 20 | ||||
-rwxr-xr-x | Master/texmf-dist/scripts/cluttex/cluttex.lua | 77 |
13 files changed, 263 insertions, 74 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/cluttex/cluttex.lua b/Build/source/texk/texlive/linked_scripts/cluttex/cluttex.lua index d3859a69fa5..ef8488c83e6 100755 --- a/Build/source/texk/texlive/linked_scripts/cluttex/cluttex.lua +++ b/Build/source/texk/texlive/linked_scripts/cluttex/cluttex.lua @@ -1369,7 +1369,7 @@ return { end package.preload["texrunner.handleoption"] = function(...) local COPYRIGHT_NOTICE = [[ -Copyright (C) 2016-2020 ARATA Mizuki +Copyright (C) 2016-2021 ARATA Mizuki This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1893,6 +1893,7 @@ if os.type == "unix" then -- Try LuaJIT-like FFI local succ, M = pcall(function() local ffi = require "ffi" + assert(ffi.os ~= "" and ffi.arch ~= "", "ffi library is stub") ffi.cdef[[ int isatty(int fd); int fileno(void *stream); @@ -1938,9 +1939,26 @@ int fileno(void *stream); end end + -- Fallback using system command + return { + isatty = function(file) + local fd + if file == io.stdin then + fd = 0 + elseif file == io.stdout then + fd = 1 + elseif file == io.stderr then + fd = 2 + else + return false + end + local result = os.execute(string.format("test -t %d", fd)) + return result == true or result == 0 + end, + } + else -- Try LuaJIT - -- TODO: Try to detect MinTTY using GetFileInformationByHandleEx local succ, M = pcall(function() local ffi = require "ffi" local bitlib = assert(bit32 or bit, "Neither bit32 (Lua 5.2) nor bit (LuaJIT) found") -- Lua 5.2 or LuaJIT @@ -2730,35 +2748,53 @@ local message = require "texrunner.message" local right_values = { dvips = { graphics = "dvips", - expl3 = "dvips", + expl3 = { + old = "dvips", + new = "dvips", + }, hyperref = "dvips", xypic = "dvips", }, dvipdfmx = { graphics = "dvipdfmx", - expl3 = "dvipdfmx", + expl3 = { + old = "dvipdfmx", + new = "dvipdfmx", + }, hyperref = "dvipdfmx", xypic = "pdf", }, dvisvgm = { graphics = "dvisvgm", - expl3 = "dvisvgm", + expl3 = { + old = "dvisvgm", + new = "dvisvgm", + }, }, xetex = { graphics = "xetex", - expl3 = "xdvipdfmx", + expl3 = { + old = "xdvipdfmx", + new = "xetex", + }, hyperref = "xetex", xypic = "pdf", }, pdftex = { graphics = "pdftex", - expl3 = "pdfmode", + expl3 = { + old = "pdfmode", + new = "pdftex", + }, hyperref = "pdftex", xypic = "pdf", }, luatex = { graphics = "luatex", - expl3 = "pdfmode", + expl3 = { + old = "pdfmode", + new = "luatex", + }, hyperref = "luatex", xypic = "pdf", }, @@ -2797,18 +2833,24 @@ local function checkdriver(expected_driver, filelist) graphics_driver = "unknown" end end - local expl3_driver = nil -- "pdfmode" | "dvisvgm" | "xdvipdfmx" | "dvipdfmx" | "dvips" | "unknown" - if loaded["expl3-code.tex"] or loaded["expl3.sty"] or loaded["l3backend-dvips.def"] or loaded["l3backend-dvipdfmx.def"] or loaded["l3backend-xdvipdfmx.def"] or loaded["l3backend-pdfmode.def"] then + local expl3_driver = nil -- "pdfmode" | "dvisvgm" | "xdvipdfmx" | "dvipdfmx" | "dvips" | "pdftex" | "luatex" | "xetex" | "unknown" + if loaded["expl3-code.tex"] or loaded["expl3.sty"] or loaded["l3backend-dvips.def"] or loaded["l3backend-dvipdfmx.def"] or loaded["l3backend-xdvipdfmx.def"] or loaded["l3backend-pdfmode.def"] or loaded["l3backend-pdftex.def"] or loaded["l3backend-luatex.def"] or loaded["l3backend-xetex.def"] then if loaded["l3backend-pdfmode.def"] then - expl3_driver = "pdfmode" -- pdftex, luatex + expl3_driver = "pdfmode" -- pdftex, luatex in older l3backend elseif loaded["l3backend-dvisvgm.def"] then expl3_driver = "dvisvgm" elseif loaded["l3backend-xdvipdfmx.def"] then - expl3_driver = "xdvipdfmx" + expl3_driver = "xdvipdfmx" -- xetex in older l3backend elseif loaded["l3backend-dvipdfmx.def"] then expl3_driver = "dvipdfmx" elseif loaded["l3backend-dvips.def"] then expl3_driver = "dvips" + elseif loaded["l3backend-pdftex.def"] then + expl3_driver = "pdftex" + elseif loaded["l3backend-luatex.def"] then + expl3_driver = "luatex" + elseif loaded["l3backend-xetex.def"] then + expl3_driver = "xetex" else -- TODO: driver=latex2e? expl3_driver = "unknown" @@ -2857,9 +2899,12 @@ local function checkdriver(expected_driver, filelist) message.diag("The driver option for graphics(x)/color is missing or wrong.") message.diag("Consider setting '", expected.graphics, "' option.") end - if expl3_driver ~= nil and expected.expl3 ~= nil and expl3_driver ~= expected.expl3 then + if expl3_driver ~= nil and expected.expl3 ~= nil and expl3_driver ~= expected.expl3.old and expl3_driver ~= expected.expl3.new then message.diag("The driver option for expl3 is missing or wrong.") - message.diag("Consider setting 'driver=", expected.expl3, "' option when loading expl3.") + message.diag("Consider setting 'driver=", expected.expl3.new, "' option when loading expl3.") + if expected.expl3.old ~= expected.expl3.new then + message.diag("You might need to instead set 'driver=", expected.expl3.old, "' if you are using an older version of expl3.") + end end if hyperref_driver ~= nil and expected.hyperref ~= nil and hyperref_driver ~= expected.hyperref then message.diag("The driver option for hyperref is missing or wrong.") @@ -2888,7 +2933,7 @@ return { } end --[[ - Copyright 2016-2020 ARATA Mizuki + Copyright 2016-2021 ARATA Mizuki This file is part of ClutTeX. @@ -2906,7 +2951,7 @@ end along with ClutTeX. If not, see <http://www.gnu.org/licenses/>. ]] -CLUTTEX_VERSION = "v0.5" +CLUTTEX_VERSION = "v0.5.1" -- Standard libraries local coroutine = coroutine diff --git a/Master/texmf-dist/doc/support/cluttex/CHANGELOG.md b/Master/texmf-dist/doc/support/cluttex/CHANGELOG.md index 2aa1b99bf14..d73f9ea1071 100644 --- a/Master/texmf-dist/doc/support/cluttex/CHANGELOG.md +++ b/Master/texmf-dist/doc/support/cluttex/CHANGELOG.md @@ -1,3 +1,11 @@ +Version 0.5.1 (2021-11-04) +----- + +Changes: + +* Support terminal detection on more platforms (especially on Apple Silicon) +* Support newer l3backend ([Issue #5](https://github.com/minoki/cluttex/issues/5), thanks to @gksato) + Version 0.5 (2020-02-06) ----- diff --git a/Master/texmf-dist/doc/support/cluttex/Makefile b/Master/texmf-dist/doc/support/cluttex/Makefile index ae764ad2ab5..1fbf0fd55ad 100644 --- a/Master/texmf-dist/doc/support/cluttex/Makefile +++ b/Master/texmf-dist/doc/support/cluttex/Makefile @@ -35,6 +35,6 @@ bin/cluttex.bat: $(sources) build.lua lua build.lua --windows-batchfile $@ lua checkglobal.lua $@ -archive: +archive: all git archive --format=tar --prefix=cluttex/ -o cluttex.tar HEAD gzip -k9 cluttex.tar diff --git a/Master/texmf-dist/doc/support/cluttex/bin/cluttex.bat b/Master/texmf-dist/doc/support/cluttex/bin/cluttex.bat index df0dfd395c0..8d72a6c6c07 100755 --- a/Master/texmf-dist/doc/support/cluttex/bin/cluttex.bat +++ b/Master/texmf-dist/doc/support/cluttex/bin/cluttex.bat @@ -1372,7 +1372,7 @@ return { end package.preload["texrunner.handleoption"] = function(...) local COPYRIGHT_NOTICE = [[ -Copyright (C) 2016-2020 ARATA Mizuki +Copyright (C) 2016-2021 ARATA Mizuki This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1896,6 +1896,7 @@ if os.type == "unix" then -- Try LuaJIT-like FFI local succ, M = pcall(function() local ffi = require "ffi" + assert(ffi.os ~= "" and ffi.arch ~= "", "ffi library is stub") ffi.cdef[[ int isatty(int fd); int fileno(void *stream); @@ -1941,9 +1942,26 @@ int fileno(void *stream); end end + -- Fallback using system command + return { + isatty = function(file) + local fd + if file == io.stdin then + fd = 0 + elseif file == io.stdout then + fd = 1 + elseif file == io.stderr then + fd = 2 + else + return false + end + local result = os.execute(string.format("test -t %d", fd)) + return result == true or result == 0 + end, + } + else -- Try LuaJIT - -- TODO: Try to detect MinTTY using GetFileInformationByHandleEx local succ, M = pcall(function() local ffi = require "ffi" local bitlib = assert(bit32 or bit, "Neither bit32 (Lua 5.2) nor bit (LuaJIT) found") -- Lua 5.2 or LuaJIT @@ -2733,35 +2751,53 @@ local message = require "texrunner.message" local right_values = { dvips = { graphics = "dvips", - expl3 = "dvips", + expl3 = { + old = "dvips", + new = "dvips", + }, hyperref = "dvips", xypic = "dvips", }, dvipdfmx = { graphics = "dvipdfmx", - expl3 = "dvipdfmx", + expl3 = { + old = "dvipdfmx", + new = "dvipdfmx", + }, hyperref = "dvipdfmx", xypic = "pdf", }, dvisvgm = { graphics = "dvisvgm", - expl3 = "dvisvgm", + expl3 = { + old = "dvisvgm", + new = "dvisvgm", + }, }, xetex = { graphics = "xetex", - expl3 = "xdvipdfmx", + expl3 = { + old = "xdvipdfmx", + new = "xetex", + }, hyperref = "xetex", xypic = "pdf", }, pdftex = { graphics = "pdftex", - expl3 = "pdfmode", + expl3 = { + old = "pdfmode", + new = "pdftex", + }, hyperref = "pdftex", xypic = "pdf", }, luatex = { graphics = "luatex", - expl3 = "pdfmode", + expl3 = { + old = "pdfmode", + new = "luatex", + }, hyperref = "luatex", xypic = "pdf", }, @@ -2800,18 +2836,24 @@ local function checkdriver(expected_driver, filelist) graphics_driver = "unknown" end end - local expl3_driver = nil -- "pdfmode" | "dvisvgm" | "xdvipdfmx" | "dvipdfmx" | "dvips" | "unknown" - if loaded["expl3-code.tex"] or loaded["expl3.sty"] or loaded["l3backend-dvips.def"] or loaded["l3backend-dvipdfmx.def"] or loaded["l3backend-xdvipdfmx.def"] or loaded["l3backend-pdfmode.def"] then + local expl3_driver = nil -- "pdfmode" | "dvisvgm" | "xdvipdfmx" | "dvipdfmx" | "dvips" | "pdftex" | "luatex" | "xetex" | "unknown" + if loaded["expl3-code.tex"] or loaded["expl3.sty"] or loaded["l3backend-dvips.def"] or loaded["l3backend-dvipdfmx.def"] or loaded["l3backend-xdvipdfmx.def"] or loaded["l3backend-pdfmode.def"] or loaded["l3backend-pdftex.def"] or loaded["l3backend-luatex.def"] or loaded["l3backend-xetex.def"] then if loaded["l3backend-pdfmode.def"] then - expl3_driver = "pdfmode" -- pdftex, luatex + expl3_driver = "pdfmode" -- pdftex, luatex in older l3backend elseif loaded["l3backend-dvisvgm.def"] then expl3_driver = "dvisvgm" elseif loaded["l3backend-xdvipdfmx.def"] then - expl3_driver = "xdvipdfmx" + expl3_driver = "xdvipdfmx" -- xetex in older l3backend elseif loaded["l3backend-dvipdfmx.def"] then expl3_driver = "dvipdfmx" elseif loaded["l3backend-dvips.def"] then expl3_driver = "dvips" + elseif loaded["l3backend-pdftex.def"] then + expl3_driver = "pdftex" + elseif loaded["l3backend-luatex.def"] then + expl3_driver = "luatex" + elseif loaded["l3backend-xetex.def"] then + expl3_driver = "xetex" else -- TODO: driver=latex2e? expl3_driver = "unknown" @@ -2860,9 +2902,12 @@ local function checkdriver(expected_driver, filelist) message.diag("The driver option for graphics(x)/color is missing or wrong.") message.diag("Consider setting '", expected.graphics, "' option.") end - if expl3_driver ~= nil and expected.expl3 ~= nil and expl3_driver ~= expected.expl3 then + if expl3_driver ~= nil and expected.expl3 ~= nil and expl3_driver ~= expected.expl3.old and expl3_driver ~= expected.expl3.new then message.diag("The driver option for expl3 is missing or wrong.") - message.diag("Consider setting 'driver=", expected.expl3, "' option when loading expl3.") + message.diag("Consider setting 'driver=", expected.expl3.new, "' option when loading expl3.") + if expected.expl3.old ~= expected.expl3.new then + message.diag("You might need to instead set 'driver=", expected.expl3.old, "' if you are using an older version of expl3.") + end end if hyperref_driver ~= nil and expected.hyperref ~= nil and hyperref_driver ~= expected.hyperref then message.diag("The driver option for hyperref is missing or wrong.") @@ -2891,7 +2936,7 @@ return { } end --[[ - Copyright 2016-2020 ARATA Mizuki + Copyright 2016-2021 ARATA Mizuki This file is part of ClutTeX. @@ -2909,7 +2954,7 @@ end along with ClutTeX. If not, see <http://www.gnu.org/licenses/>. ]] -CLUTTEX_VERSION = "v0.5" +CLUTTEX_VERSION = "v0.5.1" -- Standard libraries local coroutine = coroutine diff --git a/Master/texmf-dist/doc/support/cluttex/doc/cluttex-ja.pdf b/Master/texmf-dist/doc/support/cluttex/doc/cluttex-ja.pdf Binary files differindex fb5509749ce..c9f0750252c 100644 --- a/Master/texmf-dist/doc/support/cluttex/doc/cluttex-ja.pdf +++ b/Master/texmf-dist/doc/support/cluttex/doc/cluttex-ja.pdf diff --git a/Master/texmf-dist/doc/support/cluttex/doc/cluttex-ja.tex b/Master/texmf-dist/doc/support/cluttex/doc/cluttex-ja.tex index b48cbe8f8ba..b4742ee4eea 100644 --- a/Master/texmf-dist/doc/support/cluttex/doc/cluttex-ja.tex +++ b/Master/texmf-dist/doc/support/cluttex/doc/cluttex-ja.tex @@ -2,17 +2,18 @@ \usepackage[unicode]{hyperref} \usepackage{jslogo} % for \BibTeX \usepackage{amsmath} +\usepackage[nameinlink]{cleveref} \newcommand\ClutTeX{Clut\TeX} \newcommand\texcmd[1]{\texttt{\textbackslash #1}} \newcommand\texenv[1]{\texttt{#1}} \newcommand\texpkg[1]{\texttt{#1}} \newcommand\metavar[1]{\textsf{#1}} -\renewcommand\sectionautorefname{セクション} -\renewcommand\subsectionautorefname{サブセクション} +\crefformat{section}{#2セクション#1#3} +\crefformat{subsection}{#2サブセクション#1#3} -\title{\ClutTeX{}マニュアル\\(バージョン0.5)} +\title{\ClutTeX{}マニュアル\\(バージョン0.5.1)} \author{ARATA Mizuki} -\date{2020年2月6日} +\date{2021年11月4日} \begin{document} \maketitle @@ -74,7 +75,7 @@ \item[\texttt{--watch}] 入力ファイルを監視する。 別途、\texttt{fswatch}プログラムまたは\texttt{inotifywait}プログラムが必要となる場合がある。 - 詳しくは\autoref{sec:watch-mode}を参照。 + 詳しくは\cref{sec:watch-mode}を参照。 \item[\texttt{--color[=\metavar{WHEN}]}] ターミナルへの出力を色付けする。 \metavar{WHEN}は\texttt{always}, \texttt{auto}, \texttt{never}のいずれかを指定する。 @@ -127,7 +128,7 @@ \item[\texttt{--synctex=\metavar{NUMBER}}] Sync\TeX{}用のファイルを生成する。 注意点として、\texttt{.synctex.gz}ファイルは\texttt{.pdf}ファイルと同じディレクトリに生成される。 - 詳しくは\autoref{sec:synctex}を参照。 + 詳しくは\cref{sec:synctex}を参照。 \item[\texttt{--[no-]file-line-error}] デフォルト:Yes \item[\texttt{--[no-]halt-on-error}] @@ -176,7 +177,7 @@ Biberを使って文献リストを処理する場合、使用すべきオプシ しかし、\texcmd{includeonly}コマンドを\TeX{}ソース中に記述していちいち切り替えるのは面倒である。 そこで、\ClutTeX{}では\texcmd{includeonly}コマンドを\texttt{--includeonly}オプションによって指定できるようにした。 -使用例は\autoref{sec:makefile-example}を参照せよ。 +使用例は\cref{sec:makefile-example}を参照せよ。 Tips: \texttt{includeonly}を使用する際は、\texttt{--makeindex}等のオプションは使用しない方が良い。 diff --git a/Master/texmf-dist/doc/support/cluttex/doc/cluttex.pdf b/Master/texmf-dist/doc/support/cluttex/doc/cluttex.pdf Binary files differindex d9e3f7df04c..2d49565b10d 100644 --- a/Master/texmf-dist/doc/support/cluttex/doc/cluttex.pdf +++ b/Master/texmf-dist/doc/support/cluttex/doc/cluttex.pdf diff --git a/Master/texmf-dist/doc/support/cluttex/doc/cluttex.tex b/Master/texmf-dist/doc/support/cluttex/doc/cluttex.tex index 4666668d082..ae3bc01b673 100644 --- a/Master/texmf-dist/doc/support/cluttex/doc/cluttex.tex +++ b/Master/texmf-dist/doc/support/cluttex/doc/cluttex.tex @@ -8,9 +8,9 @@ \newcommand\texpkg[1]{\texttt{#1}} \newcommand\metavar[1]{\textnormal{\textsf{#1}}} -\title{\ClutTeX\ manual\\(Version 0.5)} +\title{\ClutTeX\ manual\\(Version 0.5.1)} \author{ARATA Mizuki} -\date{2020-02-06} +\date{2021-11-04} \begin{document} \maketitle diff --git a/Master/texmf-dist/doc/support/cluttex/src/cluttex.lua b/Master/texmf-dist/doc/support/cluttex/src/cluttex.lua index 380deefebe4..d7875c0ab12 100644 --- a/Master/texmf-dist/doc/support/cluttex/src/cluttex.lua +++ b/Master/texmf-dist/doc/support/cluttex/src/cluttex.lua @@ -1,6 +1,6 @@ #!/usr/bin/env texlua --[[ - Copyright 2016-2020 ARATA Mizuki + Copyright 2016-2021 ARATA Mizuki This file is part of ClutTeX. @@ -18,7 +18,7 @@ along with ClutTeX. If not, see <http://www.gnu.org/licenses/>. ]] -CLUTTEX_VERSION = "v0.5" +CLUTTEX_VERSION = "v0.5.1" -- Standard libraries local table = table diff --git a/Master/texmf-dist/doc/support/cluttex/src/texrunner/checkdriver.lua b/Master/texmf-dist/doc/support/cluttex/src/texrunner/checkdriver.lua index 65e33b9d214..3b8b94e266f 100644 --- a/Master/texmf-dist/doc/support/cluttex/src/texrunner/checkdriver.lua +++ b/Master/texmf-dist/doc/support/cluttex/src/texrunner/checkdriver.lua @@ -26,35 +26,53 @@ local message = require "texrunner.message" local right_values = { dvips = { graphics = "dvips", - expl3 = "dvips", + expl3 = { + old = "dvips", + new = "dvips", + }, hyperref = "dvips", xypic = "dvips", }, dvipdfmx = { graphics = "dvipdfmx", - expl3 = "dvipdfmx", + expl3 = { + old = "dvipdfmx", + new = "dvipdfmx", + }, hyperref = "dvipdfmx", xypic = "pdf", }, dvisvgm = { graphics = "dvisvgm", - expl3 = "dvisvgm", + expl3 = { + old = "dvisvgm", + new = "dvisvgm", + }, }, xetex = { graphics = "xetex", - expl3 = "xdvipdfmx", + expl3 = { + old = "xdvipdfmx", + new = "xetex", + }, hyperref = "xetex", xypic = "pdf", }, pdftex = { graphics = "pdftex", - expl3 = "pdfmode", + expl3 = { + old = "pdfmode", + new = "pdftex", + }, hyperref = "pdftex", xypic = "pdf", }, luatex = { graphics = "luatex", - expl3 = "pdfmode", + expl3 = { + old = "pdfmode", + new = "luatex", + }, hyperref = "luatex", xypic = "pdf", }, @@ -93,18 +111,24 @@ local function checkdriver(expected_driver, filelist) graphics_driver = "unknown" end end - local expl3_driver = nil -- "pdfmode" | "dvisvgm" | "xdvipdfmx" | "dvipdfmx" | "dvips" | "unknown" - if loaded["expl3-code.tex"] or loaded["expl3.sty"] or loaded["l3backend-dvips.def"] or loaded["l3backend-dvipdfmx.def"] or loaded["l3backend-xdvipdfmx.def"] or loaded["l3backend-pdfmode.def"] then + local expl3_driver = nil -- "pdfmode" | "dvisvgm" | "xdvipdfmx" | "dvipdfmx" | "dvips" | "pdftex" | "luatex" | "xetex" | "unknown" + if loaded["expl3-code.tex"] or loaded["expl3.sty"] or loaded["l3backend-dvips.def"] or loaded["l3backend-dvipdfmx.def"] or loaded["l3backend-xdvipdfmx.def"] or loaded["l3backend-pdfmode.def"] or loaded["l3backend-pdftex.def"] or loaded["l3backend-luatex.def"] or loaded["l3backend-xetex.def"] then if loaded["l3backend-pdfmode.def"] then - expl3_driver = "pdfmode" -- pdftex, luatex + expl3_driver = "pdfmode" -- pdftex, luatex in older l3backend elseif loaded["l3backend-dvisvgm.def"] then expl3_driver = "dvisvgm" elseif loaded["l3backend-xdvipdfmx.def"] then - expl3_driver = "xdvipdfmx" + expl3_driver = "xdvipdfmx" -- xetex in older l3backend elseif loaded["l3backend-dvipdfmx.def"] then expl3_driver = "dvipdfmx" elseif loaded["l3backend-dvips.def"] then expl3_driver = "dvips" + elseif loaded["l3backend-pdftex.def"] then + expl3_driver = "pdftex" + elseif loaded["l3backend-luatex.def"] then + expl3_driver = "luatex" + elseif loaded["l3backend-xetex.def"] then + expl3_driver = "xetex" else -- TODO: driver=latex2e? expl3_driver = "unknown" @@ -153,9 +177,12 @@ local function checkdriver(expected_driver, filelist) message.diag("The driver option for graphics(x)/color is missing or wrong.") message.diag("Consider setting '", expected.graphics, "' option.") end - if expl3_driver ~= nil and expected.expl3 ~= nil and expl3_driver ~= expected.expl3 then + if expl3_driver ~= nil and expected.expl3 ~= nil and expl3_driver ~= expected.expl3.old and expl3_driver ~= expected.expl3.new then message.diag("The driver option for expl3 is missing or wrong.") - message.diag("Consider setting 'driver=", expected.expl3, "' option when loading expl3.") + message.diag("Consider setting 'driver=", expected.expl3.new, "' option when loading expl3.") + if expected.expl3.old ~= expected.expl3.new then + message.diag("You might need to instead set 'driver=", expected.expl3.old, "' if you are using an older version of expl3.") + end end if hyperref_driver ~= nil and expected.hyperref ~= nil and hyperref_driver ~= expected.hyperref then message.diag("The driver option for hyperref is missing or wrong.") diff --git a/Master/texmf-dist/doc/support/cluttex/src/texrunner/handleoption.lua b/Master/texmf-dist/doc/support/cluttex/src/texrunner/handleoption.lua index a542070038b..8d44567b468 100644 --- a/Master/texmf-dist/doc/support/cluttex/src/texrunner/handleoption.lua +++ b/Master/texmf-dist/doc/support/cluttex/src/texrunner/handleoption.lua @@ -1,5 +1,5 @@ local COPYRIGHT_NOTICE = [[ -Copyright (C) 2016-2020 ARATA Mizuki +Copyright (C) 2016-2021 ARATA Mizuki This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/Master/texmf-dist/doc/support/cluttex/src/texrunner/isatty.lua b/Master/texmf-dist/doc/support/cluttex/src/texrunner/isatty.lua index 000e2510b78..1d363d34628 100644 --- a/Master/texmf-dist/doc/support/cluttex/src/texrunner/isatty.lua +++ b/Master/texmf-dist/doc/support/cluttex/src/texrunner/isatty.lua @@ -21,6 +21,7 @@ if os.type == "unix" then -- Try LuaJIT-like FFI local succ, M = pcall(function() local ffi = require "ffi" + assert(ffi.os ~= "" and ffi.arch ~= "", "ffi library is stub") ffi.cdef[[ int isatty(int fd); int fileno(void *stream); @@ -66,9 +67,26 @@ int fileno(void *stream); end end + -- Fallback using system command + return { + isatty = function(file) + local fd + if file == io.stdin then + fd = 0 + elseif file == io.stdout then + fd = 1 + elseif file == io.stderr then + fd = 2 + else + return false + end + local result = os.execute(string.format("test -t %d", fd)) + return result == true or result == 0 + end, + } + else -- Try LuaJIT - -- TODO: Try to detect MinTTY using GetFileInformationByHandleEx local succ, M = pcall(function() local ffi = require "ffi" local bitlib = assert(bit32 or bit, "Neither bit32 (Lua 5.2) nor bit (LuaJIT) found") -- Lua 5.2 or LuaJIT diff --git a/Master/texmf-dist/scripts/cluttex/cluttex.lua b/Master/texmf-dist/scripts/cluttex/cluttex.lua index d3859a69fa5..ef8488c83e6 100755 --- a/Master/texmf-dist/scripts/cluttex/cluttex.lua +++ b/Master/texmf-dist/scripts/cluttex/cluttex.lua @@ -1369,7 +1369,7 @@ return { end package.preload["texrunner.handleoption"] = function(...) local COPYRIGHT_NOTICE = [[ -Copyright (C) 2016-2020 ARATA Mizuki +Copyright (C) 2016-2021 ARATA Mizuki This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1893,6 +1893,7 @@ if os.type == "unix" then -- Try LuaJIT-like FFI local succ, M = pcall(function() local ffi = require "ffi" + assert(ffi.os ~= "" and ffi.arch ~= "", "ffi library is stub") ffi.cdef[[ int isatty(int fd); int fileno(void *stream); @@ -1938,9 +1939,26 @@ int fileno(void *stream); end end + -- Fallback using system command + return { + isatty = function(file) + local fd + if file == io.stdin then + fd = 0 + elseif file == io.stdout then + fd = 1 + elseif file == io.stderr then + fd = 2 + else + return false + end + local result = os.execute(string.format("test -t %d", fd)) + return result == true or result == 0 + end, + } + else -- Try LuaJIT - -- TODO: Try to detect MinTTY using GetFileInformationByHandleEx local succ, M = pcall(function() local ffi = require "ffi" local bitlib = assert(bit32 or bit, "Neither bit32 (Lua 5.2) nor bit (LuaJIT) found") -- Lua 5.2 or LuaJIT @@ -2730,35 +2748,53 @@ local message = require "texrunner.message" local right_values = { dvips = { graphics = "dvips", - expl3 = "dvips", + expl3 = { + old = "dvips", + new = "dvips", + }, hyperref = "dvips", xypic = "dvips", }, dvipdfmx = { graphics = "dvipdfmx", - expl3 = "dvipdfmx", + expl3 = { + old = "dvipdfmx", + new = "dvipdfmx", + }, hyperref = "dvipdfmx", xypic = "pdf", }, dvisvgm = { graphics = "dvisvgm", - expl3 = "dvisvgm", + expl3 = { + old = "dvisvgm", + new = "dvisvgm", + }, }, xetex = { graphics = "xetex", - expl3 = "xdvipdfmx", + expl3 = { + old = "xdvipdfmx", + new = "xetex", + }, hyperref = "xetex", xypic = "pdf", }, pdftex = { graphics = "pdftex", - expl3 = "pdfmode", + expl3 = { + old = "pdfmode", + new = "pdftex", + }, hyperref = "pdftex", xypic = "pdf", }, luatex = { graphics = "luatex", - expl3 = "pdfmode", + expl3 = { + old = "pdfmode", + new = "luatex", + }, hyperref = "luatex", xypic = "pdf", }, @@ -2797,18 +2833,24 @@ local function checkdriver(expected_driver, filelist) graphics_driver = "unknown" end end - local expl3_driver = nil -- "pdfmode" | "dvisvgm" | "xdvipdfmx" | "dvipdfmx" | "dvips" | "unknown" - if loaded["expl3-code.tex"] or loaded["expl3.sty"] or loaded["l3backend-dvips.def"] or loaded["l3backend-dvipdfmx.def"] or loaded["l3backend-xdvipdfmx.def"] or loaded["l3backend-pdfmode.def"] then + local expl3_driver = nil -- "pdfmode" | "dvisvgm" | "xdvipdfmx" | "dvipdfmx" | "dvips" | "pdftex" | "luatex" | "xetex" | "unknown" + if loaded["expl3-code.tex"] or loaded["expl3.sty"] or loaded["l3backend-dvips.def"] or loaded["l3backend-dvipdfmx.def"] or loaded["l3backend-xdvipdfmx.def"] or loaded["l3backend-pdfmode.def"] or loaded["l3backend-pdftex.def"] or loaded["l3backend-luatex.def"] or loaded["l3backend-xetex.def"] then if loaded["l3backend-pdfmode.def"] then - expl3_driver = "pdfmode" -- pdftex, luatex + expl3_driver = "pdfmode" -- pdftex, luatex in older l3backend elseif loaded["l3backend-dvisvgm.def"] then expl3_driver = "dvisvgm" elseif loaded["l3backend-xdvipdfmx.def"] then - expl3_driver = "xdvipdfmx" + expl3_driver = "xdvipdfmx" -- xetex in older l3backend elseif loaded["l3backend-dvipdfmx.def"] then expl3_driver = "dvipdfmx" elseif loaded["l3backend-dvips.def"] then expl3_driver = "dvips" + elseif loaded["l3backend-pdftex.def"] then + expl3_driver = "pdftex" + elseif loaded["l3backend-luatex.def"] then + expl3_driver = "luatex" + elseif loaded["l3backend-xetex.def"] then + expl3_driver = "xetex" else -- TODO: driver=latex2e? expl3_driver = "unknown" @@ -2857,9 +2899,12 @@ local function checkdriver(expected_driver, filelist) message.diag("The driver option for graphics(x)/color is missing or wrong.") message.diag("Consider setting '", expected.graphics, "' option.") end - if expl3_driver ~= nil and expected.expl3 ~= nil and expl3_driver ~= expected.expl3 then + if expl3_driver ~= nil and expected.expl3 ~= nil and expl3_driver ~= expected.expl3.old and expl3_driver ~= expected.expl3.new then message.diag("The driver option for expl3 is missing or wrong.") - message.diag("Consider setting 'driver=", expected.expl3, "' option when loading expl3.") + message.diag("Consider setting 'driver=", expected.expl3.new, "' option when loading expl3.") + if expected.expl3.old ~= expected.expl3.new then + message.diag("You might need to instead set 'driver=", expected.expl3.old, "' if you are using an older version of expl3.") + end end if hyperref_driver ~= nil and expected.hyperref ~= nil and hyperref_driver ~= expected.hyperref then message.diag("The driver option for hyperref is missing or wrong.") @@ -2888,7 +2933,7 @@ return { } end --[[ - Copyright 2016-2020 ARATA Mizuki + Copyright 2016-2021 ARATA Mizuki This file is part of ClutTeX. @@ -2906,7 +2951,7 @@ end along with ClutTeX. If not, see <http://www.gnu.org/licenses/>. ]] -CLUTTEX_VERSION = "v0.5" +CLUTTEX_VERSION = "v0.5.1" -- Standard libraries local coroutine = coroutine |