~ubuntu-branches/ubuntu/hardy/pygobject/hardy

« back to all changes in this revision

Viewing changes to docs/xsl/html.xsl

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2006-08-05 12:08:23 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20060805120823-bzr4wfj03o79zqc9
Tags: 2.11.1-0ubuntu1
* New upstream version:
  - Add John Finlay's reference manual 
  - Fix GOption mem leak 
  - Infrastructure for lazy type registration
  - Enum/Flags fixes
  - Eliminate some GCC warnings
* debian/control.in:
  - Build-Depends on xsltproc, docbook-xsl
  - create a python-gobject-doc package
* debian/python-gobject-doc.install:
  - create a python-gobject-doc package

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version='1.0'?>
 
2
<!DOCTYPE xsl:stylesheet [
 
3
<!ENTITY RE "&#10;">
 
4
<!ENTITY nbsp "&#160;">
 
5
]>
 
6
 
 
7
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 
8
                version='1.0'>
 
9
 
 
10
<xsl:param name="shade.verbatim" select="1"/>
 
11
<xsl:param name="use.id.as.filename" select="1"/>
 
12
<xsl:param name="chunk.fast" select="1"/>
 
13
<xsl:param name="chunker.output.encoding" select="'utf-8'"/>
 
14
 
 
15
<xsl:attribute-set name="shade.verbatim.style">
 
16
  <xsl:attribute name="border">0</xsl:attribute>
 
17
  <xsl:attribute name="bgcolor">#E0E0E0</xsl:attribute>
 
18
  <xsl:attribute name="width">100%</xsl:attribute>
 
19
</xsl:attribute-set>
 
20
 
 
21
<xsl:param name="linenumbering.extension" select="1"/>
 
22
<xsl:param name="variablelist.as.table" select="1"/>
 
23
 
 
24
<xsl:template match="blockquote">
 
25
  <div class="{local-name(.)}">
 
26
    <xsl:if test="@lang or @xml:lang">
 
27
      <xsl:call-template name="language.attribute"/>
 
28
    </xsl:if>
 
29
    <xsl:call-template name="anchor"/>
 
30
 
 
31
    <xsl:choose>
 
32
      <xsl:when test="attribution">
 
33
        <table border="0" width="100%"
 
34
               cellspacing="0" cellpadding="0" class="blockquote"
 
35
               summary="Block quote">
 
36
          <tr>
 
37
            <td width="10%" valign="top">&#160;</td>
 
38
            <td width="80%" valign="top">
 
39
              <xsl:apply-templates select="child::*[local-name(.)!='attribution']"/>
 
40
            </td>
 
41
            <td width="10%" valign="top">&#160;</td>
 
42
          </tr>
 
43
          <tr>
 
44
            <td colspan="2" align="right" valign="top">
 
45
              <xsl:text>--</xsl:text>
 
46
              <xsl:apply-templates select="attribution"/>
 
47
            </td>
 
48
            <td width="10%" valign="top">&#160;</td>
 
49
          </tr>
 
50
        </table>
 
51
      </xsl:when>
 
52
      <xsl:when test="@role = 'properties' or @role = 'prototypes'">
 
53
        <xsl:choose>
 
54
          <xsl:when test="$shade.verbatim != 0">
 
55
            <table width="100%" xsl:use-attribute-sets="shade.verbatim.style">
 
56
              <tr>
 
57
                <td valign="top">
 
58
                  <xsl:apply-templates select="child::*[local-name(.)!='attribution']"/>
 
59
                </td>
 
60
              </tr>
 
61
            </table>
 
62
          </xsl:when>
 
63
          <xsl:otherwise>
 
64
            <table width="100%" border="0">
 
65
              <tr>
 
66
                <td valign="top">
 
67
                  <xsl:apply-templates select="child::*[local-name(.)!='attribution']"/>
 
68
                </td>
 
69
              </tr>
 
70
            </table>
 
71
          </xsl:otherwise>
 
72
        </xsl:choose>
 
73
      </xsl:when>
 
74
      <xsl:otherwise>
 
75
        <blockquote class="{local-name(.)}">
 
76
          <xsl:apply-templates/>
 
77
        </blockquote>
 
78
      </xsl:otherwise>
 
79
    </xsl:choose>
 
80
  </div>
 
81
</xsl:template>
 
82
 
 
83
  <!-- support for Python language for synopsises -->
 
84
  <xsl:template match="classsynopsis
 
85
                     |fieldsynopsis
 
86
                     |methodsynopsis
 
87
                     |constructorsynopsis
 
88
                     |destructorsynopsis">
 
89
    <xsl:param name="language">
 
90
      <xsl:choose>
 
91
        <xsl:when test="@language">
 
