diff options
Diffstat (limited to 'macros/optex/base/more-macros.opm')
-rw-r--r-- | macros/optex/base/more-macros.opm | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/macros/optex/base/more-macros.opm b/macros/optex/base/more-macros.opm index 3f4916a9c3..7e1d1e2b94 100644 --- a/macros/optex/base/more-macros.opm +++ b/macros/optex/base/more-macros.opm @@ -216,13 +216,19 @@ \def\replAB#1{\immediateassigned{\def\tmp{#1}\replstring\tmp{A}{B}}\the\_tmptoks} \replAB {text A \and A} % expands to "text B \and B" \endtt + + There exists another limitation of the \^`\replstring` macro, see + \ulink[http://petr.olsak.net/optex/optex-tricks.html\#xreplstring]{\OpTeX/ trick 0136}. + The expandable \^`\xreplstring` macro is defined by Lua code here. + And \ulink[http://petr.olsak.net/optex/optex-tricks.html\#replmacro]{\OpTeX/ trick 0137} + defines \^`\replmacro` which enables more general modifications of macros by regular expressions. \_cod ----------------------------- \_newtoks\_tmptoks \_catcode`!=3 \_catcode`?=3 \_def\_replstring #1#2#3{% \replstring #1{stringA}{stringB} \_long\_def\_replacestringsA##1#2{\_tmptoks{##1}\_replacestringsB}% - \_long\_def\_replacestringsB##1#2{\_ifx!##1\_relax \_else \_tmptoks\_ea{\_the\_tmptoks#3##1}% + \_long\_def\_replacestringsB##1#2{\_ifx!##1\_relax \_else \_toksapp\_tmptoks{#3##1}% \_ea\_replacestringsB\_fi}% \_ea\_replacestringsA #1?#2!#2% \_long\_def\_replacestringsA##1?{\_tmptoks{##1}\_edef#1{\_the\_tmptoks}}% @@ -294,8 +300,9 @@ by optional syntax `\bp[<digits>]{<dimen>}` and `\expr[<digits>]{<expression>}`. Default is \`\_decdigits`. - The usage of prefixed versions \`\_expr` or \`\_bp` is more recommended - because a user can re-define the control sequences `\expr` or `\bp`. + The usage of prefixed versions `\_expr` or `\_bp` is more recommended + for macro programmers because a user can re-define the control sequences + `\expr` or `\bp`. \_cod ----------------------------- \_def\_decdigits{3} % digits after decimal point in \_bp and \_expr outputs. |