texlive[55219] trunk: ptex2pdf (20may20)

commits+karl at tug.org commits+karl at tug.org
Wed May 20 23:39:04 CEST 2020


Revision: 55219
          http://tug.org/svn/texlive?view=revision&revision=55219
Author:   karl
Date:     2020-05-20 23:39:03 +0200 (Wed, 20 May 2020)
Log Message:
-----------
ptex2pdf (20may20)

Modified Paths:
--------------
    trunk/Build/source/texk/texlive/linked_scripts/ptex2pdf/ptex2pdf.lua
    trunk/Master/texmf-dist/doc/latex/ptex2pdf/README.md
    trunk/Master/texmf-dist/scripts/ptex2pdf/ptex2pdf.lua

Modified: trunk/Build/source/texk/texlive/linked_scripts/ptex2pdf/ptex2pdf.lua
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/ptex2pdf/ptex2pdf.lua	2020-05-20 21:38:45 UTC (rev 55218)
+++ trunk/Build/source/texk/texlive/linked_scripts/ptex2pdf/ptex2pdf.lua	2020-05-20 21:39:03 UTC (rev 55219)
@@ -1,7 +1,7 @@
 #!/usr/bin/env texlua
 
 NAME = "ptex2pdf[.lua]"
-VERSION = "20200307.0"
+VERSION = "20200520.0"
 AUTHOR = "Norbert Preining"
 AUTHOREMAIL = "norbert at preining.info"
 SHORTDESC = "Convert Japanese TeX documents to pdf"
@@ -141,40 +141,40 @@
 - 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 @@
   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 @@
   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 @@
   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 @@
   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 @@
         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

Modified: trunk/Master/texmf-dist/doc/latex/ptex2pdf/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/ptex2pdf/README.md	2020-05-20 21:38:45 UTC (rev 55218)
+++ trunk/Master/texmf-dist/doc/latex/ptex2pdf/README.md	2020-05-20 21:39:03 UTC (rev 55219)
@@ -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 @@
 - 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 @@
   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 ##
 

Modified: trunk/Master/texmf-dist/scripts/ptex2pdf/ptex2pdf.lua
===================================================================
--- trunk/Master/texmf-dist/scripts/ptex2pdf/ptex2pdf.lua	2020-05-20 21:38:45 UTC (rev 55218)
+++ trunk/Master/texmf-dist/scripts/ptex2pdf/ptex2pdf.lua	2020-05-20 21:39:03 UTC (rev 55219)
@@ -1,7 +1,7 @@
 #!/usr/bin/env texlua
 
 NAME = "ptex2pdf[.lua]"
-VERSION = "20200307.0"
+VERSION = "20200520.0"
 AUTHOR = "Norbert Preining"
 AUTHOREMAIL = "norbert at preining.info"
 SHORTDESC = "Convert Japanese TeX documents to pdf"
@@ -141,40 +141,40 @@
 - 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 @@
   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 @@
   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 @@
   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 @@
   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 @@
         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



More information about the tex-live-commits mailing list.