summaryrefslogtreecommitdiff
path: root/docs/reference/doxygen_to_devhelp.xsl
blob: f05af187ccacef971c82c2818f90f41746230129 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<xsl:stylesheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:fo="http://www.w3.org/1999/XSL/Format"
    version="1.0">

<xsl:output method="xml" version="1.0" indent="yes"/>

<!-- these are parameters so that this stylesheet can be used by multiple
libraries.  Pass them in on the commandline -->
<xsl:param name="book_title"/>
<xsl:param name="book_name"/>
<xsl:param name="reference_prefix"/>

<xsl:template match="/">
    <book title="{$book_title}"
        name="{$book_name}"
        link="{$reference_prefix}/index.html">
  <chapters>
      <sub name="Classes" link="{$reference_prefix}/classes.html">
      <xsl:apply-templates select="doxygenindex/compound[@kind='class']">
        <xsl:sort select="."/>
      </xsl:apply-templates>
    </sub>
    <sub name="Namespaces" link="{$reference_prefix}/namespaces.html">
      <xsl:apply-templates select="doxygenindex/compound[@kind='namespace']">
        <xsl:sort select="."/>
      </xsl:apply-templates>
    </sub>
  </chapters>

  <functions>
    <!-- @todo: maybe select only the real functions, ie those with kind=="function"? -->
    <xsl:apply-templates select="doxygenindex/compound/member" mode="as-function"/>
  </functions>
  </book>
</xsl:template>

<xsl:template match="compound">
  <xsl:param name="name"><xsl:value-of select="name"/></xsl:param>
  <xsl:param name="link"><xsl:value-of select="@refid"/>.html</xsl:param>
  <sub name="{$name}" link="{$reference_prefix}/{$link}">
  <xsl:apply-templates select="member" mode="as-sub">
    <xsl:sort select="."/>
  </xsl:apply-templates>
  </sub>
</xsl:template>

<xsl:template match="member" mode="as-function">
  <!--
  <function name="atk_set_value" link="atk-atkvalue.html#ATK-SET-VALUE"/>
  -->
  <xsl:variable name="fqn">
    <xsl:call-template name="get-fully-qualified-name" />
  </xsl:variable>
  <xsl:variable name="link">
    <xsl:call-template name="get-member-link" />
  </xsl:variable>
  <function name="{$fqn}" link="{$reference_prefix}/{$link}"/>
</xsl:template>

<xsl:template match="member" mode="as-sub">
  <xsl:variable name="fqn">
    <xsl:call-template name="get-fully-qualified-name" />
  </xsl:variable>
  <xsl:variable name="link">
    <xsl:call-template name="get-member-link" />
  </xsl:variable>
  <sub name="{$fqn}" link="{$reference_prefix}/{$link}"/>
</xsl:template>


<!-- get a url link for the current member node.
  The source xml looks like this:
  <compound refid="classGtk_1_1AboutDialog" kind="class"><name>Gtk::AboutDialog</name>
    <member refid="classGtk_1_1AboutDialog_1ad14950354fa1d9e7d02e951bd0f232e" kind="typedef"><name>SlotActivateLink</name></member>

  The URL for the member function is obtained by adding '.html' to the refid of
  the parent node.  The in-page anchor id is the portion of the child's refid
  that is different than the parent's refid, but without the leading '_1'
  So, in the example above, the url would be:
    classGtk_1_1AboutDialog.html#ad14950354fa1d9e7d02e951bd0f232e
-->
<xsl:template name="get-member-link">
  <xsl:variable name="offset">
    <xsl:value-of select="string-length(../@refid) + 3"/>
  </xsl:variable>
  <xsl:value-of select="concat(../@refid, '.html#', substring(@refid, $offset))"/>
</xsl:template>

<!-- Get the fully qualified name for the current class member node -->
<xsl:template name="get-fully-qualified-name">
  <xsl:value-of select="concat(../name, '::', name)"/>
</xsl:template>

</xsl:stylesheet>

<!-- vim:ts=2 sw=2:
-->