Skip to content

Commit 0d525a3

Browse files
committed
man: add specifiers section to directives index
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.
1 parent 2822308 commit 0d525a3

File tree

6 files changed

+25
-6
lines changed

6 files changed

+25
-6
lines changed

man/directives-template.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,14 @@
135135
<variablelist id='miscellaneous' />
136136
</refsect1>
137137

138+
<refsect1>
139+
<title>Specifiers</title>
140+
141+
<para>Short strings which are substituted in configuration directives.</para>
142+
143+
<variablelist id='specifiers' />
144+
</refsect1>
145+
138146
<refsect1>
139147
<title>Files and directories</title>
140148

man/systemd.dnssd.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
<para>An instance name of the network service as defined in the section 4.1.1 of <ulink
7676
url="https://tools.ietf.org/html/rfc6763">RFC 6763</ulink>, e.g. <literal>webserver</literal>.</para>
7777
<para>The option supports simple specifier expansion. The following expansions are understood:</para>
78-
<table>
78+
<table class='specifiers'>
7979
<title>Specifiers available</title>
8080
<tgroup cols='3' align='left' colsep='1' rowsep='1'>
8181
<colspec colname="spec" />

man/systemd.unit.xml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1695,7 +1695,7 @@
16951695
and resolvable for the setting to be valid. The following
16961696
specifiers are understood:</para>
16971697

1698-
<table>
1698+
<table class='specifiers'>
16991699
<title>Specifiers available in unit files</title>
17001700
<tgroup cols='3' align='left' colsep='1' rowsep='1'>
17011701
<colspec colname="spec" />
@@ -1710,7 +1710,8 @@
17101710
</thead>
17111711
<tbody>
17121712
<row>
1713-
<!-- 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. -->
1713+
<!-- We do not use the common definition from standard-specifiers.xml here since it includes a
1714+
reference onto our own man page, which would make the rendered version self-referential. -->
17141715
<entry><literal>%a</literal></entry>
17151716
<entry>Architecture</entry>
17161717
<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>
@@ -1740,7 +1741,8 @@
17401741
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>
17411742
</row>
17421743
<row>
1743-
<!-- 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. -->
1744+
<!-- We do not use the common definition from standard-specifiers.xml here since we want a
1745+
slightly more verbose explanation here, referring to the reload cycle. -->
17441746
<entry><literal>%H</literal></entry>
17451747
<entry>Host name</entry>
17461748
<entry>The hostname of the running system at the point in time the unit configuration is loaded.</entry>

man/sysusers.d.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ r - 500-900
237237
<para>Specifiers can be used in the "Name", "ID", "GECOS", "Home directory", and "Shell" fields.
238238
An unknown or unresolvable specifier is treated as invalid configuration.
239239
The following expansions are understood:</para>
240-
<table>
240+
<table class='specifiers'>
241241
<title>Specifiers available</title>
242242
<tgroup cols='3' align='left' colsep='1' rowsep='1'>
243243
<colspec colname="spec" />

man/tmpfiles.d.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ w- /proc/sys/vm/swappiness - - - - 10</programlisting></para>
618618
<para>Specifiers can be used in the "path" and "argument" fields.
619619
An unknown or unresolvable specifier is treated as invalid configuration.
620620
The following expansions are understood:</para>
621-
<table>
621+
<table class='specifiers'>
622622
<title>Specifiers available</title>
623623
<tgroup cols='3' align='left' colsep='1' rowsep='1'>
624624
<colspec colname="spec" />

tools/make-directive-index.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,15 @@ def _extract_directives(directive_groups, formatting, page):
8787
storfile[name.text].append((pagename, section))
8888
formatting[name.text] = name
8989

90+
storfile = directive_groups['specifiers']
91+
for name in t.iterfind(".//table[@class='specifiers']//entry/literal"):
92+
if name.text[0] != '%' or name.getparent().text is not None:
93+
continue
94+
if name.attrib.get('index') == 'false':
95+
continue
96+
storfile[name.text].append((pagename, section))
97+
formatting[name.text] = name
98+
9099
def _make_section(template, name, directives, formatting):
91100
varlist = template.find(".//*[@id='{}']".format(name))
92101
for varname, manpages in sorted(directives.items()):

0 commit comments

Comments
 (0)