This is the mail archive of the docbook@lists.oasis-open.org mailing list for the DocBook project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Element for literal "passthrough"?


Is there an appropriate element already existing in DocBook to indicate a character which should be treated as a literal character by downstream processors?

In essence, I need to indicate that a particular character in a programlisting should not be replaced by a character reference, even though it would normally be so handled.  The prototypical example is "<"; if I use &lt; it is normally replaced in output by a different character entity reference of the form &#nn; (where nn is a number indicating which character).

I know how to prevent this behavior in the downstream processor (thanks to some help from the DSSSList several months ago) via markup of the general form  <literalchar data='&#nn;'>. An example of use would be
<programlisting>
while x <literalchar data='&#60;'> 5 do
  fo the bar
end
</programlisting>

which will show up in the transformed output as
while x < 5 do
  fo the bar
end

rather than
while x &#60; 5 do
  fo the bar
end

which is what I get from the standard definition of &lt;

By extending the content model of programlisting to include literalchar, I can use that solution directly, and it works. Since I'm already building an extension to DocBook, this is an adequate solution.

However, I would prefer not to unnecessarily add to the DTD, to simplify the process of adapting existing tools.  I did not find an existing element that seemed appropriate, though, although I suppose I could abuse literal itself.

The project is, BTW, a literate programming extension to DocBook, and this is part of getting the "tangle" (code output) branch to work.  So far, I have been pleasantly surprised to discover that I can make this work with very minor changes to the standard DTD; other than however I deal with this literal character issue, I have added three attributes to  programlisting, and reused xreflabel.

Mark B. Wroth
<mark@astrid.upland.ca.us>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]