[latex3-commits] [git/LaTeX3-latex3-iftex] master: guard against active punctuation before \detokenize is available (failed compatibility in oberdiek tests) (c518064)

David Carlisle d.p.carlisle at gmail.com
Sun Oct 27 14:35:22 CET 2019


Repository : https://github.com/latex3/iftex
On branch  : master
Link       : https://github.com/latex3/iftex/commit/c5180642090c437058097897ed224842ded58ff1

>---------------------------------------------------------------

commit c5180642090c437058097897ed224842ded58ff1
Author: David Carlisle <d.p.carlisle at gmail.com>
Date:   Sun Oct 27 13:35:22 2019 +0000

    guard against active punctuation before \detokenize is available (failed compatibility in oberdiek tests)


>---------------------------------------------------------------

c5180642090c437058097897ed224842ded58ff1
 iftex.sty                                          | 23 +++++++++++++---------
 .../{plain-ifxetex1.tlg => active1.luatex.tlg}     |  3 ++-
 testfiles-etex-plain/active1.lvt                   | 15 ++++++++++++++
 .../{plain-ifxetex1.tlg => active1.tlg}            |  3 ++-
 4 files changed, 33 insertions(+), 11 deletions(-)

diff --git a/iftex.sty b/iftex.sty
index 453b088..767a5b5 100644
--- a/iftex.sty
+++ b/iftex.sty
@@ -54,6 +54,14 @@
 }
 
 
+% make sure \detokenize and \protected are available in lualatex,
+% but avoid defining them after the package if not already defined.
+\ifx\directlua\@undefined\else
+  \let\IFTEX at detokenize\detokenize
+  \let\IFTEX at protected\protected
+  \directlua{tex\string .enableprimitives\string (\string"\string  ", {\string "detokenize\string ",\string "protected\string "}\string )}
+\fi
+
 % eTeX \protected if available.
 \ifx\protected\@undefined
   \let\IFTEX at protected\relax
@@ -62,13 +70,6 @@
 \fi
 
 
-% make sure \detokenize and \protected are available in lualatex,
-% but avoid defining them after the package if not already defined.
-\ifx\directlua\@undefined\else
-  \directlua{tex.enableprimitives("IFTEX@", {"detokenize","protected"})}
-\fi
-
-
 % \Require... commands that stop if the wrong engine detected.
 \IFTEX at protected\def\RequireeTeX{\IFTEX at Require\ifetex{eTeX}\fi}
 \IFTEX at protected\def\RequirePDFTeX{\IFTEX at Require\ifpdftex{pdfTeX}\fi}
@@ -133,7 +134,7 @@
 \IFTEX at let{luahbtex}{false}
 \ifx\directlua\@undefined
 \else
-  \directlua{\IFTEX at detokenize{
+  \directlua{\detokenize{
    if(pcall(require, 'luaharfbuzz')) then
      tex.print("\\let\\ifluahbtex\\iftrue ")
    end
@@ -215,7 +216,7 @@
   \fi
 \fi
 \else
-\directlua{\IFTEX at detokenize{
+\directlua{\detokenize{
 if (tex.outputmode or tex.pdfoutput or 0) > 0 then
   tex.print('\\pdftrue')
 end
@@ -223,4 +224,8 @@ end
 \fi
 
 % restore things
+\ifx\directlua\@undefined\else
+  \let\detokenize\IFTEX at detokenize
+  \let\protected\IFTEX at protected
+\fi
 \catcode64 \IFTEX at atcatcode
diff --git a/testfiles-etex-plain/plain-ifxetex1.tlg b/testfiles-etex-plain/active1.luatex.tlg
similarity index 86%
copy from testfiles-etex-plain/plain-ifxetex1.tlg
copy to testfiles-etex-plain/active1.luatex.tlg
index 5ecadde..5755a15 100644
--- a/testfiles-etex-plain/plain-ifxetex1.tlg
+++ b/testfiles-etex-plain/active1.luatex.tlg
@@ -1,3 +1,4 @@
 This is a generated file for the l3build validation system.
 Don't change this file in any respect.
-Not XeTeX
+(iftex.sty)
+yes
diff --git a/testfiles-etex-plain/active1.lvt b/testfiles-etex-plain/active1.lvt
new file mode 100644
index 0000000..f41fe76
--- /dev/null
+++ b/testfiles-etex-plain/active1.lvt
@@ -0,0 +1,15 @@
+\input regression-test
+
+\catcode`\"=13
+\def"{oops}
+
+\START
+\input iftex.sty
+
+\ifluatex
+\TYPE{yes}
+\else
+\TYPE{no}
+\fi
+
+\END
\ No newline at end of file
diff --git a/testfiles-etex-plain/plain-ifxetex1.tlg b/testfiles-etex-plain/active1.tlg
similarity index 86%
copy from testfiles-etex-plain/plain-ifxetex1.tlg
copy to testfiles-etex-plain/active1.tlg
index 5ecadde..b81c847 100644
--- a/testfiles-etex-plain/plain-ifxetex1.tlg
+++ b/testfiles-etex-plain/active1.tlg
@@ -1,3 +1,4 @@
 This is a generated file for the l3build validation system.
 Don't change this file in any respect.
-Not XeTeX
+(iftex.sty)
+no





More information about the latex3-commits mailing list