On 8/20/20 11:27 AM, Hans Hagen wrote:
On 8/19/2020 6:10 PM, Pablo Rodriguez wrote:
[...] Is there any way to remove " of " and " of the " in the filtered content (xml:special)?
Sorry, Lua code is crap for sure. [...] \startxmlsetups xml:initialize \xmlsetsetup{#1}{html}{xml:gen} \xmlsetsetup{#1}{span[@class='special']}{xml:span:special} \stopxmlsetups [...] \startxmlsetups xml:span:special (\cldcontext{(string.gsub([[\xmlraw{#1}{.}]]," of the ", ""))}) \stopxmlsetups
Many thanks for your reply, Hans.
I now see that \xmlraw is the way to go.
I have two questions in word replacement and Lua (maybe there is some lpeg magic that could be used).
This time, I have to remove two words, such as in:
string.gsub([[\xmlraw{#1}{.}]]," del ", " "):gsub(" de la ", " ")}
But they could be more (and replacements might be added to that list).
Is there a more elegant way than appending :gsub()?
Is there also a proper way for word scanning?
A "word" can be "Word ", " word " " word." " word?" (and so on). I would like to avoid having to code all combinations (of course, if this were already available).
On 8/20/2020 12:38 PM, Pablo Rodriguez wrote: old stuff present for a long time ... probaly documented somewhere ... if not than you have to wikify it ... \starttext \replaceword[whatever][this][that] \replaceword[whatever][that][this] \startlines it is this or that {\setreplacements[whatever]it is this or that} it is this or that \stoplines \stoptext ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------