Add missing indexterm entries to the Atmel Studio help transform.
authorDean Camera <dean@fourwalledcubicle.com>
Sun, 21 Apr 2013 16:05:11 +0000 (16:05 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Sun, 21 Apr 2013 16:05:11 +0000 (16:05 +0000)
LUFA/StudioIntegration/HV1/lufa_docbook_transform.xsl
LUFA/StudioIntegration/makefile

index 53dd82f..9374b9b 100644 (file)
@@ -3,7 +3,7 @@
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
        <xsl:import href="transform_base.xsl"/>
 
-       <xsl:output method="xml" indent="yes"/>
+       <xsl:output method="xml" indent="no"/>
 
        <xsl:param name="keyword.namespace" select="'Atmel.Language.C'"/>
 
                </xsl:choose>
        </xsl:template>
 
+       <xsl:template name="generate.index.id">
+               <xsl:param name="name"/>
+               <xsl:variable name="book.title">
+                       <xsl:call-template name="generate.book.title"/>
+               </xsl:variable>
+               <xsl:variable name="book.id">
+                       <xsl:call-template name="generate.book.id">
+                               <xsl:with-param name="book.title" select="$book.title"/>
+                       </xsl:call-template>
+               </xsl:variable>
+
+               <indexterm id="{$keyword.namespace}.{$name}">
+                       <primary>
+                               <xsl:value-of select="$book.title"/>
+                       </primary>
+                       <secondary>
+                               <xsl:value-of select="$name"/>
+                       </secondary>
+               </indexterm>
+       </xsl:template>
+
        <xsl:template match="doxygen">
                <xsl:variable name="book.title">
                        <xsl:call-template name="generate.book.title"/>
 
        <xsl:template name="generate.top.level.page">
                <xsl:param name="top.level.page"/>
-
                <chapter id="{$top.level.page/@id}">
                        <title>
                                <xsl:value-of select="$top.level.page/title"/>
                        </title>
                        <xsl:apply-templates select="$top.level.page/detaileddescription"/>
-
                        <xsl:for-each select="$top.level.page/innerpage">
                                <xsl:apply-templates select="ancestor::*/compounddef[@kind = 'page' and @id = current()/@refid]"/>
                        </xsl:for-each>
                                <xsl:value-of select="title"/>
                        </title>
                        <xsl:apply-templates select="detaileddescription"/>
-
                        <xsl:for-each select="innerpage">
                                <xsl:apply-templates select="ancestor::*/compounddef[@kind = 'page' and @id = current()/@refid]"/>
                        </xsl:for-each>
                                        <xsl:value-of select="$name"/>
                                </primary>
                        </indexterm>
-
                        <xsl:apply-templates/>
                        <xsl:for-each select="innerclass">
                                <xsl:apply-templates select="ancestor::*/compounddef[@id = current()/@refid]"/>
 
        <xsl:template match="compounddef[@kind = 'struct' or @kind = 'union']">
                <xsl:variable name="name" select="compoundname"/>
-               <xsl:variable name="book.title">
-                       <xsl:call-template name="generate.book.title"/>
-               </xsl:variable>
-               <xsl:variable name="book.id">
-                       <xsl:call-template name="generate.book.id">
-                               <xsl:with-param name="book.title" select="$book.title"/>
-                       </xsl:call-template>
-               </xsl:variable>
 
                <section id="{@id}" xreflabel="{$name}">
                        <title>
                                <xsl:value-of select="$name"/>
                        </title>
 
-                       <indexterm id="{$keyword.namespace}.{$name}">
-                               <primary>
-                                       <xsl:value-of select="$book.title"/>
-                               </primary>
-                               <secondary>
-                                       <xsl:value-of select="$name"/>
-                               </secondary>
-                       </indexterm>
+                       <xsl:call-template name="generate.index.id">
+                               <xsl:with-param name="name" select="$name"/>
+                       </xsl:call-template>
 
                        <xsl:apply-templates select="detaileddescription"/>
+
                        <xsl:for-each select="sectiondef[@kind='public-attrib']">
                                <table abstyle="striped">
                                        <title>
                </section>
        </xsl:template>
 
+       <xsl:template match="memberdef[@kind = 'function']">
+               <xsl:variable name="name" select="name"/>
+
+               <section id="{@id}" xreflabel="{name}">
+                       <title>
+                               <xsl:text>Function </xsl:text>
+                               <xsl:value-of select="name"/>
+                               <xsl:text>()</xsl:text>
+                       </title>
+
+                       <xsl:call-template name="generate.index.id">
+                               <xsl:with-param name="name" select="$name"/>
+                       </xsl:call-template>
+
+                       <para>
+                               <emphasis role="italic">
+                                       <xsl:value-of select="briefdescription"/>
+                               </emphasis>
+                       </para>
+
+                       <programlisting language="c">
+                               <xsl:value-of select="definition"/>
+                               <xsl:text> </xsl:text>
+                               <xsl:apply-templates select="argsstring"/>
+                       </programlisting>
+
+                       <xsl:apply-templates select="detaileddescription"/>
+               </section>
+       </xsl:template>
+
+       <xsl:template match="memberdef[@kind = 'enum']">
+               <xsl:variable name="name" select="name"/>
+
+               <section id="{@id}" xreflabel="{name}">
+                       <title>
+                               <xsl:text>Enum </xsl:text>
+                               <xsl:value-of select="name"/>
+                       </title>
+
+                       <xsl:call-template name="generate.index.id">
+                               <xsl:with-param name="name" select="$name"/>
+                       </xsl:call-template>
+
+                       <xsl:apply-templates select="detaileddescription"/>
+
+                       <informaltable tabstyle="striped">
+                               <tgroup cols="2">
+                                       <thead>
+                                               <row>
+                                                       <entry>Enum Value</entry>
+                                                       <entry>Description</entry>
+                                               </row>
+                                       </thead>
+                                       <tbody>
+                                               <xsl:for-each select="enumvalue">
+                                                       <row>
+                                                               <entry>
+                                                                       <para id="{@id}" xreflabel="{name}">
+                                                                               <xsl:value-of select="name"/>
+                                                                       </para>
+                                                               </entry>
+                                                               <entry>
+                                                                       <xsl:apply-templates select="detaileddescription"/>
+                                                               </entry>
+                                                       </row>
+                                               </xsl:for-each>
+                                       </tbody>
+                               </tgroup>
+                       </informaltable>
+               </section>
+       </xsl:template>
+
+       <xsl:template match="memberdef[@kind = 'define']">
+               <xsl:variable name="name" select="name"/>
+
+               <section id="{@id}" xreflabel="{name}">
+                       <title>
+                               <xsl:text>Macro </xsl:text>
+                               <xsl:value-of select="name"/>
+                       </title>
+
+                       <xsl:call-template name="generate.index.id">
+                               <xsl:with-param name="name" select="$name"/>
+                       </xsl:call-template>
+
+                       <programlisting language="c">
+                               <xsl:text>#define </xsl:text>
+                               <xsl:value-of select="name"/>
+                               <xsl:if test="count(param) &gt; 0">
+                                       <xsl:text>(</xsl:text>
+                                       <xsl:for-each select="param/defname">
+                                               <xsl:if test="position() &gt; 1">
+                                                       <xsl:text>,</xsl:text>
+                                               </xsl:if>
+                                               <xsl:value-of select="."/>
+                                       </xsl:for-each>
+                                       <xsl:text>)</xsl:text>
+                               </xsl:if>
+
+                               <xsl:text> </xsl:text>
+
+                               <!-- Split long macro definitions across multiple lines -->
+                               <xsl:if test="(string-length(initializer) &gt; 50) or (count(param) &gt; 0)">
+                                       <xsl:text>\</xsl:text>
+                               </xsl:if>
+
+                               <xsl:value-of select="initializer"/>
+                       </programlisting>
+
+                       <xsl:apply-templates select="detaileddescription"/>
+               </section>
+       </xsl:template>
+
+       <xsl:template match="memberdef[@kind = 'variable' or @kind = 'typedef']">
+               <xsl:variable name="name" select="name"/>
+
+               <section id="{@id}" xreflabel="{name}">
+                       <title>
+                               <!-- Doxygen gets confused and thinks function pointer type definitions
+               are variables, so we need to map them to this common section and
+               check the definition to see which of the two it is. -->
+                               <xsl:choose>
+                                       <xsl:when test="contains(definition,'typedef')">
+                                               <xsl:text>Type </xsl:text>
+                                       </xsl:when>
+                                       <xsl:otherwise>
+                                               <xsl:text>Variable </xsl:text>
+                                       </xsl:otherwise>
+                               </xsl:choose>
+
+                               <xsl:value-of select="name"/>
+                       </title>
+
+                       <xsl:call-template name="generate.index.id">
+                               <xsl:with-param name="name" select="$name"/>
+                       </xsl:call-template>
+
+                       <programlisting language="c">
+                               <xsl:value-of select="definition"/>
+                       </programlisting>
+
+                       <xsl:apply-templates select="detaileddescription"/>
+               </section>
+       </xsl:template>
+
        <xsl:template match="linebreak">
                <xsl:text>&#10;</xsl:text>
        </xsl:template>
                        <title>
                                <xsl:value-of select="title"/>
                        </title>
-
                        <xsl:apply-templates/>
                </section>
        </xsl:template>
index 975dd04..3227997 100644 (file)
@@ -40,6 +40,7 @@ VSIX_ASSETS          := $(LUFA_ROOT)/DoxygenPages/Images/LUFA_thumb.png \
                         Blob/Atmel.Studio.Services.Interfaces.dll       \
                         Blob/LUFA.dll                                   \
                         Blob/LUFA.pkgdef
+
 MSHELP_GEN_PARAMS   := --stringparam generate.toc "book toc"            \
                        --stringparam chunk.quietly "1"                  \
                        --stringparam chunk.section.depth "3"            \