The nmd library is an external library for generating Nix-centric documentation.wip/yesman
parent
35752e07fa
commit
eb0ccf7286
@ -1,239 +0,0 @@ |
||||
<?xml version="1.0"?> |
||||
|
||||
<xsl:stylesheet version="1.0" |
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
||||
xmlns:str="http://exslt.org/strings" |
||||
xmlns:xlink="http://www.w3.org/1999/xlink" |
||||
xmlns="http://docbook.org/ns/docbook" |
||||
extension-element-prefixes="str" |
||||
> |
||||
|
||||
<xsl:output method='xml' encoding="UTF-8" /> |
||||
|
||||
<xsl:param name="revision" /> |
||||
<xsl:param name="program" /> |
||||
|
||||
|
||||
<xsl:template match="/expr/list"> |
||||
<appendix> |
||||
<title>Configuration Options</title> |
||||
<variablelist xml:id="configuration-variable-list"> |
||||
<xsl:for-each select="attrs"> |
||||
<xsl:variable name="id" select="concat('opt-', str:replace(str:replace(str:replace(str:replace(attr[@name = 'name']/string/@value, '*', '_'), '<', '_'), '>', '_'), '?', '_'))" /> |
||||
<varlistentry> |
||||
<term xlink:href="#{$id}"> |
||||
<xsl:attribute name="xml:id"><xsl:value-of select="$id"/></xsl:attribute> |
||||
<option> |
||||
<xsl:value-of select="attr[@name = 'name']/string/@value" /> |
||||
</option> |
||||
</term> |
||||
|
||||
<listitem> |
||||
|
||||
<para> |
||||
<xsl:value-of disable-output-escaping="yes" |
||||
select="attr[@name = 'description']/string/@value" /> |
||||
</para> |
||||
|
||||
<xsl:if test="attr[@name = 'type']"> |
||||
<para> |
||||
<emphasis>Type:</emphasis> |
||||
<xsl:text> </xsl:text> |
||||
<xsl:value-of select="attr[@name = 'type']/string/@value"/> |
||||
<xsl:if test="attr[@name = 'readOnly']/bool/@value = 'true'"> |
||||
<xsl:text> </xsl:text> |
||||
<emphasis>(read only)</emphasis> |
||||
</xsl:if> |
||||
</para> |
||||
</xsl:if> |
||||
|
||||
<xsl:if test="attr[@name = 'default']"> |
||||
<para> |
||||
<emphasis>Default:</emphasis> |
||||
<xsl:text> </xsl:text> |
||||
<xsl:apply-templates select="attr[@name = 'default']" mode="top" /> |
||||
</para> |
||||
</xsl:if> |
||||
|
||||
<xsl:if test="attr[@name = 'example']"> |
||||
<para> |
||||
<emphasis>Example:</emphasis> |
||||
<xsl:text> </xsl:text> |
||||
<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> |
||||
<xsl:apply-templates select="attr[@name = 'example']" mode="top" /> |
||||
</xsl:otherwise> |
||||
</xsl:choose> |
||||
</para> |
||||
</xsl:if> |
||||
|
||||
<xsl:if test="attr[@name = 'relatedPackages']"> |
||||
<para> |
||||
<emphasis>Related packages:</emphasis> |
||||
<xsl:text> </xsl:text> |
||||
<xsl:value-of disable-output-escaping="yes" |
||||
select="attr[@name = 'relatedPackages']/string/@value" /> |
||||
</para> |
||||
</xsl:if> |
||||
|
||||
<xsl:if test="count(attr[@name = 'declarations']/list/*) != 0"> |
||||
<para> |
||||
<emphasis>Declared by:</emphasis> |
||||
</para> |
||||
<xsl:apply-templates select="attr[@name = 'declarations']" /> |
||||
</xsl:if> |
||||
|
||||
<xsl:if test="count(attr[@name = 'definitions']/list/*) != 0"> |
||||
<para> |
||||
<emphasis>Defined by:</emphasis> |
||||
</para> |
||||
<xsl:apply-templates select="attr[@name = 'definitions']" /> |
||||
</xsl:if> |
||||
|
||||
</listitem> |
||||
|
||||
</varlistentry> |
||||
|
||||
</xsl:for-each> |
||||
|
||||
</variablelist> |
||||
</appendix> |
||||
</xsl:template> |
||||
|
||||
|
||||
<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> |
||||
|
||||
|
||||
<xsl:template match="null"> |
||||
<xsl:text>null</xsl:text> |
||||
</xsl:template> |
||||
|
||||
|
||||
<xsl:template match="string"> |
||||
<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> |
||||
<xsl:text>"</xsl:text><xsl:value-of select="str:replace(str:replace(str:replace(str:replace(@value, '\', '\\'), '"', '\"'), '
', '\n'), '$', '\$')" /><xsl:text>"</xsl:text> |
||||
</xsl:otherwise> |
||||
</xsl:choose> |
||||
</xsl:template> |
||||
|
||||
|
||||
<xsl:template match="int"> |
||||
<xsl:value-of select="@value" /> |
||||
</xsl:template> |
||||
|
||||
|
||||
<xsl:template match="bool[@value = 'true']"> |
||||
<xsl:text>true</xsl:text> |
||||
</xsl:template> |
||||
|
||||
|
||||
<xsl:template match="bool[@value = 'false']"> |
||||
<xsl:text>false</xsl:text> |
||||
</xsl:template> |
||||
|
||||
|
||||
<xsl:template match="list"> |
||||
[ |
||||
<xsl:for-each select="*"> |
||||
<xsl:apply-templates select="." /> |
||||
<xsl:text> </xsl:text> |
||||
</xsl:for-each> |
||||
] |
||||
</xsl:template> |
||||
|
||||
|
||||
<xsl:template match="attrs[attr[@name = '_type' and string[@value = 'literalExample']]]"> |
||||
<xsl:value-of select="attr[@name = 'text']/string/@value" /> |
||||
</xsl:template> |
||||
|
||||
|
||||
<xsl:template match="attrs"> |
||||
{ |
||||
<xsl:for-each select="attr"> |
||||
<xsl:value-of select="@name" /> |
||||
<xsl:text> = </xsl:text> |
||||
<xsl:apply-templates select="*" /><xsl:text>; </xsl:text> |
||||
</xsl:for-each> |
||||
} |
||||
</xsl:template> |
||||
|
||||
|
||||
<xsl:template match="derivation"> |
||||
<replaceable>(build of <xsl:value-of select="attr[@name = 'name']/string/@value" />)</replaceable> |
||||
</xsl:template> |
||||
|
||||
<xsl:template match="attr[@name = 'declarations' or @name = 'definitions']"> |
||||
<simplelist> |
||||
<xsl:for-each select="list/string"> |
||||
<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> |
||||
<xsl:when test="not(starts-with(@value, '/'))"> |
||||
<xsl:choose> |
||||
<xsl:when test="$program = 'home-manager'"> |
||||
<xsl:attribute name="xlink:href">https://github.com/rycee/home-manager/blob/<xsl:value-of select="$revision"/>/<xsl:value-of select="@value"/>#blob-path</xsl:attribute> |
||||
</xsl:when> |
||||
<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> |
||||
</xsl:when> |
||||
<xsl:when test="$revision != 'local' and $program = '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> |
||||
</xsl:when> |
||||
<xsl:otherwise> |
||||
<xsl:attribute name="xlink:href">file://<xsl:value-of select="@value"/></xsl:attribute> |
||||
</xsl:otherwise> |
||||
</xsl:choose> |
||||
<!-- Print the filename and make it user-friendly by replacing the |
||||
/nix/store/<hash> prefix by the default location of nixos |
||||
sources. --> |
||||
<xsl:choose> |
||||
<xsl:when test="$program = 'home-manager'"> |
||||
<home-manager/<xsl:value-of select="@value"/>> |
||||
</xsl:when> |
||||
<xsl:when test="not(starts-with(@value, '/'))"> |
||||
<nixpkgs/<xsl:value-of select="@value"/>> |
||||
</xsl:when> |
||||
<xsl:when test="contains(@value, 'nixops') and contains(@value, '/nix/')"> |
||||
<nixops/<xsl:value-of select="substring-after(@value, '/nix/')"/>> |
||||
</xsl:when> |
||||
<xsl:otherwise> |
||||
<xsl:value-of select="@value" /> |
||||
</xsl:otherwise> |
||||
</xsl:choose> |
||||
</filename></member> |
||||
</xsl:for-each> |
||||
</simplelist> |
||||
</xsl:template> |
||||
|
||||
|
||||
<xsl:template match="function"> |
||||
<xsl:text>λ</xsl:text> |
||||
</xsl:template> |
||||
|
||||
|
||||
</xsl:stylesheet> |
@ -1,9 +0,0 @@ |
||||
.docbook .xref img[src^=images\/callouts\/], |
||||
.screen img, |
||||
.programlisting img { |
||||
width: 1em; |
||||
} |
||||
|
||||
.calloutlist img { |
||||
width: 1.5em; |
||||
} |
@ -1,271 +0,0 @@ |
||||
/* Copied from http://bakefile.sourceforge.net/, which appears |
||||
licensed under the GNU GPL. */ |
||||
|
||||
|
||||
/*************************************************************************** |
||||
Basic headers and text: |
||||
***************************************************************************/ |
||||
|
||||
body |
||||
{ |
||||
font-family: "Nimbus Sans L", sans-serif; |
||||
background: white; |
||||
margin: 2em 1em 2em 1em; |
||||
} |
||||
|
||||
h1, h2, h3, h4 |
||||
{ |
||||
color: #005aa0; |
||||
} |
||||
|
||||
h1 /* title */ |
||||
{ |
||||
font-size: 200%; |
||||
} |
||||
|
||||
h2 /* chapters, appendices, subtitle */ |
||||
{ |
||||
font-size: 180%; |
||||
} |
||||
|
||||
/* Extra space between chapters, appendices. */ |
||||
div.chapter > div.titlepage h2, div.appendix > div.titlepage h2 |
||||
{ |
||||
margin-top: 1.5em; |
||||
} |
||||
|
||||
div.section > div.titlepage h2 /* sections */ |
||||
{ |
||||
font-size: 150%; |
||||
margin-top: 1.5em; |
||||
} |
||||
|
||||
h3 /* subsections */ |
||||
{ |
||||
font-size: 125%; |
||||
} |
||||
|
||||
div.simplesect h2 |
||||
{ |
||||
font-size: 110%; |
||||
} |
||||
|
||||
div.appendix h3 |
||||
{ |
||||
font-size: 150%; |
||||
margin-top: 1.5em; |
||||
} |
||||
|
||||
div.refnamediv h2, div.refsynopsisdiv h2, div.refsection h2 /* refentry parts */ |
||||
{ |
||||
margin-top: 1.4em; |
||||
font-size: 125%; |
||||
} |
||||
|
||||
div.refsection h3 |
||||
{ |
||||
font-size: 110%; |
||||
} |
||||
|
||||
|
||||
/*************************************************************************** |
||||
Examples: |
||||
***************************************************************************/ |
||||
|
||||
div.example |
||||
{ |
||||
border: 1px solid #b0b0b0; |
||||
padding: 6px 6px; |
||||
margin-left: 1.5em; |
||||
margin-right: 1.5em; |
||||
background: #f4f4f8; |
||||
border-radius: 0.4em; |
||||
box-shadow: 0.4em 0.4em 0.5em #e0e0e0; |
||||
} |
||||
|
||||
div.example p.title |
||||
{ |
||||
margin-top: 0em; |
||||
} |
||||
|
||||
div.example pre |
||||
{ |
||||
box-shadow: none; |
||||
} |
||||
|
||||
|
||||
/*************************************************************************** |
||||
Screen dumps: |
||||
***************************************************************************/ |
||||
|
||||
pre.screen, pre.programlisting |
||||
{ |
||||
border: 1px solid #b0b0b0; |
||||
padding: 3px 3px; |
||||
margin-left: 1.5em; |
||||
margin-right: 1.5em; |
||||
|
||||
background: #f4f4f8; |
||||
font-family: monospace; |
||||
border-radius: 0.4em; |
||||
box-shadow: 0.4em 0.4em 0.5em #e0e0e0; |
||||
} |
||||
|
||||
div.example pre.programlisting |
||||
{ |
||||
border: 0px; |
||||
padding: 0 0; |
||||
margin: 0 0 0 0; |
||||
} |
||||
|
||||
/*************************************************************************** |
||||
Notes, warnings etc: |
||||
***************************************************************************/ |
||||
|
||||
.note, .warning |
||||
{ |
||||
border: 1px solid #b0b0b0; |
||||
padding: 3px 3px; |
||||
margin-left: 1.5em; |
||||
margin-right: 1.5em; |
||||
margin-bottom: 1em; |
||||
padding: 0.3em 0.3em 0.3em 0.3em; |
||||
background: #fffff5; |
||||
border-radius: 0.4em; |
||||
box-shadow: 0.4em 0.4em 0.5em #e0e0e0; |
||||
} |
||||
|
||||
div.note, div.warning |
||||
{ |
||||
font-style: italic; |
||||
} |
||||
|
||||
div.note h3, div.warning h3 |
||||
{ |
||||
color: red; |
||||
font-size: 100%; |
||||
padding-right: 0.5em; |
||||
display: inline; |
||||
} |
||||
|
||||
div.note p, div.warning p |
||||
{ |
||||
margin-bottom: 0em; |
||||
} |
||||
|
||||
div.note h3 + p, div.warning h3 + p |
||||
{ |
||||
display: inline; |
||||
} |
||||
|
||||
div.note h3 |
||||
{ |
||||
color: blue; |
||||
font-size: 100%; |
||||
} |
||||
|
||||
div.navfooter * |
||||
{ |
||||
font-size: 90%; |
||||
} |
||||
|
||||
|
||||
/*************************************************************************** |
||||
Links colors and highlighting: |
||||
***************************************************************************/ |
||||
|
||||
a { text-decoration: none; } |
||||
a:hover { text-decoration: underline; } |
||||
a:link { color: #0048b3; } |
||||
a:visited { color: #002a6a; } |
||||
|
||||
|
||||
/*************************************************************************** |
||||
Table of contents: |
||||
***************************************************************************/ |
||||
|
||||
div.toc |
||||
{ |
||||
font-size: 90%; |
||||
} |
||||
|
||||
div.toc dl |
||||
{ |
||||
margin-top: 0em; |
||||
margin-bottom: 0em; |
||||
} |
||||
|
||||
|
||||
/*************************************************************************** |
||||
Special elements: |
||||
***************************************************************************/ |
||||
|
||||
tt, code |
||||
{ |
||||
color: #400000; |
||||
} |
||||
|
||||
.term |
||||
{ |
||||
font-weight: bold; |
||||
|
||||
} |
||||
|
||||
div.variablelist dd p, div.glosslist dd p |
||||
{ |
||||
margin-top: 0em; |
||||
} |
||||
|
||||
div.variablelist dd, div.glosslist dd |
||||
{ |
||||
margin-left: 1.5em; |
||||
} |
||||
|
||||
div.glosslist dt |
||||
{ |
||||
font-style: italic; |
||||
} |
||||
|
||||
.varname |
||||
{ |
||||
color: #400000; |
||||
} |
||||
|
||||
span.command strong |
||||
{ |
||||
font-weight: normal; |
||||
color: #400000; |
||||
} |
||||
|
||||
div.calloutlist table |
||||
{ |
||||
box-shadow: none; |
||||
} |
||||
|
||||
table |
||||
{ |
||||
border-collapse: collapse; |
||||
box-shadow: 0.4em 0.4em 0.5em #e0e0e0; |
||||
} |
||||
|
||||
table.simplelist |
||||
{ |
||||
text-align: left; |
||||
color: #005aa0; |
||||
border: 0; |
||||
padding: 5px; |
||||
background: #fffff5; |
||||
font-weight: normal; |
||||
font-style: italic; |
||||
box-shadow: none; |
||||
margin-bottom: 1em; |
||||
} |
||||
|
||||
div.navheader table, div.navfooter table { |
||||
box-shadow: none; |
||||
} |
||||
|
||||
div.affiliation |
||||
{ |
||||
font-style: italic; |
||||
} |
Loading…
Reference in new issue