Re: [Boost-docs] How to get syntax coloring in Quickboook Doxygen C++ Reference sections

Subject: Re: [Boost-docs] How to get syntax coloring in Quickboook Doxygen C++ Reference sections
From: Daniel James (daniel_at_[hidden])
Date: 2013-10-28 20:17:48


On 28 October 2013 18:43, Paul A. Bristow <pbristow_at_[hidden]> wrote:
>
> I put it with a function. I've checked that it works OK as a class example as Daniel reported.
>
> I've glanced at doxygen2boostbook.xsl but how to make it work for functions as well as classes
> didn't jump out at me ;-)

Here's what happens. Doxygen syntax highlights the code.
Doxygen2boostbook discards that syntax highlighting, and puts the code
in a <programlisting> inside a <description> tag.

Then in the boostbook to docbook stage, a class description tag is
processed in type.xsl with:

    <xsl:apply-templates select="description"/>

Which apply templates to description. And description is matched by
this template in docbook.xsl:

  <xsl:template match="description">
    <xsl:apply-templates mode="annotation"/>
  </xsl:template>

That 'mode="annotation"' is what triggers the syntax highlighting.

But for functions, the description tag is processed with:

    <xsl:apply-templates select="description/*"/>

Which apply templates to description's children (that's what the "/*"
does), but not description itself. So it never matches the description
template in docbook.xsl. So I've checked in a change so that it does
the same as class.

But this seems to have some side effects, in descriptions function
links are no longer being marked up as computeroutput, presumably
because annotation mode means it's already considered to be computer
output. So there might be a better solution, such as retaining the
doxygen highlighting, or making boostbook smarter about highlighting
programlisting, or maybe another mode which causing programlisting to
be highlighted.


This archive was generated by hypermail 2.1.7 : 2017-11-11 08:50:41 UTC