From: Pablo Rodriguez <oinos@gmx.es>
To: ntg-context@ntg.nl
Subject: Re: removing word in filtered XML
Date: Thu, 20 Aug 2020 12:38:09 +0200 [thread overview]
Message-ID: <5b988f82-aede-80b8-2c4a-4500c8f96abd@gmx.es> (raw)
In-Reply-To: <b78dd3d7-3850-1716-d348-479b95992603@xs4all.nl>
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).
Many thanks for your help,
Pablo
--
http://www.ousia.tk
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
next prev parent reply other threads:[~2020-08-20 10:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-19 16:10 Pablo Rodriguez
2020-08-20 9:08 ` Taco Hoekwater
2020-08-20 10:23 ` Pablo Rodriguez
2020-08-20 9:27 ` Hans Hagen
2020-08-20 10:38 ` Pablo Rodriguez [this message]
2020-08-20 11:10 ` Hans Hagen
2020-08-20 14:20 ` Pablo Rodriguez
2020-08-21 12:59 ` Hans Hagen
2020-08-21 13:34 ` Pablo Rodriguez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5b988f82-aede-80b8-2c4a-4500c8f96abd@gmx.es \
--to=oinos@gmx.es \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).