diff options
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -3564,10 +3564,10 @@ This directive's syntax is illustrated in this example: The deffilter symbol must be followed by the name of the filter to be defined, -followed by tuples of forms which evaluate to strings. Each tuple specifies one -or more texts which are mapped to a replacement text. For instance, the -following specifies a telephone keypad mapping from upper case letters to -digits. Quasiliterals may be used. +followed by forms which evaluate to lists of strings. Each list must +be at least two elements long and specifies one or more texts which are mapped +to a replacement text. For instance, the following specifies a telephone keypad +mapping from upper case letters to digits. @(deffilter alpha_to_phone ("E" "0") ("J" "N" "Q" "1") @@ -3582,6 +3582,13 @@ digits. Quasiliterals may be used. @(deffilter foo (`@a` `@b`) ("c" `->@d`)) + @(bind x ("from" "to")) + @(bind y ("---" "+++")) + @(deffilter sub x y) + +The last deffilter above equivalent to +@(deffilter sub ("from" "to") ("---" "+++")). + Filtering works using a longest match algorithm. The input is scanned from left to right, and the longest piece of text is identified at every character position which matches a string on the left hand side, and that text is |