sammdot / rtfcre

Python library for Rich Text Format with Court Reporting Extensions (RTF/CRE) dictionaries
13 stars 0 forks source link

Support lookahead translations #8

Open sammdot opened 3 years ago

sammdot commented 3 years ago

Regular expression lookahead translations are now supported in Plover 4.0.0-dev8, allowing translations to change depending on the following text. Add a new control word \cxplvrlap (LookAhead Pattern) to specify the lookahead pattern, and then \cxplvrlam (LookAhead Match) for the text that will be used as the translation when the lookahead matches.

Plover syntax:

{=(?i)t/true/false}
{:if_next_matches:(?i)t/true/false}

Proposed RTF syntax:

false{\*\cxplvrlap (?i)t}{\*\cxplvrlam true}

This would allow steno engines that do not support lookaheads to automatically default to the false (i.e. lookahead does not match) translation.