xref: /aosp_15_r20/external/wayland/doc/publican/doxygen-to-publican.xsl (revision 84e872a0dc482bffdb63672969dd03a827d67c73)
1*84e872a0SLloyd Pique<?xml version="1.0" ?>
2*84e872a0SLloyd Pique<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
3*84e872a0SLloyd Pique<xsl:output method="xml" encoding="UTF-8" indent="yes" />
4*84e872a0SLloyd Pique<xsl:param name="which" />
5*84e872a0SLloyd Pique
6*84e872a0SLloyd Pique<xsl:template match="/">
7*84e872a0SLloyd Pique  <xsl:apply-templates select="/doxygen/compounddef[@kind!='file' and @kind!='dir']" />
8*84e872a0SLloyd Pique
9*84e872a0SLloyd Pique  <section id="{$which}-Functions">
10*84e872a0SLloyd Pique    <title>Functions</title>
11*84e872a0SLloyd Pique    <para />
12*84e872a0SLloyd Pique    <variablelist>
13*84e872a0SLloyd Pique      <xsl:apply-templates select="/doxygen/compounddef[@kind='file']/sectiondef/memberdef" />
14*84e872a0SLloyd Pique    </variablelist>
15*84e872a0SLloyd Pique  </section>
16*84e872a0SLloyd Pique
17*84e872a0SLloyd Pique</xsl:template>
18*84e872a0SLloyd Pique
19*84e872a0SLloyd Pique<xsl:template match="parameteritem">
20*84e872a0SLloyd Pique    <varlistentry>
21*84e872a0SLloyd Pique        <term>
22*84e872a0SLloyd Pique          <xsl:apply-templates select="parameternamelist/parametername"/>
23*84e872a0SLloyd Pique        </term>
24*84e872a0SLloyd Pique      <listitem>
25*84e872a0SLloyd Pique        <simpara><xsl:apply-templates select="parameterdescription"/></simpara>
26*84e872a0SLloyd Pique      </listitem>
27*84e872a0SLloyd Pique    </varlistentry>
28*84e872a0SLloyd Pique</xsl:template>
29*84e872a0SLloyd Pique
30*84e872a0SLloyd Pique<xsl:template match="parameterlist">
31*84e872a0SLloyd Pique  <xsl:if test="parameteritem">
32*84e872a0SLloyd Pique      <variablelist>
33*84e872a0SLloyd Pique        <xsl:apply-templates select="parameteritem" />
34*84e872a0SLloyd Pique      </variablelist>
35*84e872a0SLloyd Pique  </xsl:if>
36*84e872a0SLloyd Pique</xsl:template>
37*84e872a0SLloyd Pique
38*84e872a0SLloyd Pique<xsl:template match="ref">
39*84e872a0SLloyd Pique  <link linkend="{$which}-{@refid}"><xsl:value-of select="." /></link>
40*84e872a0SLloyd Pique</xsl:template>
41*84e872a0SLloyd Pique
42*84e872a0SLloyd Pique<xsl:template match="simplesect[@kind='return']">
43*84e872a0SLloyd Pique  <variablelist>
44*84e872a0SLloyd Pique    <varlistentry>
45*84e872a0SLloyd Pique      <term>Returns:</term>
46*84e872a0SLloyd Pique      <listitem>
47*84e872a0SLloyd Pique        <simpara><xsl:apply-templates /></simpara>
48*84e872a0SLloyd Pique      </listitem>
49*84e872a0SLloyd Pique    </varlistentry>
50*84e872a0SLloyd Pique  </variablelist>
51*84e872a0SLloyd Pique</xsl:template>
52*84e872a0SLloyd Pique
53*84e872a0SLloyd Pique<xsl:template match="simplesect[@kind='see']">
54*84e872a0SLloyd Pique  See also: <xsl:apply-templates />
55*84e872a0SLloyd Pique</xsl:template>
56*84e872a0SLloyd Pique
57*84e872a0SLloyd Pique<xsl:template match="simplesect[@kind='since']">
58*84e872a0SLloyd Pique  Since: <xsl:apply-templates />
59*84e872a0SLloyd Pique</xsl:template>
60*84e872a0SLloyd Pique
61*84e872a0SLloyd Pique<xsl:template match="simplesect[@kind='note']">
62*84e872a0SLloyd Pique  <emphasis>Note: <xsl:apply-templates /></emphasis>
63*84e872a0SLloyd Pique</xsl:template>
64*84e872a0SLloyd Pique
65*84e872a0SLloyd Pique<xsl:template match="sp">
66*84e872a0SLloyd Pique  <xsl:text> </xsl:text>
67*84e872a0SLloyd Pique</xsl:template>
68*84e872a0SLloyd Pique
69*84e872a0SLloyd Pique<xsl:template match="programlisting">
70*84e872a0SLloyd Pique  <programlisting><xsl:apply-templates /></programlisting>
71*84e872a0SLloyd Pique</xsl:template>
72*84e872a0SLloyd Pique
73*84e872a0SLloyd Pique<xsl:template match="itemizedlist">
74*84e872a0SLloyd Pique  <itemizedlist><xsl:apply-templates select="listitem" /></itemizedlist>
75*84e872a0SLloyd Pique</xsl:template>
76*84e872a0SLloyd Pique
77*84e872a0SLloyd Pique<xsl:template match="listitem">
78*84e872a0SLloyd Pique  <listitem><simpara><xsl:apply-templates /></simpara></listitem>
79*84e872a0SLloyd Pique</xsl:template>
80*84e872a0SLloyd Pique
81*84e872a0SLloyd Pique<!-- stops cross-references in the section titles -->
82*84e872a0SLloyd Pique<xsl:template match="briefdescription">
83*84e872a0SLloyd Pique  <xsl:value-of select="." />
84*84e872a0SLloyd Pique</xsl:template>
85*84e872a0SLloyd Pique
86*84e872a0SLloyd Pique<!-- this opens a para for each detaileddescription/para. I could not find a
87*84e872a0SLloyd Pique     way to extract the right text for the description from the
88*84e872a0SLloyd Pique     source otherwise. Downside: we can't use para for return value, "see
89*84e872a0SLloyd Pique     also", etc.  because they're already inside a para. So they're lists.
90*84e872a0SLloyd Pique
91*84e872a0SLloyd Pique     It also means we don't control the order of when something is added to
92*84e872a0SLloyd Pique     the output, it matches the input file
93*84e872a0SLloyd Pique     -->
94*84e872a0SLloyd Pique<xsl:template match="detaileddescription/para">
95*84e872a0SLloyd Pique  <para><xsl:apply-templates /></para>
96*84e872a0SLloyd Pique</xsl:template>
97*84e872a0SLloyd Pique
98*84e872a0SLloyd Pique<xsl:template match="detaileddescription">
99*84e872a0SLloyd Pique  <xsl:apply-templates select="para" />
100*84e872a0SLloyd Pique</xsl:template>
101*84e872a0SLloyd Pique
102*84e872a0SLloyd Pique<!-- methods -->
103*84e872a0SLloyd Pique<xsl:template match="memberdef" >
104*84e872a0SLloyd Pique  <xsl:if test="@kind = 'function' and @static = 'no' and @prot = 'public' or
105*84e872a0SLloyd Pique                @kind !='function' and normalize-space(briefdescription) != ''">
106*84e872a0SLloyd Pique    <varlistentry id="{$which}-{@id}">
107*84e872a0SLloyd Pique        <term>
108*84e872a0SLloyd Pique          <xsl:value-of select="name"/>
109*84e872a0SLloyd Pique          <xsl:if test="normalize-space(briefdescription) != ''">
110*84e872a0SLloyd Pique            - <xsl:apply-templates select="briefdescription" />
111*84e872a0SLloyd Pique          </xsl:if>
112*84e872a0SLloyd Pique        </term>
113*84e872a0SLloyd Pique        <listitem>
114*84e872a0SLloyd Pique          <synopsis>
115*84e872a0SLloyd Pique            <xsl:apply-templates select="definition"/><xsl:apply-templates select="argsstring"/>
116*84e872a0SLloyd Pique          </synopsis>
117*84e872a0SLloyd Pique          <xsl:apply-templates select="detaileddescription" />
118*84e872a0SLloyd Pique        </listitem>
119*84e872a0SLloyd Pique    </varlistentry>
120*84e872a0SLloyd Pique  </xsl:if>
121*84e872a0SLloyd Pique</xsl:template>
122*84e872a0SLloyd Pique
123*84e872a0SLloyd Pique<!-- classes -->
124*84e872a0SLloyd Pique<xsl:template match="compounddef" >
125*84e872a0SLloyd Pique    <section id="{$which}-{@id}">
126*84e872a0SLloyd Pique        <title>
127*84e872a0SLloyd Pique            <xsl:value-of select="compoundname" />
128*84e872a0SLloyd Pique            <xsl:if test="normalize-space(briefdescription) != ''">
129*84e872a0SLloyd Pique                - <xsl:apply-templates select="briefdescription" />
130*84e872a0SLloyd Pique            </xsl:if>
131*84e872a0SLloyd Pique        </title>
132*84e872a0SLloyd Pique        <xsl:choose>
133*84e872a0SLloyd Pique          <xsl:when test="normalize-space(detaileddescription) != ''">
134*84e872a0SLloyd Pique            <xsl:apply-templates select="detaileddescription" />
135*84e872a0SLloyd Pique          </xsl:when>
136*84e872a0SLloyd Pique          <xsl:otherwise>
137*84e872a0SLloyd Pique            <para />
138*84e872a0SLloyd Pique          </xsl:otherwise>
139*84e872a0SLloyd Pique        </xsl:choose>
140*84e872a0SLloyd Pique        <xsl:if test="sectiondef/memberdef[@kind='function' and @static='no']">
141*84e872a0SLloyd Pique          <variablelist>
142*84e872a0SLloyd Pique            <xsl:apply-templates select="sectiondef/memberdef" />
143*84e872a0SLloyd Pique          </variablelist>
144*84e872a0SLloyd Pique        </xsl:if>
145*84e872a0SLloyd Pique    </section>
146*84e872a0SLloyd Pique</xsl:template>
147*84e872a0SLloyd Pique</xsl:stylesheet>
148