Manual: Render multi-line strings properly

This commit is contained in:
Eelco Dolstra 2013-10-29 17:29:37 +01:00
parent bfaa6b7352
commit 0695b68c8c
4 changed files with 28 additions and 14 deletions

View file

@ -40,7 +40,7 @@
<para> <para>
<emphasis>Default:</emphasis> <emphasis>Default:</emphasis>
<xsl:text> </xsl:text> <xsl:text> </xsl:text>
<literal><xsl:apply-templates select="attr[@name = 'default']" /></literal> <xsl:apply-templates select="attr[@name = 'default']" mode="top" />
</para> </para>
</xsl:if> </xsl:if>
@ -53,7 +53,7 @@
<programlisting><xsl:value-of select="attr[@name = 'example']/attrs/attr[@name = 'text']/string/@value" /></programlisting> <programlisting><xsl:value-of select="attr[@name = 'example']/attrs/attr[@name = 'text']/string/@value" /></programlisting>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<literal><xsl:apply-templates select="attr[@name = 'example']" /></literal> <xsl:apply-templates select="attr[@name = 'example']" mode="top" />
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</para> </para>
@ -84,6 +84,20 @@
</xsl:template> </xsl:template>
<xsl:template match="*" mode="top">
<xsl:choose>
<xsl:when test="string[contains(@value, '&#010;')]">
<programlisting>
<xsl:text>''
</xsl:text><xsl:value-of select='str:replace(string/@value, "${", "&apos;&apos;${")' /><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:template match="null">
<xsl:text>null</xsl:text> <xsl:text>null</xsl:text>
</xsl:template> </xsl:template>

View file

@ -99,10 +99,10 @@ in
extraOptions = mkOption { extraOptions = mkOption {
default = ""; default = "";
example = " example = ''
gc-keep-outputs = true gc-keep-outputs = true
gc-keep-derivations = true gc-keep-derivations = true
"; '';
description = "Additional text appended to <filename>nix.conf</filename>."; description = "Additional text appended to <filename>nix.conf</filename>.";
}; };

View file

@ -15,7 +15,7 @@ let
authoritative; authoritative;
ddns-update-style ad-hoc; ddns-update-style ad-hoc;
log-facility local1; # see dhcpd.nix log-facility local1; # see dhcpd.nix
${cfg.extraConfig} ${cfg.extraConfig}
${pkgs.lib.concatMapStrings ${pkgs.lib.concatMapStrings
@ -30,13 +30,13 @@ let
''; '';
in in
{ {
###### interface ###### interface
options = { options = {
services.dhcpd = { services.dhcpd = {
enable = mkOption { enable = mkOption {
@ -48,16 +48,16 @@ in
extraConfig = mkOption { extraConfig = mkOption {
default = ""; default = "";
example = " example = ''
option subnet-mask 255.255.255.0; option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255; option broadcast-address 192.168.1.255;
option routers 192.168.1.5; option routers 192.168.1.5;
option domain-name-servers 130.161.158.4, 130.161.33.17, 130.161.180.1; option domain-name-servers 130.161.158.4, 130.161.33.17, 130.161.180.1;
option domain-name \"example.org\"; option domain-name "example.org";
subnet 192.168.1.0 netmask 255.255.255.0 { subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.100 192.168.1.200; range 192.168.1.100 192.168.1.200;
} }
"; '';
description = " description = "
Extra text to be appended to the DHCP server configuration Extra text to be appended to the DHCP server configuration
file. Currently, you almost certainly need to specify file. Currently, you almost certainly need to specify
@ -100,9 +100,9 @@ in
}; };
}; };
}; };
###### implementation ###### implementation
@ -127,5 +127,5 @@ in
}; };
}; };
} }

View file

@ -74,7 +74,7 @@ let cfg = config.services.xserver.synaptics; in
example = '' example = ''
Option "RTCornerButton" "2" Option "RTCornerButton" "2"
Option "RBCornerButton" "3" Option "RBCornerButton" "3"
''; '';
description = '' description = ''
Additional options for synaptics touchpad driver. Additional options for synaptics touchpad driver.
''; '';