diff options
author | Karl Berry <karl@freefriends.org> | 2020-05-20 21:39:03 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-05-20 21:39:03 +0000 |
commit | 8097fd855c5cca537cf95e306e3d6a4257c85579 (patch) | |
tree | 255a51f3c29f2936a5972404966cd6e21fb510a2 /Master/texmf-dist | |
parent | 77312c5ce1f7c7c47b461a685daf05c00eb4bd9b (diff) |
ptex2pdf (20may20)
git-svn-id: svn://tug.org/texlive/trunk@55219 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/latex/ptex2pdf/README.md | 24 | ||||
-rwxr-xr-x | Master/texmf-dist/scripts/ptex2pdf/ptex2pdf.lua | 50 |
2 files changed, 51 insertions, 23 deletions
diff --git a/Master/texmf-dist/doc/latex/ptex2pdf/README.md b/Master/texmf-dist/doc/latex/ptex2pdf/README.md index 1fe1e275ccc..fccd66fdb3b 100644 --- a/Master/texmf-dist/doc/latex/ptex2pdf/README.md +++ b/Master/texmf-dist/doc/latex/ptex2pdf/README.md @@ -1,7 +1,7 @@ # ptex2pdf[.lua] # **Author:** Norbert Preining -**Website:** http://www.preining.info/blog/software-projects/ptex2pdf/ (in Japanese) +**Website:** http://github.com/texjporg/ptex2pdf **License:** GPLv2 Convert Japanese TeX documents to pdf @@ -127,40 +127,40 @@ http://github.com/texjporg/ptex2pdf - version 0.2 2013-03-10 NP import into git repository support passing options on to tex and dvipdfm - add README with TeXworks config options + add README with TeXworks config options - version 0.3 2013-05-01 NP include the readme in the lua code - fix program name for -e -u + fix program name for -e -u - version 0.4 2013-05-07 NP quote the filename with ", so that special chars do survive - add an example for TeXworks for files with different kanji encoding + add an example for TeXworks for files with different kanji encoding - version 0.5 2014-11-05 NP on Windows: set command_line_encoding to utf8 when running uptex - (patch by Akira Kakuto) + (patch by Akira Kakuto) - version 0.6 2015-03-08 NP cygwin didn't like the (accidentally inserted) spaces after the texlua in the shebang line, and stopped working with - "no such program: "texlua " ..." + "no such program: "texlua " ..." - version 0.7 2015-04-29 move to github as gitorious will be closed, adapt help output to generate github flavored markdown check for files using kpathsea instead of opening directly, to allow - for input of files found by kpathsea (closes github issue 1) + for input of files found by kpathsea (closes github issue 1) - version 0.8 2015-06-15 file name checks: first search for arg as is, then try .tex and .ltx - (closes github issue: 3) + (closes github issue: 3) - version 0.9 2016-12-12 allow for files in sub-directories add -output-directory option update copyright and development place (now in texjp) support 'flag=val' to specify option values - only allow one (1) filename argument + only allow one (1) filename argument - version 20170603.0 start version number in the format YYYYMMDD.0 better support for cp932 windows filenames - first replace all backslash chars to slash chars + first replace all backslash chars to slash chars - version 20170622.0 - pass all non-optional arguments before filename to TeX engine + pass all non-optional arguments before filename to TeX engine - version 20180514.0 Windows: for uptex use command_line_encoding=utf8, for all other turn it off (set to none) @@ -170,6 +170,8 @@ http://github.com/texjporg/ptex2pdf check invalid PATH string beforehand on windows - version 20200307.0 add -ld option to run (u)platex-dev +- version 20200520.0 + Windows: lua mode - support non-ascii file name on recent luatex ## Copyright and License ## diff --git a/Master/texmf-dist/scripts/ptex2pdf/ptex2pdf.lua b/Master/texmf-dist/scripts/ptex2pdf/ptex2pdf.lua index d2668d6df84..a15075abef2 100755 --- a/Master/texmf-dist/scripts/ptex2pdf/ptex2pdf.lua +++ b/Master/texmf-dist/scripts/ptex2pdf/ptex2pdf.lua @@ -1,7 +1,7 @@ #!/usr/bin/env texlua NAME = "ptex2pdf[.lua]" -VERSION = "20200307.0" +VERSION = "20200520.0" AUTHOR = "Norbert Preining" AUTHOREMAIL = "norbert@preining.info" SHORTDESC = "Convert Japanese TeX documents to pdf" @@ -141,40 +141,40 @@ CHANGELOG = [[ - version 0.2 2013-03-10 NP import into git repository support passing options on to tex and dvipdfm - add README with TeXworks config options + add README with TeXworks config options - version 0.3 2013-05-01 NP include the readme in the lua code - fix program name for -e -u + fix program name for -e -u - version 0.4 2013-05-07 NP quote the filename with ", so that special chars do survive - add an example for TeXworks for files with different kanji encoding + add an example for TeXworks for files with different kanji encoding - version 0.5 2014-11-05 NP on Windows: set command_line_encoding to utf8 when running uptex - (patch by Akira Kakuto) + (patch by Akira Kakuto) - version 0.6 2015-03-08 NP cygwin didn't like the (accidentally inserted) spaces after the texlua in the shebang line, and stopped working with - "no such program: "texlua " ..." + "no such program: "texlua " ..." - version 0.7 2015-04-29 move to github as gitorious will be closed, adapt help output to generate github flavored markdown check for files using kpathsea instead of opening directly, to allow - for input of files found by kpathsea (closes github issue 1) + for input of files found by kpathsea (closes github issue 1) - version 0.8 2015-06-15 file name checks: first search for arg as is, then try .tex and .ltx - (closes github issue: 3) + (closes github issue: 3) - version 0.9 2016-12-12 allow for files in sub-directories add -output-directory option update copyright and development place (now in texjp) support 'flag=val' to specify option values - only allow one (1) filename argument + only allow one (1) filename argument - version 20170603.0 start version number in the format YYYYMMDD.0 better support for cp932 windows filenames - first replace all backslash chars to slash chars + first replace all backslash chars to slash chars - version 20170622.0 - pass all non-optional arguments before filename to TeX engine + pass all non-optional arguments before filename to TeX engine - version 20180514.0 Windows: for uptex use command_line_encoding=utf8, for all other turn it off (set to none) @@ -184,6 +184,8 @@ CHANGELOG = [[ check invalid PATH string beforehand on windows - version 20200307.0 add -ld option to run (u)platex-dev +- version 20200520.0 + Windows: lua mode - support non-ascii file name on recent luatex ]] @@ -195,7 +197,7 @@ function makereadme() print("# " .. NAME .. " #") print() print("**Author:** " .. AUTHOR .. " ") - print("**Website:** http://www.preining.info/blog/software-projects/ptex2pdf/ (in Japanese) ") + print("**Website:** http://github.com/texjporg/ptex2pdf ") print("**License:** GPLv2") print() print(SHORTDESC) @@ -381,6 +383,18 @@ else end end +function is_texlivew32() + if status.luatex_version < 112 then + return false + end + if os.type == 'windows' + and kpse.var_value('command_line_encoding') ~= nil then + return true + else + return false + end +end + -- initialize kpse kpse.set_program_name(tex) @@ -392,6 +406,9 @@ if ( filename == "" ) then print("No filename argument given, exiting.") os.exit(1) else + if is_texlivew32() then + filename = chgstrcp.syscptoutf8(filename) + end filename = slashify(filename) if ( kpse.find_file(filename) == nil ) then -- try .tex extension @@ -401,15 +418,24 @@ else print("File cannot be found with kpathsea: ", filename .. "[.tex, .ltx]") os.exit(1) else + if is_texlivew32() then + filename = chgstrcp.utf8tosyscp(filename) + end bname = filename filename = filename .. ".ltx" end else + if is_texlivew32() then + filename = chgstrcp.utf8tosyscp(filename) + end bname = filename filename = filename .. ".tex" end else -- if it has already an extension, we need to drop it to get the dvi name + if is_texlivew32() then + filename = chgstrcp.utf8tosyscp(filename) + end bname = string.gsub(filename, "^(.*)%.[^./]+$", "%1") end -- filename may contain "/", but the intermediate output is written |