Re: [NTG-context] processing style inside verbatim in XML

2011-10-24 Thread Hans Hagen

On 21-10-2011 22:18, Mojca Miklavec wrote:

Hello,

Is there any simple way to typeset the following example properly in ConTeXt?

I have an example of text that has to obey lines and spaces, but I
would like to apply some color to make it more readable. The
attachment contains an example of HTML which displays fine in my
browser, and it should look similar with ConTeXt.

I have problems with literal typesetting ofspan class=...  (that
should have applied style instead), but maybe I only have wrong
settings in my parser.

When I use \xmlsetfunction{main}{pre}{lxml.displayverbatim}, then I
cannot color the numbers. When I use, according to Wolfgang's
suggestion,

\startxmlsetups pre
\setuplines[style=mono,space=yes]
\startlines
\xmlflush{#1}
\stoplines
\stopxmlsetups

then all the spaces are eaten up by XML parser (or somewhere else), so
that I don't get the desired result. Any ideas about this?

I'm also sending a self-contained example with \setuplines which
doesn't really work in the desired way.


The next beta will provide two extra flushers. The following patch to 
your example seems to work ok then.


\startxmlsetups all:html
\xmlsetsetup{main}{head|h1|pre|span}{*}
\stopxmlsetups

\xmlmapval{span}{n}{\bf\red}

\startxmlsetups span
\start
\xmlval{span}{\xmlatt{#1}{class}}{}
\xmlflush{#1}
\stop
\stopxmlsetups

\startxmlsetups pre
\start \tttf
   %\xmlflush{#1}
   %\xmlflushlinewise{#1}
\xmlflushspacewise{#1}
\stop
\stopxmlsetups

Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-
___
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] processing style inside verbatim in XML

2011-10-21 Thread Mojca Miklavec
Hello,

Is there any simple way to typeset the following example properly in ConTeXt?

I have an example of text that has to obey lines and spaces, but I
would like to apply some color to make it more readable. The
attachment contains an example of HTML which displays fine in my
browser, and it should look similar with ConTeXt.

I have problems with literal typesetting of span class=... (that
should have applied style instead), but maybe I only have wrong
settings in my parser.

When I use \xmlsetfunction{main}{pre}{lxml.displayverbatim}, then I
cannot color the numbers. When I use, according to Wolfgang's
suggestion,

\startxmlsetups pre
\setuplines[style=mono,space=yes]
\startlines
\xmlflush{#1}
\stoplines
\stopxmlsetups

then all the spaces are eaten up by XML parser (or somewhere else), so
that I don't get the desired result. Any ideas about this?

I'm also sending a self-contained example with \setuplines which
doesn't really work in the desired way.

Thank you very much,
Mojca








. h y p h e n a t i o n .
-
   1n a
   1t i o
 2i o
h e2n
h e n5a t
h e n a4
  h y3p h
n2a t
o2n
-
. h y3p h e2n5a4t2i o2n.





hyp.tex
Description: TeX document
___
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___