Re: How to get syntax coloring in Quickboook Doxygen C++ Reference sections

Steven Watanabe <[email protected]> Sun, 27 Oct 2013 11:07:22 -0700
Newsgroups gmane.comp.lib.boost.documentation
Organization Providere Consulting, Inc.
Message-ID <[email protected]>
AMDG

On 10/27/2013 10:54 AM, Paul A. Bristow wrote:
> I'm haven't another déjà vu about this issue ;-)
>  
> But is there something I am doing wrong that I am not seeing syntax coloring from this Doxygen
> comment, even after specifying that it is cpp.
> 

doxygen2boostbook.xsl drops this information.
It would have to be modified.

> (Syntax coloring works fine from Quickbook snippets).
> 
> @b Example:
>  
> \code{.cpp}
> #include <boost/numeric/safe_cast.hpp>
> #include <boost/numeric/safe_integer.hpp>
>  
> void f(){
>     safe_integer<char> i;
>     unsigned char j;
>     i = 1;
>     j = safe_cast<unsigned char>(i);  // ok
>     i = -1;
>     j = safe_cast<unsigned char>(i);  // throws std::out_of_range exception
>     i = 1024;
>     j = safe_cast<unsigned char>(i);  // throws std::out_of_range exception
> }
> \endcode
>  
> This gives syntax colored if you use the doxywizard, but the html generated from Quickbook toolchain
> is just in 'code font' with the html source
>  
> <p><span class="bold"><strong>Example:</strong></span> </p>
> <pre class="programlisting">#include &lt;boost/numeric/safe_cast.hpp&gt;
> #include &lt;boost/numeric/safe_integer.hpp&gt;
>  
> void f(){
>     safe_integer&lt;char&gt; i;
>     unsigned char j;
>     i = 1;
>     j = safe_cast&lt;unsigned char&gt;(i);  // ok
>     i = -1;
>     j = safe_cast&lt;unsigned char&gt;(i);  // throws std::out_of_range exception
>     i = 1024;
>     j = safe_cast&lt;unsigned char&gt;(i);  // throws std::out_of_range exception
> }
> </pre>
>  
> The output shows thus
> 
> Function template safe_cast
> 
> boost::numeric::safe_cast — Converts boost::numeric::Numeric type from type T to type U ensuring
> that the result would not be changed or undefined. Throws an std::out_of_range exception if such a
> conversion is not possible without changing the value. 
> 
> Synopsis
> 
> // In header: <boost/
> <file:///I:\boost-sandbox\safe_numerics\libs\safe_numerics\doc\html\header\boost\safe_numerics\safe_
> cast_hpp.html> safe_numerics/safe_cast.hpp>
>  
>  
> template<typename T, typename U> T safe_cast(const U & u);
> 
> Description
> 
> Example: 
> #include <boost/numeric/safe_cast.hpp>
> #include <boost/numeric/safe_integer.hpp>
>  
> void f(){
>     safe_integer<char> i;
>     unsigned char j;
>     i = 1;
>     j = safe_cast<unsigned char>(i);  // ok
>     i = -1;
>     j = safe_cast<unsigned char>(i);  // throws std::out_of_range exception
>     i = 1024;
>     j = safe_cast<unsigned char>(i);  // throws std::out_of_range exception
>  
> …
>  
> It would be nice to have syntax coloring J
>  
> Thanks for any suggestions.
>  

In Christ,
Steven Watanabe