~ubuntu-branches/ubuntu/trusty/erlang/trusty

« back to all changes in this revision

Viewing changes to lib/erl_docgen/priv/xsl/db_eix.xsl

  • Committer: Bazaar Package Importer
  • Author(s): Clint Byrum
  • Date: 2011-05-05 15:48:43 UTC
  • mfrom: (3.5.13 sid)
  • Revision ID: james.westby@ubuntu.com-20110505154843-0om6ekzg6m7ugj27
Tags: 1:14.b.2-dfsg-3ubuntu1
* Merge from debian unstable.  Remaining changes:
  - Drop libwxgtk2.8-dev build dependency. Wx isn't in main, and not
    supposed to.
  - Drop erlang-wx binary.
  - Drop erlang-wx dependency from -megaco, -common-test, and -reltool, they
    do not really need wx. Also drop it from -debugger; the GUI needs wx,
    but it apparently has CLI bits as well, and is also needed by -megaco,
    so let's keep the package for now.
  - debian/patches/series: Do what I meant, and enable build-options.patch
    instead.
* Additional changes:
  - Drop erlang-wx from -et
* Dropped Changes:
  - patches/pcre-crash.patch: CVE-2008-2371: outer level option with
    alternatives caused crash. (Applied Upstream)
  - fix for ssl certificate verification in newSSL: 
    ssl_cacertfile_fix.patch (Applied Upstream)
  - debian/patches/series: Enable native.patch again, to get stripped beam
    files and reduce the package size again. (build-options is what
    actually accomplished this)
  - Remove build-options.patch on advice from upstream and because it caused
    odd build failures.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="utf-8"?>
 
2
<!--      
 
3
     #
 
4
     # %CopyrightBegin%
 
5
     # 
 
6
     # Copyright Ericsson AB 2009-2011. All Rights Reserved.
 
7
     # 
 
8
     # The contents of this file are subject to the Erlang Public License,
 
9
     # Version 1.1, (the "License"); you may not use this file except in
 
10
     # compliance with the License. You should have received a copy of the
 
11
     # Erlang Public License along with this software. If not, it can be
 
12
     # retrieved online at http://www.erlang.org/.
 
13
     # 
 
14
     # Software distributed under the License is distributed on an "AS IS"
 
15
     # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 
16
     # the License for the specific language governing rights and limitations
 
17
     # under the License.
 
18
     # 
 
19
     # %CopyrightEnd%
 
20
     
 
21
     -->
 
22
 
 
23
<xsl:stylesheet version="1.0"
 
24
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 
25
  xmlns:fn="http://www.w3.org/2005/02/xpath-functions"> 
 
26
 
 
27
  <xsl:output method="text" encoding="UTF-8" indent="no"/>
 
28
 
 
29
  <!-- Book -->
 
30
  <xsl:template match="/book">
 
31
    <xsl:text>%% &#10;%% Search data file for </xsl:text><xsl:value-of select="$appname"/><xsl:text> </xsl:text><xsl:value-of select="$appver"/>
 
32
    <xsl:text>&#10;%% generated </xsl:text><xsl:value-of select="$gendate"/><xsl:text>&#10;%% &#10;</xsl:text>
 
33
    <xsl:apply-templates select="applications"/>
 
34
    <xsl:text>{notused, application, ["</xsl:text><xsl:value-of select="$appname"/><xsl:text>"]}.&#10;</xsl:text>
 
35
  </xsl:template>
 
36
 
 
37
  <!-- Applications -->
 
38
  <xsl:template match="applications">
 
39
    <xsl:apply-templates name="application"/>
 
40
  </xsl:template>
 
41
 
 
42
  <!-- Reference Manual -->
 
43
 
 
44
  <!-- Application -->
 
45
  <xsl:template match="application">
 
46
    <xsl:apply-templates select="erlref|cref|comref|fileref|appref"/>          
 
47
  </xsl:template>
 
48
 
 
49
  <!-- Erlref -->
 
50
  <xsl:template match="erlref">
 