92
          <xsl:value-of select="@language"/>
 
93
        </xsl:when>
 
94
        <xsl:otherwise>
 
95
          <xsl:value-of select="$default-classsynopsis-language"/>
 
96
        </xsl:otherwise>
 
97
      </xsl:choose>
 
98
    </xsl:param>
 
99
    <xsl:choose>
 
100
      <xsl:when test="$language='python'">
 
101
        <xsl:apply-templates select="." mode="python"/>
 
102
      </xsl:when>
 
103
      <xsl:otherwise>
 
104
        <xsl:apply-imports/>
 
105
      </xsl:otherwise>
 
106
    </xsl:choose>
 
107
  </xsl:template>
 
108
 
 
109
  <xsl:template match="classsynopsis" mode="python">
 
110
    <table bgcolor="#D0E0F0" width="100%">
 
111
      <tr><td>
 
112
    <pre class="{name(.)}">
 
113
      <xsl:text>class </xsl:text>
 
114
      <xsl:apply-templates select="ooclass[1]" mode="python"/>
 
115
      <xsl:if test="ooclass[position() &gt; 1]">
 
116
        <xsl:text>(</xsl:text>
 
117
        <xsl:apply-templates select="ooclass[position() &gt; 1]" mode="python"/>        <xsl:text>)</xsl:text>
 
118
      </xsl:if>
 
119
      <xsl:text>:&RE;</xsl:text>
 
120
 
 
121
      <xsl:apply-templates select="constructorsynopsis
 
122
                                   |destructorsynopsis
 
123
                                   |fieldsynopsis
 
124
                                   |methodsynopsis
 
125
                                   |classsynopsisinfo" mode="python"/>
 
126
    </pre></td></tr></table>
 
127
  </xsl:template>
 
128
 
 
129
  <xsl:template match="classsynopsisinfo" mode="python">
 
130
    <xsl:apply-templates mode="python"/>
 
131
  </xsl:template>
 
132
 
 
133
  <xsl:template match="ooclass|oointerface|ooexception" mode="python">
 
134
    <xsl:if test="position() &gt; 1">
 
135
      <xsl:text>, </xsl:text>
 
136
    </xsl:if>
 
137
    <span class="{name(.)}">
 
138
      <xsl:apply-templates mode="python"/>
 
139
    </span>
 
140
  </xsl:template>
 
141
 
 
142
  <xsl:template match="modifier" mode="python">
 
143
    <span class="{name(.)}">
 
144
      <xsl:apply-templates mode="python"/>
 
145
      <xsl:text>&nbsp;</xsl:text>
 
146
    </span>
 
147
  </xsl:template>
 
148
 
 
149
  <xsl:template match="classname" mode="python">
 
150
    <xsl:if test="name(preceding-sibling::*[1]) = 'classname'">
 
151
      <xsl:text>, </xsl:text>
 
152
    </xsl:if>
 
153
    <span class="{name(.)}">
 
154
      <xsl:apply-templates mode="python"/>
 
155
    </span>
 
156
  </xsl:template>
 
157
 
 
158
  <xsl:template match="interfacename" mode="python">
 
159
    <xsl:if test="name(preceding-sibling::*[1]) = 'interfacename'">
 
160
      <xsl:text>, </xsl:text>
 
161
    </xsl:if>
 
162
    <span class="{name(.)}">
 
163
      <xsl:apply-templates mode="python"/>
 
164
    </span>
 
165
  </xsl:template>
 
166
 
 
167
  <xsl:template match="exceptionname" mode="python">
 
168
    <xsl:if test="name(preceding-sibling::*[1]) = 'exceptionname'">
 
169
      <xsl:text>, </xsl:text>
 
170
    </xsl:if>
 
171
    <span class="{name(.)}">
 
172
      <xsl:apply-templates mode="python"/>
 
173
    </span>
 
174
  </xsl:template>
 
175
 
 
176
  <xsl:template match="fieldsynopsis" mode="python">
 
177
    <code class="{name(.)}">
 
178
      <xsl:text>&nbsp;&nbsp;&nbsp;&nbsp;</xsl:text>
 
179
      <xsl:apply-templates mode="python"/>
 
180
    </code>
 
181
    <xsl:call-template name="synop-break"/>
 
182
  </xsl:template>
 
183
 
 
184
  <xsl:template match="type" mode="python">
 
185
    <span class="{name(.)}">
 
186
      <xsl:apply-templates mode="python"/>
 
187
      <xsl:text>&nbsp;</xsl:text>
 
188
    </span>
 
189
  </xsl:template>
 
190
 
 
191
  <xsl:template match="varname" mode="python">
 
192
    <span class="{name(.)}">
 
