/usr/share/yelp-xsl/xslt/mallard/html/mal2html-api.xsl is in yelp-xsl 3.10.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | <?xml version='1.0' encoding='UTF-8'?><!-- -*- indent-tabs-mode: nil -*- -->
<!--
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option) any
later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details.
You should have received a copy of the GNU Lesser General Public License
along with this program; see the file COPYING.LGPL. If not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:mal="http://projectmallard.org/1.0/"
xmlns:e="http://projectmallard.org/experimental/"
xmlns:api="http://projectmallard.org/experimental/api/"
xmlns:exsl="http://exslt.org/common"
xmlns:math="http://exslt.org/math"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.w3.org/1999/xhtml"
exclude-result-prefixes="mal e api exsl math html"
version="1.0">
<!--!!==========================================================================
Mallard to HTML - API Extension
Support for Mallard API extension elements.
This stylesheet contains templates to support features from the Mallard API
extension.
-->
<!--**==========================================================================
mal2html.api.links.function
Output links as a synopsis of functions.
$node: A #{links} element to link from.
$links: A list of topic links already filtered by group.
This template outputs links as a synopsis according to the programming language
specified by the #{api:mime} attribute of ${node}. If #{api:mime} is recognized,
one of the language-specific templates in this stylesheet is called. Otherwise,
the links are passed to *{mal2html.links.ul}.
This template does not handle titles or other wrapper information for #{links}
elements. It should be called by an appropriate template that handles the
#{links} element.
-->
<xsl:template name="mal2html.api.links.function">
<xsl:param name="node"/>
<xsl:param name="links"/>
<xsl:choose>
<xsl:when test="$node/@api:mime = 'text/x-csrc' or $node/@api:mime = 'text/x-chdr'">
<xsl:call-template name="mal2html.api.links.function.c">
<xsl:with-param name="node" select="$node"/>
<xsl:with-param name="links" select="$links"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="mal2html.links.ul">
<xsl:with-param name="node" select="$node"/>
<xsl:with-param name="links" select="$links"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--**==========================================================================
mal2html.api.links.function.c
Output links as a synopsis of C functions.
$node: A #{links} element to link from.
$links: A list of topic links already filtered by group.
This template outputs links as a synopsis of C functions. It is called by
*{mal2html.api.links.function} when the #{api:mime} attribute of ${node} is
#{text/x-csrc} or #{text/x-chdr}. The target nodes of ${links} are expected
to have at least an #{api:name} element. Any links whose target does not
have an #{api:name} element will be passed to *{mal2html.links.ul} after
the synopsis.
-->
<xsl:template name="mal2html.api.links.function.c">
<xsl:param name="node"/>
<xsl:param name="links"/>
<xsl:variable name="out_">
<xsl:for-each select="$links">
<xsl:sort data-type="number" select="@groupsort"/>
<xsl:sort select="mal:title[@type = 'sort']"/>
<xsl:variable name="link" select="."/>
<xsl:for-each select="$mal.cache">
<xsl:variable name="target" select="key('mal.cache.key', $link/@xref)"/>
<xsl:variable name="function" select="$target/mal:info/api:function"/>
<xsl:choose>
<xsl:when test="$function/api:name">
<api:pre>
<div class="{$link/@class}">
<xsl:for-each select="$link/@*">
<xsl:if test="starts-with(name(.), 'data-')">
<xsl:copy-of select="."/>
</xsl:if>
</xsl:for-each>
<xsl:apply-templates mode="mal2html.inline.mode" select="$function/api:returns/api:type/node()"/>
<xsl:variable name="tab" select="20 - string-length($function/api:returns/api:type)"/>
<xsl:choose>
<xsl:when test="$tab > 1">
<xsl:call-template name="utils.repeat_string">
<xsl:with-param name="string" select="' '"/>
<xsl:with-param name="number" select="$tab"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:text>
</xsl:text>
<xsl:text> </xsl:text>
</xsl:otherwise>
</xsl:choose>
<a>
<xsl:attribute name="href">
<xsl:call-template name="mal.link.target">
<xsl:with-param name="node" select="$node"/>
<xsl:with-param name="xref" select="$link/@xref"/>
</xsl:call-template>
</xsl:attribute>
<xsl:attribute name="title">
<xsl:call-template name="mal.link.tooltip">
<xsl:with-param name="node" select="$node"/>
<xsl:with-param name="xref" select="$link/@xref"/>
<!-- FIXME: role -->
</xsl:call-template>
</xsl:attribute>
<xsl:value-of select="$function/api:name"/>
</a>
<xsl:variable name="paren" select="40 - string-length($function/api:name)"/>
<xsl:choose>
<xsl:when test="$paren > 1">
<xsl:call-template name="utils.repeat_string">
<xsl:with-param name="string" select="' '"/>
<xsl:with-param name="number" select="$paren"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:text>
</xsl:text>
<xsl:text> </xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text>(</xsl:text>
<xsl:for-each select="$function/api:arg | $function/api:varargs">
<xsl:if test="position() != 1">
<xsl:text> </xsl:text>
</xsl:if>
<xsl:choose>
<xsl:when test="self::api:varargs">
<xsl:text>...</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates mode="mal2html.inline.mode" select="api:type/node()"/>
<xsl:if test="substring(api:type, string-length(api:type)) != '*'
or not(contains(api:type, ' '))">
<xsl:text> </xsl:text>
</xsl:if>
<xsl:apply-templates mode="mal2html.inline.mode" select="api:name/node()"/>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="position() != last()">
<xsl:text>,</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>);</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text>
</xsl:text>
</xsl:for-each>
<xsl:if test="not($function/api:arg or $function/api:varargs)">
<xsl:text>void);
</xsl:text>
</xsl:if>
</div>
</api:pre>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="$link"/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="out" select="exsl:node-set($out_)"/>
<xsl:if test="$out/api:pre">
<div class="synopsis">
<pre class="contents">
<xsl:copy-of select="$out/api:pre/*"/>
</pre>
</div>
</xsl:if>
<xsl:if test="$out/mal:link">
<xsl:call-template name="mal2html.links.ul">
<xsl:with-param name="node" select="$node"/>
<xsl:with-param name="links" select="$out/mal:link"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
|