aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2013-04-21 14:18:12 +0000
committerDean Camera <dean@fourwalledcubicle.com>2013-04-21 14:18:12 +0000
commitd540e525050a48311bf3308878940766797989a8 (patch)
tree7ee66251e17b846848a526f910439f90135a1c69
parentdd723813d922b5fd27946787cf42b9881ab2eb46 (diff)
downloadlufa-d540e525050a48311bf3308878940766797989a8.tar.gz
lufa-d540e525050a48311bf3308878940766797989a8.tar.bz2
lufa-d540e525050a48311bf3308878940766797989a8.zip
Add partially complete Doxygen-to-Docbook transform.
-rw-r--r--LUFA/StudioIntegration/HV1/lufa_docbook_transform.xsl198
-rw-r--r--LUFA/StudioIntegration/HV1/transform_base.xsl737
-rw-r--r--LUFA/StudioIntegration/makefile8
3 files changed, 941 insertions, 2 deletions
diff --git a/LUFA/StudioIntegration/HV1/lufa_docbook_transform.xsl b/LUFA/StudioIntegration/HV1/lufa_docbook_transform.xsl
new file mode 100644
index 000000000..0da97ca23
--- /dev/null
+++ b/LUFA/StudioIntegration/HV1/lufa_docbook_transform.xsl
@@ -0,0 +1,198 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<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:param name="keyword.namespace" select="'Atmel.Language.C'"/>
+
+ <xsl:template name="generate.book.title">
+ <xsl:text>LUFA Library</xsl:text>
+ </xsl:template>
+
+ <xsl:template name="generate.book.id">
+ <xsl:param name="book.title"/>
+ <xsl:choose>
+ <xsl:when test="@id">
+ <xsl:value-of select="@id"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="translate($book.title, ' ','')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="doxygen">
+ <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>
+
+ <book name="{$book.id}">
+ <title>
+ <xsl:value-of select="$book.title"/>
+ </title>
+
+ <xsl:call-template name="generate.top.level.page">
+ <xsl:with-param name="top.level.page" select="compounddef[@kind = 'page' and contains(@id, 'index')]"/>
+ </xsl:call-template>
+
+ <xsl:for-each select="compounddef[@kind = 'page' and not(contains(@id, 'index'))]">
+ <xsl:if test="not(//innerpage[@refid = current()/@id])">
+ <xsl:call-template name="generate.top.level.page">
+ <xsl:with-param name="top.level.page" select="current()"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:for-each>
+ </book>
+ </xsl:template>
+
+ <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>
+ </chapter>
+ </xsl:template>
+
+ <xsl:template match="compounddef[@kind = 'page']">
+ <section id="{@id}">
+ <title>
+ <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>
+ </section>
+ </xsl:template>
+
+ <xsl:template match="linebreak">
+ <xsl:text>&#10;</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="image">
+ <figure>
+ <title>
+ <xsl:value-of select="."/>
+ </title>
+
+ <mediaobject>
+ <imageobject>
+ <imagedata>
+ <xsl:attribute name="fileref">images/<xsl:value-of select="@name"/></xsl:attribute>
+ </imagedata>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </xsl:template>
+
+ <xsl:template match="detaileddescription">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="sect1 | sect2 | sect3 | sect4 | sect5 | sect6 | sect7 | sect8 | sect9">
+ <section>
+ <xsl:if test="@id">
+ <xsl:attribute name="id">
+ <xsl:value-of select="@id"/>
+ </xsl:attribute>
+ </xsl:if>
+
+ <title>
+ <xsl:value-of select="title"/>
+ </title>
+
+ <xsl:apply-templates/>
+ </section>
+ </xsl:template>
+
+ <xsl:template match="anchor">
+ <xsl:if test="@id">
+ <indexterm id="{@id}"/>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="compoundname"/>
+
+ <xsl:template match="title"/>
+
+ <xsl:template match="indexterm"/>
+
+ <xsl:template match="indexentry">
+ <xsl:variable name="prim">
+ <xsl:choose>
+ <xsl:when test="contains(primaryie, ',')">
+ <xsl:value-of select="normalize-space(substring-before(primaryie, ','))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="primaryie"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:variable name="sec">
+ <xsl:choose>
+ <xsl:when test="contains(primaryie, ',')">
+ <xsl:value-of select="normalize-space(substring-after(primaryie, ','))"/>
+ </xsl:when>
+ <xsl:when test="seondariye">
+ <xsl:value-of select="secondaryie"/>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:variable name="tert">
+ <xsl:choose>
+ <xsl:when test="contains(primaryie, ',')">
+ <xsl:choose>
+ <xsl:when test="secondaryie">
+ <xsl:value-of select="secondaryie"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="tertiaryie">
+ <xsl:value-of select="tertiaryie"/>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:variable>
+
+ <indexterm>
+ <xsl:if test="@id">
+ <xsl:attribute name="id">
+ <xsl:value-of select="@id"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$prim">
+ <primary>
+ <xsl:value-of select="$prim"/>
+ </primary>
+ </xsl:if>
+ <xsl:if test="$sec">
+ <secondary>
+ <xsl:value-of select="$sec"/>
+ </secondary>
+ </xsl:if>
+ <xsl:if test="$tert">
+ <tertiary>
+ <xsl:value-of select="$tert"/>
+ </tertiary>
+ </xsl:if>
+ </indexterm>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/LUFA/StudioIntegration/HV1/transform_base.xsl b/LUFA/StudioIntegration/HV1/transform_base.xsl
new file mode 100644
index 000000000..03b7901b6
--- /dev/null
+++ b/LUFA/StudioIntegration/HV1/transform_base.xsl
@@ -0,0 +1,737 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:exsl="http://exslt.org/common"
+ extension-element-prefixes="exsl"
+ exclude-result-prefixes="exsl"
+ version="1.0">
+
+ <xsl:output
+ method="xml" indent="yes"
+ doctype-public="-//OASIS//DTD DocBook XML V4.5//EN"
+ doctype-system="http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"/>
+
+ <xsl:template name="write.api.overview.contents">
+
+ <xsl:if test="count(ancestor::*/sectiondef[memberdef/@kind = 'variable' or memberdef/@kind = 'typedef']) > 0">
+ <section>
+ <title>Variable and Type Definitions</title>
+
+ <xsl:for-each select="ancestor::*/sectiondef[memberdef/@kind = 'variable' or memberdef/@kind = 'typedef']">
+ <section>
+ <title>
+ <xsl:value-of select="header"/>
+ </title>
+
+ <xsl:apply-templates select="description"/>
+ <xsl:apply-templates select="memberdef[@kind = 'variable' or @kind = 'typedef']"/>
+ </section>
+ </xsl:for-each>
+ </section>
+ </xsl:if>
+
+ <xsl:if test="count(ancestor::*/innerclass) > 0">
+ <section>
+ <title>Structure Definitions</title>
+
+ <xsl:for-each select="ancestor::*/innerclass">
+ <xsl:apply-templates select="ancestor::*/compounddef[@id = current()/@refid]"/>
+ </xsl:for-each>
+ </section>
+ </xsl:if>
+
+ <xsl:if test="count(ancestor::*/sectiondef[memberdef/@kind = 'define' or @kind = 'define']) > 0">
+ <section>
+ <title>Macro Definitions</title>
+
+ <xsl:for-each select="ancestor::*/sectiondef[memberdef/@kind = 'define' or @kind = 'define']">
+ <section>
+ <title>
+ <xsl:value-of select="header"/>
+ </title>
+
+ <xsl:apply-templates select="description"/>
+ <xsl:apply-templates select="memberdef[@kind = 'define']"/>
+ </section>
+ </xsl:for-each>
+ </section>
+ </xsl:if>
+
+ <xsl:if test="count(ancestor::*/sectiondef[memberdef/@kind = 'function']) > 0">
+ <section>
+ <title>Function Definitions</title>
+
+ <xsl:for-each select="ancestor::*/sectiondef[memberdef/@kind = 'function']">
+ <section>
+ <title>
+ <xsl:value-of select="header"/>
+ </title>
+
+ <xsl:apply-templates select="description"/>
+ <xsl:apply-templates select="memberdef[@kind = 'function']"/>
+ </section>
+ </xsl:for-each>
+ </section>
+ </xsl:if>
+
+ <xsl:if test="count(ancestor::*/sectiondef[@kind = 'enum']) > 0">
+ <section>
+ <title>Enumeration Definitions</title>
+
+ <xsl:apply-templates select="ancestor::*/sectiondef[@kind = 'enum']"/>
+ </section>
+ </xsl:if>
+
+ </xsl:template>
+
+ <xsl:template match="compounddef">
+ <!-- Discard compounddef elements unless a later template matches -->
+ </xsl:template>
+
+ <xsl:template match="compounddef[@kind = 'struct' or @kind = 'union']">
+ <section id="{@id}" xreflabel="{compoundname}">
+ <title>
+ <xsl:choose>
+ <xsl:when test="@kind = 'struct'">
+ <xsl:text>Struct </xsl:text>
+ </xsl:when>
+ <xsl:when test="@kind = 'union'">
+ <xsl:text>Union </xsl:text>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:value-of select="compoundname"/>
+ </title>
+
+ <xsl:apply-templates select="detaileddescription"/>
+
+ <xsl:for-each select="sectiondef[@kind = 'public-attrib']">
+ <informaltable tabstyle="striped">
+ <tgroup cols="3">
+ <thead>
+ <row>
+ <entry>Type</entry>
+ <entry>Name</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <xsl:for-each select="memberdef">
+ <row id="{@id}" xreflabel="{name}">
+ <entry>
+ <xsl:apply-templates select="type"/>
+ </entry>
+ <entry>
+ <xsl:value-of select="name"/>
+ <xsl:if test="starts-with(argsstring, '[')">
+ <xsl:text>[]</xsl:text>
+ </xsl:if>
+ </entry>
+ <entry>
+ <xsl:apply-templates select="detaileddescription" mode="struct"/>
+ </entry>
+ </row>
+ </xsl:for-each>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ <para>&#xa0;</para>
+ </xsl:for-each>
+ </section>
+ </xsl:template>
+
+ <xsl:template match="memberdef[@kind = 'function']">
+ <section id="{@id}" xreflabel="{name}">
+ <title> Function <xsl:value-of select="name"/>() </title>
+
+ <para>
+ <emphasis role="italic">
+ <xsl:value-of select="briefdescription"/>
+ </emphasis>
+ </para>
+
+ <programlisting language="c">
+ <xsl:value-of select="definition"/>
+ <xsl:text>&#10;&#9;&#9;</xsl:text>
+ <xsl:apply-templates select="argsstring"/>
+ </programlisting>
+
+ <xsl:apply-templates select="detaileddescription"/>
+
+ <para>&#xa0;</para>
+ </section>
+ </xsl:template>
+
+ <xsl:template match="memberdef[@kind = 'enum']">
+ <section id="{@id}" xreflabel="{name}">
+ <title> Enum <xsl:value-of select="name"/> </title>
+
+ <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>
+
+ <para>&#xa0;</para>
+ </section>
+ </xsl:template>
+
+ <xsl:template match="memberdef[@kind = 'define']">
+ <section id="{@id}" xreflabel="{name}">
+ <title> Macro <xsl:value-of select="name"/> </title>
+
+ <programlisting language="c">
+ <xsl:text>#define </xsl:text>
+ <xsl:value-of select="name"/>
+ <xsl:if test="count(param) > 0">
+ <xsl:text>(</xsl:text>
+ <xsl:for-each select="param/defname">
+ <xsl:if test="position() > 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) > 50) or (count(param) > 0)">
+ <xsl:text>\&#10;&#09;&#9;</xsl:text>
+ </xsl:if>
+
+ <xsl:value-of select="initializer"/>
+ </programlisting>
+
+ <xsl:apply-templates select="detaileddescription"/>
+
+ <para>&#xa0;</para>
+ </section>
+ </xsl:template>
+
+ <xsl:template match="memberdef[@kind = 'variable' or @kind = 'typedef']">
+ <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>
+
+ <programlisting language="c">
+ <xsl:value-of select="definition"/>
+ </programlisting>
+
+ <xsl:apply-templates select="detaileddescription"/>
+
+ <para>&#xa0;</para>
+ </section>
+ </xsl:template>
+
+ <xsl:template match="sectiondef">
+ <para>
+ <xsl:value-of select="description"/>
+ </para>
+
+ <xsl:apply-templates select="memberdef"/>
+ </xsl:template>
+
+ <xsl:template match="simplesect" mode="struct">
+ <footnote>
+ <xsl:apply-templates select="para"/>
+ </footnote>
+ </xsl:template>
+
+ <xsl:template match="simplesect">
+ <xsl:choose>
+ <xsl:when test="@kind = 'warning'">
+ <warning>
+ <title>Warning</title>
+ <xsl:apply-templates select="para"/>
+ </warning>
+ </xsl:when>
+
+ <xsl:when test="@kind = 'return'">
+ <note>
+ <title>Returns</title>
+ <xsl:apply-templates select="para"/>
+ </note>
+ </xsl:when>
+
+ <xsl:when test="@kind = 'pre'">
+ <note>
+ <title>Precondition</title>
+ <xsl:apply-templates select="para"/>
+ </note>
+ </xsl:when>
+
+ <xsl:when test="@kind = 'par'">
+ <note>
+ <title>
+ <xsl:value-of select="title"/>
+ </title>
+ <xsl:apply-templates select="para"/>
+ </note>
+ </xsl:when>
+
+ <xsl:when test="@kind = 'see'">
+ <note>
+ <title>See also</title>
+ <xsl:apply-templates select="para"/>
+ </note>
+ </xsl:when>
+
+ <xsl:when test="@kind = 'note'">
+ <!-- Notes can have special prefix keywords to transform them into
+ special styles for training documents ("AlfonsoNotes(TM)") -->
+ <xsl:variable name="note.prefix" select="substring-before(para[1]/text(), ' ')"/>
+
+ <note>
+ <xsl:choose>
+ <xsl:when test="$note.prefix = 'TODO:'">
+ <xsl:attribute name="role">todo</xsl:attribute>
+ <title>To Do</title>
+ </xsl:when>
+
+ <xsl:when test="$note.prefix = 'TIP:'">
+ <xsl:attribute name="role">tip</xsl:attribute>
+ <title>Tip</title>
+ </xsl:when>
+
+ <xsl:when test="$note.prefix = 'INFO:'">
+ <xsl:attribute name="role">info</xsl:attribute>
+ <title>Info</title>
+ </xsl:when>
+
+ <xsl:when test="$note.prefix = 'RESULT:'">
+ <xsl:attribute name="role">result</xsl:attribute>
+ <title>Result</title>
+ </xsl:when>
+
+ <xsl:when test="$note.prefix = 'EXECUTE:'">
+ <xsl:attribute name="role">execute</xsl:attribute>
+ <title>Execute</title>
+ </xsl:when>
+
+ <xsl:when test="$note.prefix = 'WARNING:'">
+ <xsl:attribute name="role">warning</xsl:attribute>
+ <title>Warning</title>
+ </xsl:when>
+
+ <xsl:otherwise/>
+ </xsl:choose>
+
+ <xsl:apply-templates select="para"/>
+ </note>
+ </xsl:when>
+
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- Strip off the special note type prefix from the special training document
+ style notes ("AlfonsoNotes(TM)") if one is present. -->
+ <xsl:template match="para[parent::simplesect/@kind='note']/text()">
+ <xsl:variable name="note.prefix" select="substring-before(., ' ')"/>
+ <xsl:variable name="note.content" select="substring-after(., ' ')"/>
+
+ <xsl:choose>
+ <xsl:when test="$note.prefix = 'TODO:'">
+ <xsl:value-of select="$note.content"/>
+ </xsl:when>
+
+ <xsl:when test="$note.prefix = 'TIP:'">
+ <xsl:value-of select="$note.content"/>
+ </xsl:when>
+
+ <xsl:when test="$note.prefix = 'INFO:'">
+ <xsl:value-of select="$note.content"/>
+ </xsl:when>
+
+ <xsl:when test="$note.prefix = 'RESULT:'">
+ <xsl:value-of select="$note.content"/>
+ </xsl:when>
+
+ <xsl:when test="$note.prefix = 'EXECUTE:'">
+ <xsl:value-of select="$note.content"/>
+ </xsl:when>
+
+ <xsl:when test="$note.prefix = 'WARNING:'">
+ <xsl:value-of select="$note.content"/>
+ </xsl:when>
+
+ <xsl:otherwise>
+ <xsl:value-of select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="parameterlist[@kind = 'param']">
+ <table tabstyle="striped">
+ <title>Parameters</title>
+ <tgroup cols="3">
+ <thead>
+ <row>
+ <entry>Data Direction</entry>
+ <entry>Parameter Name</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <xsl:for-each select="parameteritem">
+ <row>
+ <xsl:apply-templates select="."/>
+ </row>
+ </xsl:for-each>
+ </tbody>
+ </tgroup>
+ </table>
+ </xsl:template>
+
+ <xsl:template match="parameterlist[@kind = 'retval']">
+ <table tabstyle="striped">
+ <title>Return Values</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Return Value</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <xsl:for-each select="parameteritem">
+ <row>
+ <xsl:apply-templates select="."/>
+ </row>
+ </xsl:for-each>
+ </tbody>
+ </tgroup>
+ </table>
+ </xsl:template>
+
+ <xsl:template match="parameteritem">
+ <xsl:if test="parent::parameterlist/@kind = 'param'">
+ <entry>
+ <para>
+ <xsl:choose>
+ <xsl:when test="not(descendant::parametername/@direction)">
+ <emphasis role="italic">?</emphasis>
+ </xsl:when>
+ <xsl:otherwise>
+ <emphasis role="bold">[<xsl:value-of select="descendant::parametername/@direction"/>]</emphasis>
+ </xsl:otherwise>
+ </xsl:choose>
+ </para>
+ </entry>
+ </xsl:if>
+
+ <entry>
+ <para>
+ <xsl:value-of select="parameternamelist/parametername"/>
+ </para>
+ </entry>
+
+ <entry>
+ <xsl:apply-templates select="parameterdescription"/>
+ </entry>
+ </xsl:template>
+
+ <xsl:template match="type">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="sect1">
+ <section id="{@id}" xreflabel="{title}">
+ <title>
+ <xsl:value-of select="title"/>
+ </title>
+
+ <xsl:apply-templates select="para"/>
+ <xsl:apply-templates select="sect2"/>
+ </section>
+ </xsl:template>
+
+ <xsl:template match="sect2">
+ <section id="{@id}" xreflabel="{title}">
+ <title>
+ <xsl:value-of select="title"/>
+ </title>
+
+ <xsl:apply-templates select="para"/>
+ <xsl:apply-templates select="sect3"/>
+ </section>
+ </xsl:template>
+
+ <xsl:template match="sect3">
+ <section id="{@id}" xreflabel="{title}">
+ <title>
+ <xsl:value-of select="title"/>
+ </title>
+
+ <xsl:apply-templates select="para"/>
+ </section>
+ </xsl:template>
+
+ <xsl:template match="detaileddescription">
+ <xsl:apply-templates select="para"/>
+ <xsl:apply-templates select="sect1"/>
+ </xsl:template>
+
+ <xsl:template match="para">
+ <para>
+ <xsl:apply-templates/>
+ </para>
+ </xsl:template>
+
+ <xsl:template match="bold">
+ <emphasis role="bold">
+ <xsl:value-of select="."/>
+ </emphasis>
+ </xsl:template>
+
+ <xsl:template match="emphasis">
+ <emphasis role="italic">
+ <xsl:value-of select="."/>
+ </emphasis>
+ </xsl:template>
+
+ <xsl:template match="computeroutput">
+ <computeroutput>
+ <xsl:value-of select="."/>
+ </computeroutput>
+ </xsl:template>
+
+ <xsl:template match="ulink">
+ <ulink url="{@url}">
+ <xsl:value-of select="."/>
+ </ulink>
+ </xsl:template>
+
+ <xsl:template match="registered">
+ <xsl:text>&#174;</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="copy">
+ <xsl:text>&#169;</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="trademark">
+ <xsl:text>&#8482;</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="ref">
+ <xsl:choose>
+ <!-- Don't show links inside program listings -->
+ <xsl:when test="ancestor::programlisting">
+ <xsl:value-of select="."/>
+ </xsl:when>
+
+ <!-- Show links outside program listings -->
+ <xsl:otherwise>
+ <link linkend="{@refid}" xrefstyle="nopage">
+ <xsl:value-of select="text()"/>
+ </link>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="formula">
+ <equation>
+ <!-- LaTeX equation generation requires JLatexMath and its associated
+ FOP plugin, or you will get missing equations in the output -->
+ <latex align="center" xmlns="http://forge.scilab.org/p/jlatexmath">
+ <xsl:value-of select="."/>
+ </latex>
+ </equation>
+ </xsl:template>
+
+ <xsl:template match="table">
+ <xsl:choose>
+ <xsl:when test="caption">
+ <table tabstyle="striped">
+ <title>
+ <xsl:value-of select="caption"/>
+ </title>
+ <xsl:call-template name="write.table.content"/>
+ </table>
+ </xsl:when>
+ <xsl:otherwise>
+ <informaltable tabstyle="striped">
+ <xsl:call-template name="write.table.content"/>
+ </informaltable>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="write.table.content">
+ <tgroup cols="{@cols}">
+ <thead>
+ <xsl:for-each select="row[1]">
+ <row>
+ <xsl:for-each select="entry">
+ <entry>
+ <xsl:apply-templates select="."/>
+ </entry>
+ </xsl:for-each>
+ </row>
+ </xsl:for-each>
+ </thead>
+ <tbody>
+ <xsl:for-each select="row[position() != 1]">
+ <row>
+ <xsl:for-each select="entry">
+ <entry>
+ <xsl:apply-templates select="."/>
+ </entry>
+ </xsl:for-each>
+ </row>
+ </xsl:for-each>
+ </tbody>
+ </tgroup>
+ </xsl:template>
+
+ <xsl:template match="itemizedlist">
+ <itemizedlist>
+ <xsl:apply-templates select="listitem"/>
+ </itemizedlist>
+ </xsl:template>
+
+ <xsl:template match="orderedlist">
+ <orderedlist>
+ <xsl:apply-templates select="listitem"/>
+ </orderedlist>
+ </xsl:template>
+
+ <xsl:template match="listitem">
+ <listitem>
+ <xsl:apply-templates/>
+ </listitem>
+ </xsl:template>
+
+ <xsl:template match="programlisting">
+ <programlisting language="c">
+ <xsl:for-each select="codeline[position() > 1 or highlight]">
+ <xsl:apply-templates select="."/>
+ <xsl:text>&#10;</xsl:text>
+ </xsl:for-each>
+ </programlisting>
+ </xsl:template>
+
+ <xsl:template match="highlight">
+ <emphasis>
+ <xsl:attribute name="role">
+ <xsl:value-of select="@class"/>
+ </xsl:attribute>
+ <xsl:apply-templates/>
+ </emphasis>
+ </xsl:template>
+
+ <xsl:template match="sp[ancestor::codeline]">
+ <xsl:choose>
+ <!-- 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 -->
+ <xsl:when test="ancestor::highlight = ancestor::codeline/highlight[1]">
+ <!-- Doxygen retains a level of indentation in some code fragments - obtain
+ 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 -->
+ <xsl:variable name="leading.spaces" select="count(ancestor::programlisting/codeline[highlight][1]/highlight[1]/sp[not(preceding-sibling::text())])"/>
+
+ <xsl:if test="position() > $leading.spaces">
+ <xsl:text> </xsl:text>
+ </xsl:if>
+ </xsl:when>
+
+ <xsl:otherwise>
+ <xsl:text> </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="image">
+ <figure>
+ <title>
+ <xsl:value-of select="."/>
+ </title>
+
+ <mediaobject>
+ <imageobject>
+ <imagedata scalefit="1" width="{@width}">
+ <xsl:attribute name="fileref">html/<xsl:value-of select="@name"/></xsl:attribute>
+ </imagedata>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </xsl:template>
+
+ <xsl:template match="anchor">
+ <anchor id="{@id}"/>
+ </xsl:template>
+
+ <xsl:template match="dot">
+ <!-- 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
+ that file. The build system should then call dot to render all generated
+ DOT files into their SVG equivalents before rendering the PDF. -->
+ <xsl:variable name="filename" select="generate-id(.)" />
+ <exsl:document href="{$filename}.dot" method="text">
+ <xsl:value-of select="." />
+ </exsl:document>
+
+ <figure>
+ <title>
+ <xsl:value-of select="ancestor::*/title"/>
+ </title>
+ <mediaobject>
+ <imageobject>
+ <imagedata format="SVG">
+ <xsl:attribute name="fileref">
+ <xsl:value-of select="$filename" />
+ <xsl:text>.svg</xsl:text>
+ </xsl:attribute>
+ </imagedata>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </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>
diff --git a/LUFA/StudioIntegration/makefile b/LUFA/StudioIntegration/makefile
index 5b50a2221..daaa2dccd 100644
--- a/LUFA/StudioIntegration/makefile
+++ b/LUFA/StudioIntegration/makefile
@@ -40,6 +40,10 @@ 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 "2" \
+ --stringparam chunk.first.sections "1"
all: generate_xml check_filenames generate_vsix
@@ -79,11 +83,11 @@ $(MSHELP_OUTPUT_XML): $(DOXYGEN_COMBINED_XML)
@echo Converting Doxygen XML to Docbook...
@-mkdir mshelp 2> /dev/null
@xsltproc HV1/lufa_docbook_transform.xsl $(DOXYGEN_COMBINED_XML) > mshelp/lufa_docbook.xml
- @cd mshelp && xsltproc ../Docbook/mshelp/docbook.xsl lufa_docbook.xml
+ @cd mshelp && xsltproc $(MSHELP_GEN_PARAMS) ../Docbook/mshelp/docbook.xsl lufa_docbook.xml
@echo Copying help assets...
@-mkdir mshelp/images 2> /dev/null
- @cp -r $(LUFA_ROOT)/DoxygenPages/Images/* mshelp/images
+ @cp `find $(LUFA_ROOT)/DoxygenPages/Images -type f` mshelp/images
@echo Archiving help content...
@cd mshelp && zip ../$(MSHELP_OUTPUT_XML) -q -0 -r *.html images