ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* removing word in filtered XML
@ 2020-08-19 16:10 Pablo Rodriguez
  2020-08-20  9:08 ` Taco Hoekwater
  2020-08-20  9:27 ` Hans Hagen
  0 siblings, 2 replies; 9+ messages in thread
From: Pablo Rodriguez @ 2020-08-19 16:10 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Dear list,

I have the following sample:

  \startbuffer[demo]
  <html>
    <body>
      <div id="First">
        <p>This is
          <span class="special">One of the best</span> a paragraph.</p>
        <p>This is another paragraph.</p>
        <p>This is another
          <span class="special">Two of the best</span> paragraph.</p>
        <p>This is another
          <span class="special">Three</span> paragraph.</p>
        <p>This is another
          <span class="special">Four of five</span> paragraph.</p>
      </div>
    </body>
  </html>
  \stopbuffer

  \startxmlsetups xml:initialize
    \xmlsetsetup{#1}{html}{xml:gen}
  \stopxmlsetups

  \xmlregistersetup{xml:initialize}

  \startxmlsetups xml:gen
     \xmlfilter{#1}{/**/div/command(xml:special)}
  \stopxmlsetups

  \startxmlsetups xml:special
    %~ \startitem
    \cldcontext{string.gsub(lxml.flush([[#1]]),
       " of the ", "")}\stopitem
  \stopxmlsetups

  \starttext
    \xmlprocessbuffer{main}{demo}{}
  \stoptext

Is there any way to remove " of " and " of the " in the filtered content
(xml:special)?

Sorry, Lua code is crap for sure.

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-08-21 13:34 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-19 16:10 removing word in filtered XML 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
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

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).