On 15-10-2011 05:29, Aditya Mahajan wrote:
Hi,

In the vim module, I use vim to generate TeX code that looks roughly as

~~~
\SYN[Type]{public} \SYN[Type]{static} \SYN[Type]{void}
main\SYN[javaParen]{(}String args\SYN[javaParen]{)} \{
System.out.println\SYN[javaParen]{(}\SYN[Constant]{"Hello
World"}\SYN[javaParen]{)} ;
\}
~~~

When generating pdf output, I simply set appropriate catcodes so that
the line breaks and leading white spaces are significant. However, when
exporting to xml, leading white space is ignored while line break is
translated to <break/>. How can I export in such a way that leading
white spaces are preserved (and ideally no <break/> is generated, but I
can deal with that using CSS).

brrr .. catcodes ... can't you wrap lines in a macro and tag spaces too? in principle you should be able to use some of of the regular typing wrapping code for that but anything other than catcoded characters will do (also, keep in mind that people might want to pass the generated code around as arguments in which case catcodes can create a mess

\setupbackend[export=yes]

\starttext

\startlines
\zwnj \char32\char32\char32 test \char32 test test
\zwnj \char32\char32 test \char32 test test
\zwnj \char32 test \char32 test test
test \char32 test test
\stoplines

\stoptext



-----------------------------------------------------------------
                                          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
___________________________________________________________________________________

Reply via email to