Fix Atmel Studio integrated help generation and branding.

pull/1469/head
Dean Camera 12 years ago
parent c1ffcd8681
commit 1d5b268fd9

@ -7,7 +7,7 @@
version="1.0"> version="1.0">
<xsl:output <xsl:output
method="xml" indent="yes" method="xml" indent="no"
doctype-public="-//OASIS//DTD DocBook XML V4.5//EN" doctype-public="-//OASIS//DTD DocBook XML V4.5//EN"
doctype-system="http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"/> doctype-system="http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"/>
@ -40,11 +40,11 @@
</section> </section>
</xsl:if> </xsl:if>
<xsl:if test="count(ancestor::*/sectiondef[memberdef/@kind = 'define' or @kind = 'define']) > 0"> <xsl:if test="count(ancestor::*/sectiondef[memberdef/@kind = 'define']) > 0">
<section> <section>
<title>Macro Definitions</title> <title>Macro Definitions</title>
<xsl:for-each select="ancestor::*/sectiondef[memberdef/@kind = 'define' or @kind = 'define']"> <xsl:for-each select="ancestor::*/sectiondef[memberdef/@kind = 'define']">
<section> <section>
<title> <title>
<xsl:value-of select="header"/> <xsl:value-of select="header"/>
@ -106,7 +106,9 @@
<xsl:apply-templates select="detaileddescription"/> <xsl:apply-templates select="detaileddescription"/>
<xsl:for-each select="sectiondef[@kind = 'public-attrib']"> <xsl:for-each select="sectiondef[@kind = 'public-attrib']">
<informaltable tabstyle="striped"> <table tabstyle="striped">
<title>Members</title>
<tgroup cols="3"> <tgroup cols="3">
<thead> <thead>
<row> <row>
@ -134,7 +136,7 @@
</xsl:for-each> </xsl:for-each>
</tbody> </tbody>
</tgroup> </tgroup>
</informaltable> </table>
<para>&#xa0;</para> <para>&#xa0;</para>
</xsl:for-each> </xsl:for-each>
</section> </section>
@ -151,9 +153,34 @@
</para> </para>
<programlisting language="c"> <programlisting language="c">
<xsl:value-of select="definition"/> <emphasis role="keyword">
<xsl:value-of select="type"/>
</emphasis>
<xsl:text> </xsl:text>
<xsl:value-of select="name"/>
<xsl:text>(</xsl:text>
<xsl:choose>
<xsl:when test="argsstring = '(void)'">
<emphasis role="keyword">void</emphasis>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="param">
<xsl:if test="position() > 1">
<xsl:text>,</xsl:text>
</xsl:if>
<xsl:text>&#10;&#9;&#9;</xsl:text> <xsl:text>&#10;&#9;&#9;</xsl:text>
<xsl:apply-templates select="argsstring"/> <emphasis role="keyword">
<xsl:value-of select="type"/>
</emphasis>
<xsl:text> </xsl:text>
<xsl:value-of select="declname"/>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
<xsl:text>)</xsl:text>
</programlisting> </programlisting>
<xsl:apply-templates select="detaileddescription"/> <xsl:apply-templates select="detaileddescription"/>
@ -168,11 +195,12 @@
<xsl:apply-templates select="detaileddescription"/> <xsl:apply-templates select="detaileddescription"/>
<informaltable tabstyle="striped"> <table tabstyle="striped">
<title>Members</title>
<tgroup cols="2"> <tgroup cols="2">
<thead> <thead>
<row> <row>
<entry>Enum Value</entry> <entry>Enum value</entry>
<entry>Description</entry> <entry>Description</entry>
</row> </row>
</thead> </thead>
@ -191,7 +219,7 @@
</xsl:for-each> </xsl:for-each>
</tbody> </tbody>
</tgroup> </tgroup>
</informaltable> </table>
<para>&#xa0;</para> <para>&#xa0;</para>
</section> </section>
@ -202,6 +230,7 @@
<title> Macro <xsl:value-of select="name"/> </title> <title> Macro <xsl:value-of select="name"/> </title>
<programlisting language="c"> <programlisting language="c">
<emphasis role="preprocessor">
<xsl:text>#define </xsl:text> <xsl:text>#define </xsl:text>
<xsl:value-of select="name"/> <xsl:value-of select="name"/>
<xsl:if test="count(param) > 0"> <xsl:if test="count(param) > 0">
@ -222,6 +251,8 @@
</xsl:if> </xsl:if>
<xsl:value-of select="initializer"/> <xsl:value-of select="initializer"/>
</emphasis>
<xsl:text> </xsl:text>
</programlisting> </programlisting>
<xsl:apply-templates select="detaileddescription"/> <xsl:apply-templates select="detaileddescription"/>
@ -232,26 +263,37 @@
<xsl:template match="memberdef[@kind = 'variable' or @kind = 'typedef']"> <xsl:template match="memberdef[@kind = 'variable' or @kind = 'typedef']">
<section id="{@id}" xreflabel="{name}"> <section id="{@id}" xreflabel="{name}">
<title>
<!-- Doxygen gets confused and thinks function pointer type definitions <!-- Doxygen gets confused and thinks function pointer type definitions
are variables, so we need to map them to this common section and are variables, so we need to map them to this common section and
check the definition to see which of the two it is. --> check the definition to see which of the two it is. -->
<xsl:choose> <xsl:choose>
<xsl:when test="contains(definition,'typedef')"> <xsl:when test="contains(definition,'typedef')">
<xsl:text>Type </xsl:text> <title> Type <xsl:value-of select="name"/></title>
<programlisting language="c">
<emphasis role="keyword">
<xsl:text>typedef </xsl:text>
<xsl:value-of select="type"/>
</emphasis>
<xsl:text> </xsl:text>
<xsl:value-of select="name"/>
<xsl:text> </xsl:text>
<xsl:value-of select="argsstring"/>
</programlisting>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:text>Variable </xsl:text> <title> Variable <xsl:value-of select="name"/></title>
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="name"/>
</title>
<programlisting language="c"> <programlisting language="c">
<xsl:value-of select="definition"/> <emphasis role="keyword">
<xsl:value-of select="type"/>
</emphasis>
<xsl:text> </xsl:text>
<xsl:value-of select="name"/>
</programlisting> </programlisting>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates select="detaileddescription"/> <xsl:apply-templates select="detaileddescription"/>
@ -269,7 +311,7 @@
<xsl:template match="simplesect" mode="struct"> <xsl:template match="simplesect" mode="struct">
<footnote> <footnote>
<xsl:apply-templates select="para"/> <xsl:apply-templates/>
</footnote> </footnote>
</xsl:template> </xsl:template>
@ -324,8 +366,8 @@
<title>To Do</title> <title>To Do</title>
</xsl:when> </xsl:when>
<xsl:when test="$note.prefix = 'TIP:'"> <xsl:when test="$note.prefix = 'TIPS:'">
<xsl:attribute name="role">tip</xsl:attribute> <xsl:attribute name="role">tips</xsl:attribute>
<title>Tip</title> <title>Tip</title>
</xsl:when> </xsl:when>
@ -370,7 +412,7 @@
<xsl:value-of select="$note.content"/> <xsl:value-of select="$note.content"/>
</xsl:when> </xsl:when>
<xsl:when test="$note.prefix = 'TIP:'"> <xsl:when test="$note.prefix = 'TIPS:'">
<xsl:value-of select="$note.content"/> <xsl:value-of select="$note.content"/>
</xsl:when> </xsl:when>
@ -402,8 +444,8 @@
<tgroup cols="3"> <tgroup cols="3">
<thead> <thead>
<row> <row>
<entry>Data Direction</entry> <entry>Data direction</entry>
<entry>Parameter Name</entry> <entry>Parameter name</entry>
<entry>Description</entry> <entry>Description</entry>
</row> </row>
</thead> </thead>
@ -424,7 +466,7 @@
<tgroup cols="2"> <tgroup cols="2">
<thead> <thead>
<row> <row>
<entry>Return Value</entry> <entry>Return value</entry>
<entry>Description</entry> <entry>Description</entry>
</row> </row>
</thead> </thead>
@ -549,6 +591,18 @@
<xsl:text>&#8482;</xsl:text> <xsl:text>&#8482;</xsl:text>
</xsl:template> </xsl:template>
<xsl:template match="superscript">
<superscript>
<xsl:value-of select="."/>
</superscript>
</xsl:template>
<xsl:template match="subscript">
<subscript>
<xsl:value-of select="."/>
</subscript>
</xsl:template>
<xsl:template match="ref"> <xsl:template match="ref">
<xsl:choose> <xsl:choose>
<!-- Don't show links inside program listings --> <!-- Don't show links inside program listings -->
@ -558,11 +612,20 @@
<!-- Show links outside program listings --> <!-- Show links outside program listings -->
<xsl:otherwise> <xsl:otherwise>
<link linkend="{@refid}" xrefstyle="nopage"> <xsl:choose>
<!-- Use hard links for anchors to make the reference
look correct for figure and table references -->
<xsl:when test="//anchor[@id = current()/@refid]">
<xref linkend="{@refid}" xrefstyle="select: label title"/>
</xsl:when>
<xsl:otherwise>
<link linkend="{@refid}">
<xsl:value-of select="text()"/> <xsl:value-of select="text()"/>
</link> </link>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template> </xsl:template>
<xsl:template match="formula"> <xsl:template match="formula">
@ -578,7 +641,9 @@
<xsl:template match="table"> <xsl:template match="table">
<xsl:choose> <xsl:choose>
<xsl:when test="caption"> <xsl:when test="caption">
<table tabstyle="striped"> <!-- Fetch the ID using a preceding doxygen \anchor to be
able to reference tables -->
<table tabstyle="striped" id="{preceding-sibling::anchor[last()]/@id}">
<title> <title>
<xsl:value-of select="caption"/> <xsl:value-of select="caption"/>
</title> </title>
@ -640,6 +705,11 @@
<xsl:template match="programlisting"> <xsl:template match="programlisting">
<programlisting language="c"> <programlisting language="c">
<!-- Only allow really long code segments to split across pages -->
<xsl:if test="count(codeline) > 30">
<xsl:processing-instruction name="dbfo">keep-together="auto"</xsl:processing-instruction>
</xsl:if>
<xsl:for-each select="codeline[position() > 1 or highlight]"> <xsl:for-each select="codeline[position() > 1 or highlight]">
<xsl:apply-templates select="."/> <xsl:apply-templates select="."/>
<xsl:text>&#10;</xsl:text> <xsl:text>&#10;</xsl:text>
@ -648,10 +718,7 @@
</xsl:template> </xsl:template>
<xsl:template match="highlight"> <xsl:template match="highlight">
<emphasis> <emphasis role="{@class}">
<xsl:attribute name="role">
<xsl:value-of select="@class"/>
</xsl:attribute>
<xsl:apply-templates/> <xsl:apply-templates/>
</emphasis> </emphasis>
</xsl:template> </xsl:template>
@ -660,7 +727,7 @@
<xsl:choose> <xsl:choose>
<!-- Need to check if this is the first part of the line - if so we may <!-- Need to check if this is the first part of the line - if so we may
need to strip off any leading <sp/> element indentation --> need to strip off any leading <sp/> element indentation -->
<xsl:when test="ancestor::highlight = ancestor::codeline/highlight[1]"> <xsl:when test="count(../preceding-sibling::highlight) = 0">
<!-- Doxygen retains a level of indentation in some code fragments - obtain <!-- Doxygen retains a level of indentation in some code fragments - obtain
the base indentation level by counting the leading <sp/> elements of the the base indentation level by counting the leading <sp/> elements of the
first code line, and use that to remove the indentation on the rest --> first code line, and use that to remove the indentation on the rest -->
@ -678,7 +745,9 @@
</xsl:template> </xsl:template>
<xsl:template match="image"> <xsl:template match="image">
<figure> <!-- Fetch the ID using a preceding doxygen \anchor to be
able to reference figures -->
<figure id="{preceding-sibling::anchor[last()]/@id}">
<title> <title>
<xsl:value-of select="."/> <xsl:value-of select="."/>
</title> </title>
@ -686,7 +755,10 @@
<mediaobject> <mediaobject>
<imageobject> <imageobject>
<imagedata scalefit="1" width="{@width}"> <imagedata scalefit="1" width="{@width}">
<xsl:attribute name="fileref">html/<xsl:value-of select="@name"/></xsl:attribute> <xsl:attribute name="fileref">
<xsl:text>html/</xsl:text>
<xsl:value-of select="@name"/>
</xsl:attribute>
</imagedata> </imagedata>
</imageobject> </imageobject>
</mediaobject> </mediaobject>
@ -694,20 +766,44 @@
</xsl:template> </xsl:template>
<xsl:template match="anchor"> <xsl:template match="anchor">
<anchor id="{@id}"/> <!-- Remove anchors from the PDF output, as these are used for referencing
images and tables. -->
</xsl:template> </xsl:template>
<xsl:template match="dot"> <xsl:template match="dot">
<!-- Fetch the ID using a preceding doxygen \anchor to be able to reference
figures -->
<xsl:variable name="dot.id" select="preceding-sibling::anchor[last()]/@id" />
<xsl:choose>
<!-- If the DOT graph has an ID, use that for the filename -->
<xsl:when test="$dot.id">
<xsl:call-template name="write.dot.content">
<xsl:with-param name="dot.filename" select="$dot.id"/>
<xsl:with-param name="dot.id" select="$dot.id"/>
</xsl:call-template>
</xsl:when>
<!-- Otherwise use the auto-generated ID for it in the document -->
<xsl:otherwise>
<xsl:call-template name="write.dot.content"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="write.dot.content">
<xsl:param name="dot.filename" select="generate-id(.)"/>
<xsl:param name="dot.id" select="''"/>
<!-- We get raw DOT syntax rather than a rendered image: write the DOT code <!-- We get raw DOT syntax rather than a rendered image: write the DOT code
to a new unique file, and make a image reference to a SVG version of to a external file, and make a image reference to a SVG version of that
that file. The build system should then call dot to render all generated file. The build system should then call dot to render all generated
DOT files into their SVG equivalents before rendering the PDF. --> DOT files into their SVG equivalents before rendering the PDF. -->
<xsl:variable name="filename" select="generate-id(.)" /> <exsl:document href="{$dot.filename}.dot" method="text">
<exsl:document href="{$filename}.dot" method="text">
<xsl:value-of select="." /> <xsl:value-of select="." />
</exsl:document> </exsl:document>
<figure> <figure id="{$dot.id}">
<title> <title>
<xsl:value-of select="ancestor::*/title"/> <xsl:value-of select="ancestor::*/title"/>
</title> </title>
@ -715,7 +811,7 @@
<imageobject> <imageobject>
<imagedata format="SVG"> <imagedata format="SVG">
<xsl:attribute name="fileref"> <xsl:attribute name="fileref">
<xsl:value-of select="$filename" /> <xsl:value-of select="$dot.filename" />
<xsl:text>.svg</xsl:text> <xsl:text>.svg</xsl:text>
</xsl:attribute> </xsl:attribute>
</imagedata> </imagedata>
@ -724,14 +820,4 @@
</figure> </figure>
</xsl:template> </xsl:template>
<xsl:template match="argsstring" name="split.functions.args">
<xsl:param name="text" select="."/>
<xsl:value-of select="substring-before(concat($text,','),',')"/>
<xsl:if test="contains($text,',')">
<xsl:text>,&#10;&#09;&#9;</xsl:text>
<xsl:call-template name="split.functions.args">
<xsl:with-param name="text" select="substring-after($text,',')"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
</xsl:stylesheet> </xsl:stylesheet>

@ -44,7 +44,8 @@ VSIX_ASSETS := $(LUFA_ROOT)/DoxygenPages/Images/LUFA_thumb.png \
MSHELP_GEN_PARAMS := --stringparam generate.toc "book toc" \ MSHELP_GEN_PARAMS := --stringparam generate.toc "book toc" \
--stringparam chunk.quietly "1" \ --stringparam chunk.quietly "1" \
--stringparam chunk.section.depth "3" \ --stringparam chunk.section.depth "3" \
--stringparam chunk.first.sections "1" --stringparam chunk.first.sections "1" \
--stringparam chapter.autolabel "0"
all: generate_xml check_filenames generate_vsix all: generate_xml check_filenames generate_vsix

Loading…
Cancel
Save