ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* "Semi-verbatim" - preserve whitespace - don't escape characters
@ 2007-12-07 17:26 dexterclarke
  2007-12-08  9:24 ` Wolfgang Schuster
  0 siblings, 1 reply; 6+ messages in thread
From: dexterclarke @ 2007-12-07 17:26 UTC (permalink / raw)
  To: ntg-context

Hi.

I'm working on a document processor that has multiple backends
for different output formats (XHTML, nroff, plain text, ConTeXt).

The processor uses s-expression syntax with commands such as:

  (para "this is a paragraph")

The various backends then convert this statement in their own
way (using <p></p> tags in XHTML, for example).

There is one command that allows rendering of external files
based on whatever backend is selected:

  (render "file")

The XHTML backend includes "file", escaping all 'illegal' characters
such as <, >, & etc. The ConTeXt backend reads the file and also
escapes characters, placing their TeX equivalent in the output -
$\}$, $\backslash$ etc. Both backends place the contents of "file"
directly in the output, they don't, for example, use the <object>
tags in XHTML, or any ConTeXt file inclusion directives. This is
desirable for many reasons that are out of scope for this post...

The problem I am having is that one may do this:

  (para-verbatim (render "file"))

The para-verbatim tag is meant to preserve whitespace in the output.

For example, this becomes:

  <pre>contents of file</pre>

in the XHTML output. Unfortunately, I've hit a wall when it comes
to the ConTeXt equivalent: The ConTeXt backend reads
in "file" and prints it to the output, escaping all reserved TeX
characters, as mentioned earlier, but unfortunately there doesn't
seem to be the equivalent of:

  \preservewhitespace
  contents of file
  \stoppreservingwhitespace

"\starttyping" is too heavy handed in that it also escapes characters
rather than just preserving whitespace (they've already been escaped
by my document processor, as mentioned earlier). What I need is a 
directive that says "preserve whitespace" but does not escape reserved 
TeX characters.

Does any such thing exist in ConTeXt? Unfortunately, I'm inexperienced
with TeX so I don't know how feasible this is.

--
dc
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

end of thread, other threads:[~2007-12-08 22:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-07 17:26 "Semi-verbatim" - preserve whitespace - don't escape characters dexterclarke
2007-12-08  9:24 ` Wolfgang Schuster
2007-12-08 14:44   ` Aditya Mahajan
2007-12-08 14:51     ` Wolfgang Schuster
2007-12-08 22:30       ` Aditya Mahajan
2007-12-08 22:59         ` Wolfgang Schuster

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