mirror of
https://github.com/systemd/systemd.git
synced 2024-12-22 17:35:35 +03:00
man: use xinclude to de-deduplicate common text
I only tested with python-lxml. I'm not sure if xml.etree should be deprecated.
This commit is contained in:
parent
f366d58dc1
commit
21ac6ff143
@ -4645,7 +4645,7 @@ if ENABLE_MANPAGES
|
||||
man/custom-entities.ent:
|
||||
$(AM_V_GEN)$(MKDIR_P) $(dir $@)
|
||||
$(AM_V_GEN)(echo '<?xml version="1.0" encoding="utf-8" ?>' && \
|
||||
echo '$(subst '|,<!ENTITY ,$(subst =, ",$(subst |',">,$(substitutions))))') \
|
||||
printf '$(subst '|,<!ENTITY ,$(subst =, ",$(subst |',">\n,$(substitutions))))') \
|
||||
> $@ # '
|
||||
|
||||
DISTCLEANFILES += \
|
||||
@ -4653,6 +4653,7 @@ DISTCLEANFILES += \
|
||||
|
||||
XSLTPROC_FLAGS = \
|
||||
--nonet \
|
||||
--xinclude \
|
||||
--stringparam man.output.quietly 1 \
|
||||
--stringparam funcsynopsis.style ansi \
|
||||
--stringparam man.authors.section.enabled 0 \
|
||||
|
@ -21,7 +21,8 @@
|
||||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<refentry id="journalctl">
|
||||
<refentry id="journalctl"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
|
||||
<refentryinfo>
|
||||
<title>journalctl</title>
|
||||
@ -875,25 +876,7 @@
|
||||
failure code is returned.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Environment</title>
|
||||
|
||||
<variablelist class='environment-variables'>
|
||||
<varlistentry>
|
||||
<term><varname>$SYSTEMD_PAGER</varname></term>
|
||||
<listitem><para>Pager to use when
|
||||
<option>--no-pager</option> is not given;
|
||||
overrides <varname>$PAGER</varname>. Setting
|
||||
this to an empty string or the value
|
||||
<literal>cat</literal> is equivalent to passing
|
||||
<option>--no-pager</option>.</para></listitem>
|
||||
<term><varname>$SYSTEMD_LESS</varname></term>
|
||||
<listitem><para><varname>$SYSTEMD_LESS</varname> overrides the
|
||||
default options passed to <literal>less</literal>
|
||||
(<literal>FRSXMK</literal>).</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
<xi:include href="less-variables.xml" />
|
||||
|
||||
<refsect1>
|
||||
<title>Examples</title>
|
||||
|
29
man/less-variables.xml
Normal file
29
man/less-variables.xml
Normal file
@ -0,0 +1,29 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
|
||||
|
||||
<refsect1>
|
||||
<title>Environment</title>
|
||||
|
||||
<variablelist class='environment-variables'>
|
||||
<varlistentry>
|
||||
<term><varname>$SYSTEMD_PAGER</varname></term>
|
||||
|
||||
<listitem><para>Pager to use when
|
||||
<option>--no-pager</option> is not given;
|
||||
overrides <varname>$PAGER</varname>. Setting
|
||||
this to an empty string or the value
|
||||
<literal>cat</literal> is equivalent to passing
|
||||
<option>--no-pager</option>.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>$SYSTEMD_LESS</varname></term>
|
||||
|
||||
<listitem><para>Override the default
|
||||
options passed to
|
||||
<command>less</command>
|
||||
(<literal>FRSXMK</literal>).</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
@ -21,7 +21,8 @@
|
||||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<refentry id="localectl" conditional='ENABLE_LOCALED'>
|
||||
<refentry id="localectl" conditional='ENABLE_LOCALED'
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
|
||||
<refentryinfo>
|
||||
<title>localectl</title>
|
||||
@ -253,25 +254,7 @@
|
||||
code otherwise.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Environment</title>
|
||||
|
||||
<variablelist class='environment-variables'>
|
||||
<varlistentry>
|
||||
<term><varname>$SYSTEMD_PAGER</varname></term>
|
||||
<listitem><para>Pager to use when
|
||||
<option>--no-pager</option> is not given;
|
||||
overrides <varname>$PAGER</varname>. Setting
|
||||
this to an empty string or the value
|
||||
<literal>cat</literal> is equivalent to passing
|
||||
<option>--no-pager</option>.</para></listitem>
|
||||
<term><varname>$SYSTEMD_LESS</varname></term>
|
||||
<listitem><para><varname>$SYSTEMD_LESS</varname> overrides the
|
||||
default options passed to <literal>less</literal>
|
||||
(<literal>FRSXMK</literal>).</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
<xi:include href="less-variables.xml" />
|
||||
|
||||
<refsect1>
|
||||
<title>See Also</title>
|
||||
|
@ -21,7 +21,8 @@
|
||||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<refentry id="loginctl" conditional='ENABLE_LOGIND'>
|
||||
<refentry id="loginctl" conditional='ENABLE_LOGIND'
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
|
||||
<refentryinfo>
|
||||
<title>loginctl</title>
|
||||
@ -474,25 +475,7 @@
|
||||
code otherwise.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Environment</title>
|
||||
|
||||
<variablelist class='environment-variables'>
|
||||
<varlistentry>
|
||||
<term><varname>$SYSTEMD_PAGER</varname></term>
|
||||
<listitem><para>Pager to use when
|
||||
<option>--no-pager</option> is not given;
|
||||
overrides <varname>$PAGER</varname>. Setting
|
||||
this to an empty string or the value
|
||||
<literal>cat</literal> is equivalent to passing
|
||||
<option>--no-pager</option>.</para></listitem>
|
||||
<term><varname>$SYSTEMD_LESS</varname></term>
|
||||
<listitem><para><varname>$SYSTEMD_LESS</varname> overrides the
|
||||
default options passed to <literal>less</literal>
|
||||
(<literal>FRSXMK</literal>).</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
<xi:include href="less-variables.xml" />
|
||||
|
||||
<refsect1>
|
||||
<title>See Also</title>
|
||||
|
@ -21,7 +21,8 @@
|
||||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<refentry id="machinectl" conditional='ENABLE_MACHINED'>
|
||||
<refentry id="machinectl" conditional='ENABLE_MACHINED'
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
|
||||
<refentryinfo>
|
||||
<title>machinectl</title>
|
||||
@ -299,25 +300,7 @@
|
||||
code otherwise.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Environment</title>
|
||||
|
||||
<variablelist class='environment-variables'>
|
||||
<varlistentry>
|
||||
<term><varname>$SYSTEMD_PAGER</varname></term>
|
||||
<listitem><para>Pager to use when
|
||||
<option>--no-pager</option> is not given;
|
||||
overrides <varname>$PAGER</varname>. Setting
|
||||
this to an empty string or the value
|
||||
<literal>cat</literal> is equivalent to passing
|
||||
<option>--no-pager</option>.</para></listitem>
|
||||
<term><varname>$SYSTEMD_LESS</varname></term>
|
||||
<listitem><para><varname>$SYSTEMD_LESS</varname> overrides the
|
||||
default options passed to <literal>less</literal>
|
||||
(<literal>FRSXMK</literal>).</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
<xi:include href="less-variables.xml" />
|
||||
|
||||
<refsect1>
|
||||
<title>See Also</title>
|
||||
|
@ -21,7 +21,8 @@ You should have received a copy of the GNU Lesser General Public License
|
||||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<refentry id="systemctl">
|
||||
<refentry id="systemctl"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
|
||||
<refentryinfo>
|
||||
<title>systemctl</title>
|
||||
@ -1465,27 +1466,7 @@ kobject-uevent 1 systemd-udevd-kernel.socket systemd-udevd.service
|
||||
code otherwise.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Environment</title>
|
||||
|
||||
<variablelist class='environment-variables'>
|
||||
<varlistentry>
|
||||
<term><varname>$SYSTEMD_PAGER</varname></term>
|
||||
|
||||
<listitem>
|
||||
<para>Pager to use when <option>--no-pager</option> is not
|
||||
given; overrides <varname>$PAGER</varname>. Setting this to
|
||||
an empty string or the value <literal>cat</literal> is
|
||||
equivalent to passing
|
||||
<option>--no-pager</option>.</para>
|
||||
</listitem>
|
||||
<term><varname>$SYSTEMD_LESS</varname></term>
|
||||
<listitem><para><varname>$SYSTEMD_LESS</varname> overrides the
|
||||
default options passed to <literal>less</literal>
|
||||
(<literal>FRSXMK</literal>).</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
<xi:include href="less-variables.xml" />
|
||||
|
||||
<refsect1>
|
||||
<title>See Also</title>
|
||||
|
@ -21,7 +21,8 @@
|
||||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<refentry id="systemd-analyze">
|
||||
<refentry id="systemd-analyze"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
|
||||
<refentryinfo>
|
||||
<title>systemd-analyze</title>
|
||||
@ -321,27 +322,7 @@ $ eog targets.svg</programlisting>
|
||||
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Environment</title>
|
||||
|
||||
<variablelist class='environment-variables'>
|
||||
<varlistentry>
|
||||
<term><varname>$SYSTEMD_PAGER</varname></term>
|
||||
|
||||
<listitem>
|
||||
<para>Pager to use when <option>--no-pager</option> is not
|
||||
given; overrides <varname>$PAGER</varname>. Setting this to
|
||||
an empty string or the value <literal>cat</literal> is
|
||||
equivalent to passing
|
||||
<option>--no-pager</option>.</para>
|
||||
</listitem>
|
||||
<term><varname>$SYSTEMD_LESS</varname></term>
|
||||
<listitem><para><varname>$SYSTEMD_LESS</varname> overrides the
|
||||
default options passed to <literal>less</literal>
|
||||
(<literal>FRSXMK</literal>).</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
<xi:include href="less-variables.xml" />
|
||||
|
||||
<refsect1>
|
||||
<title>See Also</title>
|
||||
|
@ -21,7 +21,8 @@
|
||||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<refentry id="timedatectl" conditional='ENABLE_TIMEDATED'>
|
||||
<refentry id="timedatectl" conditional='ENABLE_TIMEDATED'
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
|
||||
<refentryinfo>
|
||||
<title>timedatectl</title>
|
||||
@ -227,25 +228,7 @@
|
||||
code otherwise.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Environment</title>
|
||||
|
||||
<variablelist class='environment-variables'>
|
||||
<varlistentry>
|
||||
<term><varname>$SYSTEMD_PAGER</varname></term>
|
||||
<listitem><para>Pager to use when
|
||||
<option>--no-pager</option> is not given;
|
||||
overrides <varname>$PAGER</varname>. Setting
|
||||
this to an empty string or the value
|
||||
<literal>cat</literal> is equivalent to passing
|
||||
<option>--no-pager</option>.</para></listitem>
|
||||
<term><varname>$SYSTEMD_LESS</varname></term>
|
||||
<listitem><para><varname>$SYSTEMD_LESS</varname> overrides the
|
||||
default options passed to <literal>less</literal>
|
||||
(<literal>FRSXMK</literal>).</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
<xi:include href="less-variables.xml" />
|
||||
|
||||
<refsect1>
|
||||
<title>Examples</title>
|
||||
|
@ -17,19 +17,23 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from lxml import etree as tree
|
||||
|
||||
class CustomResolver(tree.Resolver):
|
||||
def resolve(self, url, id, context):
|
||||
if 'custom-entities.ent' in url:
|
||||
return self.resolve_filename('man/custom-entities.ent', context)
|
||||
|
||||
try:
|
||||
from lxml import etree as tree
|
||||
|
||||
class CustomResolver(tree.Resolver):
|
||||
def resolve(self, url, id, context):
|
||||
if 'custom-entities.ent' in url:
|
||||
return self.resolve_filename('man/custom-entities.ent', context)
|
||||
|
||||
_parser = tree.XMLParser()
|
||||
_parser.resolvers.add(CustomResolver())
|
||||
xml_parse = lambda page: tree.parse(page, _parser)
|
||||
xml_print = lambda xml: tree.tostring(xml, pretty_print=True,
|
||||
encoding='utf-8')
|
||||
def xml_parse(page):
|
||||
doc = tree.parse(page, _parser)
|
||||
doc.xinclude()
|
||||
return doc
|
||||
def xml_print(xml):
|
||||
return tree.tostring(xml, pretty_print=True, encoding='utf-8')
|
||||
|
||||
except ImportError:
|
||||
import xml.etree.ElementTree as tree
|
||||
import re as _re
|
||||
|
Loading…
Reference in New Issue
Block a user