]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
man: add specifiers section to directives index
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 7 May 2020 12:59:24 +0000 (14:59 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 7 May 2020 12:59:24 +0000 (14:59 +0200)
The hack with getparent().txt is not very pretty, but the whole
thing seems to work well enough. It is useful to figure out whihc
specifiers are supported where.

man/directives-template.xml
man/systemd.dnssd.xml
man/systemd.unit.xml
man/sysusers.d.xml
man/tmpfiles.d.xml
tools/make-directive-index.py

index 3583db3ef07d1b53245a7b7493f2973f3857ea1a..5ab0beb4cfa88937e3372548c20e67d8535f71e6 100644 (file)
     <variablelist id='miscellaneous' />
   </refsect1>
 
+  <refsect1>
+    <title>Specifiers</title>
+
+    <para>Short strings which are substituted in configuration directives.</para>
+
+    <variablelist id='specifiers' />
+  </refsect1>
+
   <refsect1>
     <title>Files and directories</title>
 
index 9e11677bde4365b4ac5f20e06987336b701588e0..2fb0a8ee7067b2924adfa876fca8a94f64375a9a 100644 (file)
@@ -75,7 +75,7 @@
             <para>An instance name of the network service as defined in the section 4.1.1 of <ulink
             url="https://tools.ietf.org/html/rfc6763">RFC 6763</ulink>, e.g. <literal>webserver</literal>.</para>
             <para>The option supports simple specifier expansion. The following expansions are understood:</para>
-            <table>
+            <table class='specifiers'>
               <title>Specifiers available</title>
               <tgroup cols='3' align='left' colsep='1' rowsep='1'>
                 <colspec colname="spec" />
index 999a13c56075ee4a187914c985c1b91e1f957f68..dd6d6af21d57db44705603a3f89324652f591b54 100644 (file)
     and resolvable for the setting to be valid. The following
     specifiers are understood:</para>
 
-    <table>
+    <table class='specifiers'>
       <title>Specifiers available in unit files</title>
       <tgroup cols='3' align='left' colsep='1' rowsep='1'>
         <colspec colname="spec" />
         </thead>
         <tbody>
           <row>
-            <!-- We do not use the common definition from standard-specifiers.xml here since it includes a reference onto our own man page, which would make the rendered version self-referential. -->
+            <!-- We do not use the common definition from standard-specifiers.xml here since it includes a
+                 reference onto our own man page, which would make the rendered version self-referential. -->
             <entry><literal>%a</literal></entry>
             <entry>Architecture</entry>
             <entry>A short string identifying the architecture of the local system. A string such as <constant>x86</constant>, <constant>x86-64</constant> or <constant>arm64</constant>. See the architectures defined for <varname>ConditionArchitecture=</varname> above for a full list.</entry>
 Note that this setting is <emphasis>not</emphasis> influenced by the <varname>User=</varname> setting configurable in the [Service] section of the service unit.</entry>
           </row>
           <row>
-            <!-- We do not use the common definition from standard-specifiers.xml here since we want a slightly more verbose explanation here, referring to the reload cycle. -->
+            <!-- We do not use the common definition from standard-specifiers.xml here since we want a
+                 slightly more verbose explanation here, referring to the reload cycle. -->
             <entry><literal>%H</literal></entry>
             <entry>Host name</entry>
             <entry>The hostname of the running system at the point in time the unit configuration is loaded.</entry>
index 46e860ee5031d56e7e75c1439352e3303ebd8f4d..5a71d911c45442143d5c13c72c9e55bc6ee97b48 100644 (file)
@@ -237,7 +237,7 @@ r     -        500-900
     <para>Specifiers can be used in the "Name", "ID", "GECOS", "Home directory", and "Shell" fields.
     An unknown or unresolvable specifier is treated as invalid configuration.
     The following expansions are understood:</para>
-      <table>
+      <table class='specifiers'>
         <title>Specifiers available</title>
         <tgroup cols='3' align='left' colsep='1' rowsep='1'>
           <colspec colname="spec" />
index f45dfe0a539dfa3ad2f9d3d6b7bc5bd82fd0aed7..2e9ba5fe90c23814f9265c1a4414da4d981c5810 100644 (file)
@@ -618,7 +618,7 @@ w- /proc/sys/vm/swappiness - - - - 10</programlisting></para>
     <para>Specifiers can be used in the "path" and "argument" fields.
     An unknown or unresolvable specifier is treated as invalid configuration.
     The following expansions are understood:</para>
-      <table>
+      <table class='specifiers'>
         <title>Specifiers available</title>
         <tgroup cols='3' align='left' colsep='1' rowsep='1'>
           <colspec colname="spec" />
index 26561a245635a1374c27ceaa96bbd69802dab971..c6b2173b2e9908a6dd1a90017d96ddc291ae6bee 100755 (executable)
@@ -87,6 +87,15 @@ def _extract_directives(directive_groups, formatting, page):
         storfile[name.text].append((pagename, section))
         formatting[name.text] = name
 
+    storfile = directive_groups['specifiers']
+    for name in t.iterfind(".//table[@class='specifiers']//entry/literal"):
+        if name.text[0] != '%' or name.getparent().text is not None:
+            continue
+        if name.attrib.get('index') == 'false':
+            continue
+        storfile[name.text].append((pagename, section))
+        formatting[name.text] = name
+
 def _make_section(template, name, directives, formatting):
     varlist = template.find(".//*[@id='{}']".format(name))
     for varname, manpages in sorted(directives.items()):