51
    <xsl:text>{"</xsl:text><xsl:value-of select="module"/><xsl:text>.html", {function, {"</xsl:text><xsl:value-of select="$appname"/>
 
52
    <xsl:text>", "</xsl:text><xsl:value-of select="module"/><xsl:text>"}},&#10;[&#10;</xsl:text>
 
53
    <xsl:apply-templates select="funcs">  
 
54
      <xsl:with-param name="mod" select="module"/>
 
55
    </xsl:apply-templates>  
 
56
    <xsl:text>]}.&#10;</xsl:text>
 
57
    <xsl:text>{"</xsl:text><xsl:value-of select="module"/><xsl:text>.html", {module, "</xsl:text>
 
58
    <xsl:value-of select="$appname"/><xsl:text>"}, ["</xsl:text><xsl:value-of select="module"/><xsl:text>"]}.&#10;</xsl:text>
 
59
  </xsl:template>
 
60
 
 
61
  <!-- Cref -->
 
62
  <xsl:template match="cref">
 
63
    <xsl:text>{"</xsl:text><xsl:value-of select="lib"/><xsl:text>.html", {function, {"</xsl:text><xsl:value-of select="$appname"/>
 
64
    <xsl:text>", "</xsl:text><xsl:value-of select="lib"/><xsl:text>"}}, [&#10;</xsl:text>
 
65
    <xsl:apply-templates select="funcs">  
 
66
      <xsl:with-param name="mod" select="lib"/>
 
67
    </xsl:apply-templates>  
 
68
    <xsl:text>]}.&#10;</xsl:text>
 
69
    <xsl:text>{"</xsl:text><xsl:value-of select="lib"/><xsl:text>.html", {clib, "</xsl:text>
 
70
    <xsl:value-of select="$appname"/><xsl:text>"}, ["</xsl:text><xsl:value-of select="lib"/><xsl:text>"]}.&#10;</xsl:text>
 
71
  </xsl:template>
 
72
 
 
73
  <!-- Comref -->
 
74
  <xsl:template match="comref">
 
75
    <xsl:text>{"</xsl:text><xsl:value-of select="com"/><xsl:text>.html", {command, "</xsl:text>
 
76
    <xsl:value-of select="$appname"/><xsl:text>"}, ["</xsl:text><xsl:value-of select="com"/><xsl:text>"]}.&#10;</xsl:text>
 
77
  </xsl:template>
 
78
 
 
79
  <!-- Fileref -->
 
80
  <xsl:template match="fileref">
 
81
    <xsl:text>{"</xsl:text><xsl:value-of select="file"/><xsl:text>.html", {file, "</xsl:text>
 
82
    <xsl:value-of select="$appname"/><xsl:text>"}, ["</xsl:text><xsl:value-of select="file"/><xsl:text>"]}.&#10;</xsl:text>
 
83
  </xsl:template>
 
84
 
 
85
  <!-- Appref -->
 
86
  <xsl:template match="appref">
 
87
    <xsl:text>{"</xsl:text><xsl:value-of select="app"/><xsl:text>_app.html", {app, "</xsl:text>
 
88
    <xsl:value-of select="$appname"/><xsl:text>"}, ["</xsl:text><xsl:value-of select="app"/><xsl:text>"]}.&#10;</xsl:text>
 
89
  </xsl:template>
 
90
 
 
91
 
 
92
  <!-- Funcs -->
 
93
  <xsl:template match="funcs">
 
94
    <xsl:param name="mod"/>
 
95
    <xsl:variable name="lastfuncsblock">
 
96
      <xsl:value-of select="position() = last()"/>
 
97
    </xsl:variable>         
 
98
    <xsl:apply-templates select="func/name">
 
99
      <xsl:with-param name="mod" select="$mod"/>
 
100
      <xsl:with-param name="lastfuncsblock" select="$lastfuncsblock"/>
 
101
    </xsl:apply-templates>
 
102
  </xsl:template>
 
103
 
 
104
 
 
105
 
 
106
 
 
107
  <xsl:template match="name">
 
108
    <xsl:param name="mod"/>
 
109
    <xsl:param name="lastfuncsblock"/>
 
110
 
 
111
    <xsl:variable name="tmpstring">
 
112
      <xsl:value-of select="substring-before(substring-after(., '('), '->')"/>
 
113
    </xsl:variable>     
 
114
    <xsl:variable name="ustring">
 
115
      <xsl:choose>
 
116
        <xsl:when test="string-length($tmpstring) > 0">
 
117
          <xsl:call-template name="remove-paren">
 
118
            <xsl:with-param name="string" select="$tmpstring"/>
 
119
          </xsl:call-template>            
 
120
        </xsl:when>
 
121
        <xsl:otherwise>
 
122
          <xsl:call-template name="remove-paren">
 
123
            <xsl:with-param name="string" select="substring-after(., '(')"/>
 
124
          </xsl:call-template>                      
 
125
        </xsl:otherwise>
 
126
      </xsl:choose>
 
127
    </xsl:variable>       
 
128
    <xsl:variable name="arity">
 
129
      <xsl:call-template name="calc-arity">
 
130
        <xsl:with-param name="string" select="substring-before($ustring, ')')"/>
 
131
        <xsl:with-param name="no-of-pars" select="0"/> 
 
132
      </xsl:call-template>
 
133
    </xsl:variable> 
 
134
    <xsl:variable name="fname">
 
135
      <xsl:choose>
 
136
        <xsl:when test="ancestor::cref">
 
137
          <xsl:value-of select="substring-before(nametext, '(')"/>
 
138
        </xsl:when>
 
139
        <xsl:when test="ancestor::erlref">
 
140
          <xsl:variable name="fname1">
 
141
            <xsl:value-of select="substring-before(., '(')"/>
 
142
          </xsl:variable>
 
143
          <xsl:variable name="fname2">
 
144
            <xsl:value-of select="substring-after($fname1, 'erlang:')"/>
 
145
          </xsl:variable>
 
146
          <xsl:choose>
 
147
            <xsl:when test="string-length($fname2) > 0">   
 
148
              <xsl:value-of select="$fname2"/>
 
149
            </xsl:when>
 
150
            <xsl:otherwise>
 
151
              <xsl:value-of select="$fname1"/>
 
152
            </xsl:otherwise>
 
153
          </xsl:choose>
 
154
        </xsl:when>
 
155
      </xsl:choose>
 
156
    </xsl:variable>     
 
157
    <xsl:text>  {"</xsl:text><xsl:value-of select="$fname"/>
 
158
    <xsl:text>", "</xsl:text><xsl:value-of select="$fname"/>
 
159
    <xsl:text>(</xsl:text><xsl:value-of select="normalize-space($tmpstring)"/>
 
160
    <xsl:text>", "</xsl:text><xsl:value-of select="$fname"/>
 
161
    <xsl:text>-</xsl:text><xsl:value-of select="$arity"/><xsl:text>"}</xsl:text>
 
162
    
 
163
    <xsl:choose>
 
164
      <xsl:when test="($lastfuncsblock = 'true') and (position() = last())">
 
165
        <xsl:text>&#10;</xsl:text>
 
166
      </xsl:when>
 
167
      <xsl:otherwise>
 
168
        <xsl:text>,&#10;</xsl:text>
 
169
      </xsl:otherwise>
 
170
    </xsl:choose>
 
171
  </xsl:template>
 
172
 
 
173
 <!-- Special templates to calculate the arity of functions -->
 
174
  <xsl:template name="calc-arity">
 
175
    <xsl:param name="string"/>
 
176
    <xsl:param name="no-of-pars"/>
 
177
    <xsl:variable name="length">
 
178
      <xsl:value-of select="string-length($string)"/>
 
179
    </xsl:variable>
 
180
    <xsl:choose>
 
181
      <xsl:when test="$length > 0">
 
182
        <xsl:call-template name="calc-arity">
 
183
          <xsl:with-param name="string" select="substring-after($string, ',')"/>
 
184
          <xsl:with-param name="no-of-pars" select="$no-of-pars+1"/> 
 
185
        </xsl:call-template>        
 
186
      </xsl:when>
 
187
      <xsl:otherwise>
 
188
        <xsl:value-of select="$no-of-pars"/>
 
189
      </xsl:otherwise>
 
190
    </xsl:choose>
 
191
  </xsl:template>
 
192
 
 
193
  <xsl:template name="remove-paren">
 
194
    <xsl:param name="string"/>
 
195
 
 
196
    <xsl:variable name="str1">
 
197
      <xsl:call-template name="remove-paren-1">
 
198
        <xsl:with-param name="string" select="$string"/>
 
199
        <xsl:with-param name="start">(</xsl:with-param> 
 
200
        <xsl:with-param name="end">)</xsl:with-param> 
 
201
      </xsl:call-template>    
 
202
    </xsl:variable>
 
203
 
 
204
    <xsl:variable name="str2">
 
205
      <xsl:call-template name="remove-paren-1">
 
206
        <xsl:with-param name="string" select="$str1"/>
 
207
        <xsl:with-param name="start">{</xsl:with-param>
 
208
        <xsl:with-param name="end">}</xsl:with-param>
 
209
      </xsl:call-template>    
 
210
    </xsl:variable>
 
211
 
 
212
    <xsl:variable name="str3">
 
213
      <xsl:call-template name="remove-paren-1">
 
214
        <xsl:with-param name="string" select="$str2"/>
 
215
        <xsl:with-param name="start">[</xsl:with-param>
 
216
        <xsl:with-param name="end">]</xsl:with-param>
 
217
      </xsl:call-template>    
 
218
    </xsl:variable>
 
219
 
 
220
    <xsl:value-of select="$str3"/>
 
221
 
 
222
  </xsl:template>
 
223
 
 
224
 
 
225
  <xsl:template name="remove-paren-1">
 
226
    <xsl:param name="string"/>
 
227
    <xsl:param name="start"/>
 
228
    <xsl:param name="end"/>
 
229
   
 
230
    <xsl:variable name="tmp1">
 
231
      <xsl:value-of select="substring-before($string, $start)"/>
 
232
    </xsl:variable>
 
233
 
 
234
    <xsl:choose>
 
235
      <xsl:when test="string-length($tmp1) > 0 or starts-with($string, $start)">
 
236
        <xsl:variable name="tmp2">
 
237
          <xsl:value-of select="substring-after($string, $end)"/>
 
238
        </xsl:variable>
 
239
        <xsl:variable name="retstring">
 
240
          <xsl:call-template name="remove-paren">
 
241
            <xsl:with-param name="string" select="$tmp2"/>
 
242
          </xsl:call-template>        
 
243
        </xsl:variable>
 
244
        <xsl:value-of select="concat(concat($tmp1, 'x'), $retstring)"/>
 
245
      </xsl:when>
 
246
      <xsl:otherwise>
 
247
        <xsl:value-of select="$string"/>
 
248
      </xsl:otherwise>
 
249
    </xsl:choose>
 
250
 
 
251
  </xsl:template>
 
252
 
 
253
  <!-- default content handling -->
 
254
  <xsl:template match="text()"/>
 
255
 
 
256
</xsl:stylesheet>