Re: How to get syntax coloring in Quickboook Doxygen C++ Reference sections
Daniel James <[email protected]> Mon, 28 Oct 2013 20:17:48 +0000
| Newsgroups | gmane.comp.lib.boost.documentation |
|---|---|
| Message-ID | <CAHOE3yft6_55nExWSWp=CepeQBFnsAPp_M1yQ6jNXB5eMW3HGg@mail.gmail.com> |
On 28 October 2013 18:43, Paul A. Bristow <[email protected]> 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.