193
      <xsl:apply-templates mode="python"/>
 
194
      <xsl:text>&nbsp;</xsl:text>
 
195
    </span>
 
196
  </xsl:template>
 
197
 
 
198
  <xsl:template match="initializer" mode="python">
 
199
    <span class="{name(.)}">
 
200
      <xsl:text>=</xsl:text>
 
201
      <xsl:apply-templates mode="python"/>
 
202
    </span>
 
203
  </xsl:template>
 
204
 
 
205
  <xsl:template match="void" mode="python">
 
206
    <span class="{name(.)}">
 
207
      <xsl:text>void&nbsp;</xsl:text>
 
208
    </span>
 
209
  </xsl:template>
 
210
 
 
211
  <xsl:template match="methodname" mode="python">
 
212
    <span class="{name(.)}">
 
213
      <xsl:apply-templates mode="python"/>
 
214
    </span>
 
215
  </xsl:template>
 
216
 
 
217
  <xsl:template match="methodparam" mode="python">
 
218
    <xsl:if test="position() &gt; 1">
 
219
      <xsl:text>, </xsl:text>
 
220
    </xsl:if>
 
221
    <span class="{name(.)}">
 
222
      <xsl:apply-templates mode="python"/>
 
223
    </span>
 
224
  </xsl:template>
 
225
 
 
226
 <xsl:template mode="python"
 
227
    match="destructorsynopsis|methodsynopsis">
 
228
 
 
229
    <code class="{name(.)}">
 
230
      <xsl:text>    def </xsl:text>
 
231
      <xsl:apply-templates select="methodname" mode="python"/>
 
232
      <xsl:text>(</xsl:text>
 
233
      <xsl:apply-templates select="methodparam" mode="python"/>
 
234
      <xsl:text>)</xsl:text>
 
235
    </code>
 
236
    <xsl:call-template name="synop-break"/>
 
237
  </xsl:template>
 
238
 
 
239
 <xsl:template mode="python"
 
240
    match="constructorsynopsis">
 
241
 
 
242
    <code class="{name(.)}">
 
243
      <xsl:text>    </xsl:text>
 
244
      <xsl:apply-templates select="methodname" mode="python"/>
 
245
      <xsl:text>(</xsl:text>
 
246
      <xsl:apply-templates select="methodparam" mode="python"/>
 
247
      <xsl:text>)</xsl:text>
 
248
    </code>
 
249
    <xsl:call-template name="synop-break"/>
 
250
  </xsl:template>
 
251
 
 
252
<!-- this was  the original parameter python mode styling
 
253
  <xsl:template match="parameter" mode="python">
 
254
    <span class="{name(.)}">
 
255
      <xsl:apply-templates mode="python"/>
 
256
    </span>
 
257
  </xsl:template>
 
258
-->
 
259
 
 
260
  <!-- hack -->
 
261
  <xsl:template match="link" mode="python">
 
262
    <xsl:apply-templates select="."/>
 
263
  </xsl:template>
 
264
 
 
265
  <!-- ========================================================= -->
 
266
  <!-- template to output gtkdoclink elements for the unknown targets -->
 
267
 
 
268
  <xsl:template match="link">
 
269
    <xsl:choose>
 
270
      <xsl:when test="id(@linkend)">
 
271
        <xsl:apply-imports/>
 
272
      </xsl:when>
 
273
      <xsl:otherwise>
 
274
        <PYGTKDOCLINK HREF="{@linkend}">
 
275
          <xsl:apply-templates/>
 
276
        </PYGTKDOCLINK>
 
277
      </xsl:otherwise>
 
278
    </xsl:choose>
 
279
  </xsl:template>
 
280
 
 
281
 <xsl:template match="parameter" mode="python">
 
282
    <span class="{name(.)}">
 
283
        <xsl:choose>
 
284
                <xsl:when test="@role = 'keyword'">
 
285
                        <xsl:call-template name="inline.boldmonoseq"/>
 
286
                </xsl:when>
 
287
                <xsl:otherwise>
 
288
                        <xsl:call-template name="inline.italicmonoseq"/>
 
289
                </xsl:otherwise>
 
290
        </xsl:choose>
 
291
    </span>
 
292
</xsl:template>
 
293
 
 
294
<xsl:template match="variablelist">
 
295
  <table border="0" width="100%" bgcolor="#FFECCE">
 
296
    <col align="left" valign="top" width="0*">
 
297
    </col>
 
298
    <tbody>
 
299
      <xsl:apply-templates select="varlistentry" mode="varlist-table"/>
 
300
    </tbody>
 
301
  </table>
 
302
</xsl:template>
 
303
 
 
304
</xsl:stylesheet>