Vladimir Prus wrote:
Vladimir Prus wrote:
> Hello,
> I'm documenting a library, and would like to include an example in
> tutorial. I already have the example as .cpp file, so the question is: how
> to include that .cpp file into documentation. Is there something like
>
> <include-example href="../examples/multiple_sources.cpp"/>
>
> ? Do I have any alternatives other than copy-paste?

Including XML files is easy using the XSL:T-based document() function. I am not sure on plain-text files (unless this is now supported in XSL:T 2.0/xsltproc).


Ok, I've a couple of other issues. The page that I see at

http://zigzag.cs.msu.su:7813/program_options2/tutorial.html

has a couple of problems:

1. The code, which I've copy-pasted and wrapped in programlisting, is not
highlighted, even though class reference uses highlighting. How hard would it
be to enable highlighting for the programlisting elements?

Do you want me to have a go at this? I have a few ideas that I could try. I am not promising anything, though, because I don't know how performance will be affected.


The problem is that you can't do this using standard regex/text processing techniques. However, it is possible to do. I have some XSL:T code that I could modify that converts an XML dsocument into a list of words, doing normalization on them (punctuation removal and conversion to lower case).

There are a few problems affecting what you can do:
1. XSL:T is a recursive/tree-based programming language, so token processing is more complicated
2. The resulting engine will be performance-intensive in both space and time complexity


There are, as I see it, two possibilities:
1. Preprocess the cpp files into XML highlighted markup. This would require a C++ program or (perl?) script to do the conversion. These can then be added into the jam file.
2. XSL:T based processing. For this approach, I would add a new element, e.g. <highlight>:


inlined source code (e.g. examples, copy/paste):
  <highlight lang = "c++">...</highlight>

from a file:
  <highlight lang = "c++" src = "..."/>

I have the lang attribute here to allow for the possibility of supporting additional languages, e.g. xml, Haskell, perl, etc.

Thoughts? Ideas? Comments?

2. Right at the bottom of the page, the are results of rendering the <screen>
element. The problem is that it's not as nice as the programlisting. Is there
anything which can be done. Like using the same class as for programlisting?

This is not a problem. Just look for '.programlisting' in the CSS file and add ', .screen' - that simple :).


- Volodya

_________________________________________________________________
Find a cheaper internet access deal - choose one to suit you. http://www.msn.co.uk/internetaccess




-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Boost-docs mailing list
[EMAIL PROTECTED]
Unsubscribe and other administrative requests: 
https://lists.sourceforge.net/lists/listinfo/boost-docs

Reply via email to