diff options
author | Graham Christensen <graham@grahamc.com> | 2018-10-02 15:59:59 -0400 |
---|---|---|
committer | Graham Christensen <graham@grahamc.com> | 2018-10-02 15:59:59 -0400 |
commit | c07ba7c8560250d1b184698e6453b6d5ca11846f (patch) | |
tree | 231574c29ded6e00e53c1211869ed16c5b2003d1 /doc/functions/generators.xml | |
parent | 444e04b98571ad65269c8a988c4a9f772ca616a2 (diff) | |
download | nixlib-c07ba7c8560250d1b184698e6453b6d5ca11846f.tar nixlib-c07ba7c8560250d1b184698e6453b6d5ca11846f.tar.gz nixlib-c07ba7c8560250d1b184698e6453b6d5ca11846f.tar.bz2 nixlib-c07ba7c8560250d1b184698e6453b6d5ca11846f.tar.lz nixlib-c07ba7c8560250d1b184698e6453b6d5ca11846f.tar.xz nixlib-c07ba7c8560250d1b184698e6453b6d5ca11846f.tar.zst nixlib-c07ba7c8560250d1b184698e6453b6d5ca11846f.zip |
nixpkgs docs: Reformat
Diffstat (limited to 'doc/functions/generators.xml')
-rw-r--r-- | doc/functions/generators.xml | 73 |
1 files changed, 36 insertions, 37 deletions
diff --git a/doc/functions/generators.xml b/doc/functions/generators.xml index 0a9c346145f9..e860b10e8979 100644 --- a/doc/functions/generators.xml +++ b/doc/functions/generators.xml @@ -2,33 +2,32 @@ xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xml:id="sec-generators"> - <title>Generators</title> + <title>Generators</title> - <para> - Generators are functions that create file formats from nix data structures, - e. g. for configuration files. There are generators available for: - <literal>INI</literal>, <literal>JSON</literal> and <literal>YAML</literal> - </para> + <para> + Generators are functions that create file formats from nix data structures, + e. g. for configuration files. There are generators available for: + <literal>INI</literal>, <literal>JSON</literal> and <literal>YAML</literal> + </para> - <para> - All generators follow a similar call interface: <code>generatorName - configFunctions data</code>, where <literal>configFunctions</literal> is an - attrset of user-defined functions that format nested parts of the content. - They each have common defaults, so often they do not need to be set - manually. An example is <code>mkSectionName ? (name: libStr.escape [ "[" "]" - ] name)</code> from the <literal>INI</literal> generator. It receives the - name of a section and sanitizes it. The default - <literal>mkSectionName</literal> escapes <literal>[</literal> and - <literal>]</literal> with a backslash. - </para> + <para> + All generators follow a similar call interface: <code>generatorName + configFunctions data</code>, where <literal>configFunctions</literal> is an + attrset of user-defined functions that format nested parts of the content. + They each have common defaults, so often they do not need to be set manually. + An example is <code>mkSectionName ? (name: libStr.escape [ "[" "]" ] + name)</code> from the <literal>INI</literal> generator. It receives the name + of a section and sanitizes it. The default <literal>mkSectionName</literal> + escapes <literal>[</literal> and <literal>]</literal> with a backslash. + </para> - <para> - Generators can be fine-tuned to produce exactly the file format required by - your application/service. One example is an INI-file format which uses - <literal>: </literal> as separator, the strings - <literal>"yes"</literal>/<literal>"no"</literal> as boolean values and - requires all string values to be quoted: - </para> + <para> + Generators can be fine-tuned to produce exactly the file format required by + your application/service. One example is an INI-file format which uses + <literal>: </literal> as separator, the strings + <literal>"yes"</literal>/<literal>"no"</literal> as boolean values and + requires all string values to be quoted: + </para> <programlisting> with lib; @@ -60,9 +59,9 @@ in customToINI { } </programlisting> - <para> - This will produce the following INI file as nix string: - </para> + <para> + This will produce the following INI file as nix string: + </para> <programlisting> [main] @@ -76,15 +75,15 @@ str\:ange:"very::strange" merge:"diff3" </programlisting> - <note> - <para> - Nix store paths can be converted to strings by enclosing a derivation - attribute like so: <code>"${drv}"</code>. - </para> - </note> - + <note> <para> - Detailed documentation for each generator can be found in - <literal>lib/generators.nix</literal>. + Nix store paths can be converted to strings by enclosing a derivation + attribute like so: <code>"${drv}"</code>. </para> - </section> + </note> + + <para> + Detailed documentation for each generator can be found in + <literal>lib/generators.nix</literal>. + </para> +</section> |