2007-01-23 10:52:51 +00:00
|
|
|
|
<?xml version="1.0"?>
|
|
|
|
|
|
|
|
|
|
<xsl:stylesheet version="1.0"
|
|
|
|
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
|
|
|
xmlns:str="http://exslt.org/strings"
|
2007-01-23 11:06:31 +00:00
|
|
|
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
2007-01-23 10:52:51 +00:00
|
|
|
|
xmlns="http://docbook.org/ns/docbook"
|
|
|
|
|
extension-element-prefixes="str"
|
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
<xsl:output method='xml' encoding="UTF-8" />
|
|
|
|
|
|
2009-10-06 00:47:50 +01:00
|
|
|
|
<xsl:param name="revision" />
|
|
|
|
|
|
2013-06-18 08:34:30 +01:00
|
|
|
|
|
2007-01-23 10:52:51 +00:00
|
|
|
|
<xsl:template match="/expr/list">
|
|
|
|
|
|
|
|
|
|
<variablelist>
|
|
|
|
|
|
|
|
|
|
<xsl:for-each select="attrs">
|
2014-04-14 09:19:30 +01:00
|
|
|
|
<xsl:variable name="id" select="concat('opt-', str:replace(str:replace(str:replace(str:replace(attr[@name = 'name']/string/@value, '*', '_'), '<', '_'), '>', '_'), '?', '_'))" />
|
2007-01-23 10:52:51 +00:00
|
|
|
|
<varlistentry>
|
2014-04-14 09:19:30 +01:00
|
|
|
|
<term xlink:href="#{$id}">
|
|
|
|
|
<xsl:attribute name="xml:id"><xsl:value-of select="$id"/></xsl:attribute>
|
2014-03-08 18:33:41 +00:00
|
|
|
|
<option>
|
2014-04-14 09:23:02 +01:00
|
|
|
|
<xsl:value-of select="attr[@name = 'name']/string/@value" />
|
2014-03-08 18:33:41 +00:00
|
|
|
|
</option>
|
2007-01-23 10:52:51 +00:00
|
|
|
|
</term>
|
|
|
|
|
|
2007-01-23 11:39:02 +00:00
|
|
|
|
<listitem>
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
<xsl:value-of disable-output-escaping="yes"
|
|
|
|
|
select="attr[@name = 'description']/string/@value" />
|
|
|
|
|
</para>
|
|
|
|
|
|
2013-10-29 15:52:04 +00:00
|
|
|
|
<xsl:if test="attr[@name = 'default']">
|
|
|
|
|
<para>
|
|
|
|
|
<emphasis>Default:</emphasis>
|
|
|
|
|
<xsl:text> </xsl:text>
|
2013-10-29 16:29:37 +00:00
|
|
|
|
<xsl:apply-templates select="attr[@name = 'default']" mode="top" />
|
2013-10-29 15:52:04 +00:00
|
|
|
|
</para>
|
|
|
|
|
</xsl:if>
|
2007-01-23 11:39:02 +00:00
|
|
|
|
|
|
|
|
|
<xsl:if test="attr[@name = 'example']">
|
|
|
|
|
<para>
|
|
|
|
|
<emphasis>Example:</emphasis>
|
2009-07-14 16:47:03 +01:00
|
|
|
|
<xsl:text> </xsl:text>
|
2011-09-05 11:14:42 +01:00
|
|
|
|
<xsl:choose>
|
|
|
|
|
<xsl:when test="attr[@name = 'example']/attrs[attr[@name = '_type' and string[@value = 'literalExample']]]">
|
|
|
|
|
<programlisting><xsl:value-of select="attr[@name = 'example']/attrs/attr[@name = 'text']/string/@value" /></programlisting>
|
|
|
|
|
</xsl:when>
|
|
|
|
|
<xsl:otherwise>
|
2013-10-29 16:29:37 +00:00
|
|
|
|
<xsl:apply-templates select="attr[@name = 'example']" mode="top" />
|
2011-09-05 11:14:42 +01:00
|
|
|
|
</xsl:otherwise>
|
|
|
|
|
</xsl:choose>
|
2007-01-23 11:39:02 +00:00
|
|
|
|
</para>
|
|
|
|
|
</xsl:if>
|
2009-09-18 16:10:32 +01:00
|
|
|
|
|
|
|
|
|
<xsl:if test="count(attr[@name = 'declarations']/list/*) != 0">
|
|
|
|
|
<para>
|
|
|
|
|
<emphasis>Declared by:</emphasis>
|
|
|
|
|
</para>
|
2009-10-06 00:15:06 +01:00
|
|
|
|
<xsl:apply-templates select="attr[@name = 'declarations']" />
|
2009-09-18 16:10:32 +01:00
|
|
|
|
</xsl:if>
|
|
|
|
|
|
|
|
|
|
<xsl:if test="count(attr[@name = 'definitions']/list/*) != 0">
|
|
|
|
|
<para>
|
|
|
|
|
<emphasis>Defined by:</emphasis>
|
|
|
|
|
</para>
|
2009-10-06 00:15:06 +01:00
|
|
|
|
<xsl:apply-templates select="attr[@name = 'definitions']" />
|
2009-09-18 16:10:32 +01:00
|
|
|
|
</xsl:if>
|
2013-06-18 08:34:30 +01:00
|
|
|
|
|
2007-01-23 11:39:02 +00:00
|
|
|
|
</listitem>
|
2007-01-23 10:52:51 +00:00
|
|
|
|
|
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
|
|
</xsl:for-each>
|
|
|
|
|
|
|
|
|
|
</variablelist>
|
|
|
|
|
|
|
|
|
|
</xsl:template>
|
2007-01-23 11:39:02 +00:00
|
|
|
|
|
|
|
|
|
|
2013-10-29 16:29:37 +00:00
|
|
|
|
<xsl:template match="*" mode="top">
|
|
|
|
|
<xsl:choose>
|
|
|
|
|
<xsl:when test="string[contains(@value, '
')]">
|
|
|
|
|
<programlisting>
|
|
|
|
|
<xsl:text>''
|
|
|
|
|
</xsl:text><xsl:value-of select='str:replace(string/@value, "${", "''${")' /><xsl:text>''</xsl:text></programlisting>
|
|
|
|
|
</xsl:when>
|
|
|
|
|
<xsl:otherwise>
|
|
|
|
|
<literal><xsl:apply-templates /></literal>
|
|
|
|
|
</xsl:otherwise>
|
|
|
|
|
</xsl:choose>
|
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
|
|
|
2013-10-29 13:55:33 +00:00
|
|
|
|
<xsl:template match="null">
|
|
|
|
|
<xsl:text>null</xsl:text>
|
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
|
|
|
2007-01-23 11:39:02 +00:00
|
|
|
|
<xsl:template match="string">
|
2013-10-29 15:52:40 +00:00
|
|
|
|
<xsl:choose>
|
|
|
|
|
<xsl:when test="(contains(@value, '"') or contains(@value, '\')) and not(contains(@value, '
'))">
|
|
|
|
|
<xsl:text>''</xsl:text><xsl:value-of select='str:replace(@value, "${", "''${")' /><xsl:text>''</xsl:text>
|
|
|
|
|
</xsl:when>
|
|
|
|
|
<xsl:otherwise>
|
2013-10-29 15:54:03 +00:00
|
|
|
|
<xsl:text>"</xsl:text><xsl:value-of select="str:replace(str:replace(str:replace(str:replace(@value, '\', '\\'), '"', '\"'), '
', '\n'), '$', '\$')" /><xsl:text>"</xsl:text>
|
2013-10-29 15:52:40 +00:00
|
|
|
|
</xsl:otherwise>
|
|
|
|
|
</xsl:choose>
|
2007-01-23 11:39:02 +00:00
|
|
|
|
</xsl:template>
|
2013-06-18 08:34:30 +01:00
|
|
|
|
|
|
|
|
|
|
2007-01-23 11:39:02 +00:00
|
|
|
|
<xsl:template match="int">
|
|
|
|
|
<xsl:value-of select="@value" />
|
|
|
|
|
</xsl:template>
|
2013-06-18 08:34:30 +01:00
|
|
|
|
|
|
|
|
|
|
2007-01-23 11:39:02 +00:00
|
|
|
|
<xsl:template match="bool[@value = 'true']">
|
2007-11-21 14:39:52 +00:00
|
|
|
|
<xsl:text>true</xsl:text>
|
2007-01-23 11:39:02 +00:00
|
|
|
|
</xsl:template>
|
2013-06-18 08:34:30 +01:00
|
|
|
|
|
|
|
|
|
|
2007-01-23 11:39:02 +00:00
|
|
|
|
<xsl:template match="bool[@value = 'false']">
|
2007-11-21 14:39:52 +00:00
|
|
|
|
<xsl:text>false</xsl:text>
|
2007-01-23 11:39:02 +00:00
|
|
|
|
</xsl:template>
|
2013-06-18 08:34:30 +01:00
|
|
|
|
|
|
|
|
|
|
2007-01-23 11:39:02 +00:00
|
|
|
|
<xsl:template match="list">
|
|
|
|
|
[
|
|
|
|
|
<xsl:for-each select="*">
|
|
|
|
|
<xsl:apply-templates select="." />
|
|
|
|
|
<xsl:text> </xsl:text>
|
|
|
|
|
</xsl:for-each>
|
|
|
|
|
]
|
|
|
|
|
</xsl:template>
|
2013-06-18 08:34:30 +01:00
|
|
|
|
|
|
|
|
|
|
2013-10-23 18:46:11 +01:00
|
|
|
|
<xsl:template match="attrs[attr[@name = '_type' and string[@value = 'literalExample']]]">
|
|
|
|
|
<xsl:value-of select="attr[@name = 'text']/string/@value" />
|
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
|
|
|
2007-01-23 11:39:02 +00:00
|
|
|
|
<xsl:template match="attrs">
|
|
|
|
|
{
|
|
|
|
|
<xsl:for-each select="attr">
|
|
|
|
|
<xsl:value-of select="@name" />
|
|
|
|
|
<xsl:text> = </xsl:text>
|
2007-11-21 14:39:52 +00:00
|
|
|
|
<xsl:apply-templates select="*" /><xsl:text>; </xsl:text>
|
2007-01-23 11:39:02 +00:00
|
|
|
|
</xsl:for-each>
|
|
|
|
|
}
|
|
|
|
|
</xsl:template>
|
2013-06-18 08:34:30 +01:00
|
|
|
|
|
|
|
|
|
|
2007-01-23 11:39:02 +00:00
|
|
|
|
<xsl:template match="derivation">
|
2013-10-30 15:19:07 +00:00
|
|
|
|
<replaceable>(build of <xsl:value-of select="attr[@name = 'name']/string/@value" />)</replaceable>
|
2007-01-23 11:39:02 +00:00
|
|
|
|
</xsl:template>
|
2009-09-18 16:10:37 +01:00
|
|
|
|
|
|
|
|
|
<xsl:template match="attr[@name = 'declarations' or @name = 'definitions']">
|
2009-10-06 00:15:06 +01:00
|
|
|
|
<simplelist>
|
2009-09-18 16:10:37 +01:00
|
|
|
|
<xsl:for-each select="list/string">
|
2009-10-06 00:47:50 +01:00
|
|
|
|
<member><filename>
|
|
|
|
|
<!-- Hyperlink the filename either to the NixOS Subversion
|
|
|
|
|
repository (if it’s a module and we have a revision number),
|
|
|
|
|
or to the local filesystem. -->
|
|
|
|
|
<xsl:choose>
|
2013-10-23 18:32:19 +01:00
|
|
|
|
<xsl:when test="not(starts-with(@value, '/'))">
|
|
|
|
|
<xsl:choose>
|
|
|
|
|
<xsl:when test="$revision = 'local'">
|
|
|
|
|
<xsl:attribute name="xlink:href">https://github.com/NixOS/nixpkgs/blob/master/<xsl:value-of select="@value"/></xsl:attribute>
|
|
|
|
|
</xsl:when>
|
|
|
|
|
<xsl:otherwise>
|
|
|
|
|
<xsl:attribute name="xlink:href">https://github.com/NixOS/nixpkgs/blob/<xsl:value-of select="$revision"/>/<xsl:value-of select="@value"/></xsl:attribute>
|
|
|
|
|
</xsl:otherwise>
|
|
|
|
|
</xsl:choose>
|
2009-10-06 00:47:50 +01:00
|
|
|
|
</xsl:when>
|
2013-06-18 08:34:30 +01:00
|
|
|
|
<xsl:when test="$revision != 'local' and contains(@value, 'nixops') and contains(@value, '/nix/')">
|
|
|
|
|
<xsl:attribute name="xlink:href">https://github.com/NixOS/nixops/blob/<xsl:value-of select="$revision"/>/nix/<xsl:value-of select="substring-after(@value, '/nix/')"/></xsl:attribute>
|
2012-06-08 22:10:11 +01:00
|
|
|
|
</xsl:when>
|
2009-10-06 00:47:50 +01:00
|
|
|
|
<xsl:otherwise>
|
|
|
|
|
<xsl:attribute name="xlink:href">file://<xsl:value-of select="@value"/></xsl:attribute>
|
|
|
|
|
</xsl:otherwise>
|
|
|
|
|
</xsl:choose>
|
2009-10-06 20:07:09 +01:00
|
|
|
|
<!-- Print the filename and make it user-friendly by replacing the
|
|
|
|
|
/nix/store/<hash> prefix by the default location of nixos
|
|
|
|
|
sources. -->
|
2009-10-06 10:53:19 +01:00
|
|
|
|
<xsl:choose>
|
2013-10-23 18:32:19 +01:00
|
|
|
|
<xsl:when test="not(starts-with(@value, '/'))">
|
|
|
|
|
<nixpkgs/<xsl:value-of select="@value"/>>
|
2009-10-06 10:53:19 +01:00
|
|
|
|
</xsl:when>
|
2013-06-18 08:34:30 +01:00
|
|
|
|
<xsl:when test="contains(@value, 'nixops') and contains(@value, '/nix/')">
|
|
|
|
|
<nixops/<xsl:value-of select="substring-after(@value, '/nix/')"/>>
|
2012-06-08 22:10:11 +01:00
|
|
|
|
</xsl:when>
|
2009-10-06 10:53:19 +01:00
|
|
|
|
<xsl:otherwise>
|
|
|
|
|
<xsl:value-of select="@value" />
|
|
|
|
|
</xsl:otherwise>
|
|
|
|
|
</xsl:choose>
|
2009-10-06 00:47:50 +01:00
|
|
|
|
</filename></member>
|
2009-09-18 16:10:37 +01:00
|
|
|
|
</xsl:for-each>
|
2009-10-06 00:15:06 +01:00
|
|
|
|
</simplelist>
|
2013-06-18 08:34:30 +01:00
|
|
|
|
</xsl:template>
|
|
|
|
|
|
2014-08-09 15:21:33 +01:00
|
|
|
|
|
|
|
|
|
<xsl:template match="function">
|
|
|
|
|
<xsl:text>λ</xsl:text>
|
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
|
|
|
2007-01-23 10:52:51 +00:00
|
|
|
|
</xsl:stylesheet>
|