summaryrefslogtreecommitdiff
path: root/macros/luatex/optex/op-macros.opm
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-02-27 03:01:13 +0000
committerNorbert Preining <norbert@preining.info>2020-02-27 03:01:13 +0000
commitcfcab0823d16bb9acd6d6a7d3f80a7b2176a6260 (patch)
tree4db3d6f79edb6570d6c812c4962a4322c0605534 /macros/luatex/optex/op-macros.opm
parent2dfd6df5d1db270dc874c6c319d51eed43defb91 (diff)
CTAN sync 202002270301
Diffstat (limited to 'macros/luatex/optex/op-macros.opm')
-rw-r--r--macros/luatex/optex/op-macros.opm15
1 files changed, 13 insertions, 2 deletions
diff --git a/macros/luatex/optex/op-macros.opm b/macros/luatex/optex/op-macros.opm
index 659abfe875..00c8f58705 100644
--- a/macros/luatex/optex/op-macros.opm
+++ b/macros/luatex/optex/op-macros.opm
@@ -44,7 +44,6 @@
\_newtoks\_opt
-
% \eoldef \foo #1{thex to end of line is: #1}
\_def\_eoldef #1{\_def #1{\_begingroup \_catcode`\^^M=12 \_eoldefA #1}%
@@ -84,11 +83,23 @@
\_def\_enquotes{\_chardef\"="201C } % use \"text" for English quotes
+%> \removespaces text with spaces {} -> textwithspaces
+
+\_def\_removespaces #1 {\_isempty{#1}\_iffalse #1\_ea\_removespaces\_fi}
+
+%> \trycs{<csname>}{<text>}
+
+\_def \_trycs#1#2{\_ifcsname #1\_endcsname \_csname #1\_endcsname \_else #2\_fi}
+
\public
\setctable \restorectable
\normalcatodes \opt \optdef \eoldef \replstring
- \keepinputnames \lastinputname \enquotes ;
+ \keepinputnames \lastinputname \enquotes \removespaces \trycs ;
\_endcode % -------------------------------------
+
+\%> \trycs
+
+`\trycs{<csname>}{<text>} expands to \<csname> if it is defined else to <text>.