Include common options in the manpages using some XInclude hackery

This commit is contained in:
Eelco Dolstra 2012-04-06 21:45:00 +02:00
parent d49ef039dd
commit 998b977ede
6 changed files with 54 additions and 25 deletions

View file

@ -1,5 +1,5 @@
XMLLINT = $(xmllint) $(xmlflags) XMLLINT = $(xmllint) --nonet $(xmlflags)
XSLTPROC = $(xsltproc) $(xmlflags) \ XSLTPROC = $(xsltproc) --nonet $(xmlflags) \
--param section.autolabel 1 \ --param section.autolabel 1 \
--param section.label.includes.component.label 1 \ --param section.label.includes.component.label 1 \
--param html.stylesheet \'style.css\' \ --param html.stylesheet \'style.css\' \
@ -34,24 +34,36 @@ MANUAL_SRCS = manual.xml introduction.xml installation.xml \
conf-file.xml release-notes.xml \ conf-file.xml release-notes.xml \
style.css images style.css images
# Do XInclude processing.
manual.xmli: $(MANUAL_SRCS) version.txt
$(XMLLINT) --xinclude $< -o $@.tmp
mv $@.tmp $@
# Note: RelaxNG validation requires xmllint >= 2.7.4. # Note: RelaxNG validation requires xmllint >= 2.7.4.
manual.is-valid: $(MANUAL_SRCS) version.txt manual.is-valid: manual.xmli
$(XMLLINT) --noout --nonet --xinclude --noxincludenode --relaxng $(docbookrng)/docbook.rng $< $(XSLTPROC) --novalid --stringparam profile.condition manual \
$(docbookxsl)/profiling/profile.xsl $< 2> /dev/null | \
$(XMLLINT) --noout --relaxng $(docbookrng)/docbook.rng -
touch $@ touch $@
version.txt: version.txt:
echo -n $(VERSION) > version.txt echo -n $(VERSION) > version.txt
man $(MANS): $(MANUAL_SRCS) manual.is-valid man $(MANS): manual.is-valid
$(XSLTPROC) --nonet --xinclude $(docbookxsl)/manpages/docbook.xsl manual.xml $(XSLTPROC) --stringparam profile.condition manpage \
$(docbookxsl)/profiling/profile.xsl manual.xmli 2> /dev/null | \
$(XSLTPROC) $(docbookxsl)/manpages/docbook.xsl -
manual.html: $(MANUAL_SRCS) manual.is-valid images manual.html: $(MANUAL_SRCS) manual.is-valid images
$(XSLTPROC) --nonet --xinclude --output manual.html \ $(XSLTPROC) --xinclude --stringparam profile.condition manual \
$(docbookxsl)/html/docbook.xsl manual.xml $(docbookxsl)/profiling/profile.xsl manual.xml | \
$(XSLTPROC) --output manual.html $(docbookxsl)/html/docbook.xsl -
manual.pdf: $(MANUAL_SRCS) manual.is-valid images manual.pdf: $(MANUAL_SRCS) manual.is-valid images
if test "$(dblatex)" != ""; then \ if test "$(dblatex)" != ""; then \
$(dblatex) $(dblatex_opts) manual.xml; \ $(XSLTPROC) --xinclude --stringparam profile.condition manual \
$(docbookxsl)/profiling/profile.xsl manual.xml | \
$(dblatex) -o manual.pdf $(dblatex_opts) -; \
else \ else \
echo "Please install dblatex and rerun configure."; \ echo "Please install dblatex and rerun configure."; \
exit 1; \ exit 1; \
@ -64,12 +76,12 @@ NEWS_OPTS = \
--stringparam header.rule 0 --stringparam header.rule 0
NEWS.html: release-notes.xml NEWS.html: release-notes.xml
$(XSLTPROC) --nonet --xinclude --output $@ $(NEWS_OPTS) \ $(XSLTPROC) --xinclude --output $@ $(NEWS_OPTS) \
$(docbookxsl)/html/docbook.xsl release-notes.xml $(docbookxsl)/html/docbook.xsl release-notes.xml
NEWS.txt: release-notes.xml NEWS.txt: release-notes.xml
$(XSLTPROC) --nonet --xinclude quote-literals.xsl release-notes.xml | \ $(XSLTPROC) --xinclude quote-literals.xsl release-notes.xml | \
$(XSLTPROC) --nonet --output $@.tmp.html $(NEWS_OPTS) \ $(XSLTPROC) --output $@.tmp.html $(NEWS_OPTS) \
$(docbookxsl)/html/docbook.xsl - $(docbookxsl)/html/docbook.xsl -
LANG=en_US $(w3m) -dump $@.tmp.html > $@ LANG=en_US $(w3m) -dump $@.tmp.html > $@
rm $@.tmp.html rm $@.tmp.html

View file

@ -75,11 +75,11 @@ or renamed. So dont rename the symlink.</para></warning>
<refsection><title>Options</title> <refsection><title>Options</title>
<para>See also <xref linkend="sec-common-options" />. All options not <para>All options not listed here are passed to <command>nix-store
listed here are passed to <command>nix-store --realise</command>, --realise</command>, except for <option>--arg</option> and
except for <option>--arg</option> and <option>--attr</option> / <option>--attr</option> / <option>-A</option> which are passed to
<option>-A</option> which are passed to <command>nix-instantiate</command>. <phrase condition="manual">See
<command>nix-instantiate</command>.</para> also <xref linkend="sec-common-options" />.</phrase></para>
<variablelist> <variablelist>
@ -122,6 +122,10 @@ except for <option>--arg</option> and <option>--attr</option> /
</variablelist> </variablelist>
<variablelist condition="manpage">
<xi:include href="opt-common.xml#xmlns(db=http://docbook.org/ns/docbook)xpointer(//db:variablelist[@xml:id='opt-common']/*)" />
</variablelist>
</refsection> </refsection>

View file

@ -18,7 +18,7 @@
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>nix-env</command> <command>nix-env</command>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="opt-common-syn.xml#xmlns(db=http://docbook.org/ns/docbook)xpointer(/db:nop/*)" /> <xi:include href="opt-common-syn.xml#xmlns(db=http://docbook.org/ns/docbook)xpointer(/db:nop/*)" />
<arg><option>--arg</option> <replaceable>name</replaceable> <replaceable>value</replaceable></arg> <arg><option>--arg</option> <replaceable>name</replaceable> <replaceable>value</replaceable></arg>
<arg><option>--argstr</option> <replaceable>name</replaceable> <replaceable>value</replaceable></arg> <arg><option>--argstr</option> <replaceable>name</replaceable> <replaceable>value</replaceable></arg>
<arg> <arg>
@ -71,8 +71,8 @@ be performed. These are documented below.</para>
<para>This section lists the options that are common to all <para>This section lists the options that are common to all
operations. These options are allowed for every subcommand, though operations. These options are allowed for every subcommand, though
they may not always have an effect. See also <xref they may not always have an effect. <phrase condition="manual">See
linkend="sec-common-options" />.</para> also <xref linkend="sec-common-options" />.</phrase></para>
<variablelist> <variablelist>
@ -131,6 +131,10 @@ linkend="sec-common-options" />.</para>
</variablelist> </variablelist>
<variablelist condition="manpage">
<xi:include href="opt-common.xml#xmlns(db=http://docbook.org/ns/docbook)xpointer(//db:variablelist[@xml:id='opt-common']/*)" />
</variablelist>
</refsection> </refsection>

View file

@ -64,8 +64,8 @@ store derivation instantiation from Nix expressions automatically).
It is most commonly used for implementing new deployment It is most commonly used for implementing new deployment
policies.</para> policies.</para>
<para>See also <xref linkend="sec-common-options" /> for a list of <para condition="manual">See also <xref linkend="sec-common-options"
common options.</para> /> for a list of common options.</para>
</refsection> </refsection>
@ -127,6 +127,10 @@ common options.</para>
</variablelist> </variablelist>
<variablelist condition="manpage">
<xi:include href="opt-common.xml#xmlns(db=http://docbook.org/ns/docbook)xpointer(//db:variablelist[@xml:id='opt-common']/*)" />
</variablelist>
</refsection> </refsection>

View file

@ -48,8 +48,9 @@ be performed. These are documented below.</para>
<para>This section lists the options that are common to all <para>This section lists the options that are common to all
operations. These options are allowed for every subcommand, though operations. These options are allowed for every subcommand, though
they may not always have an effect. See also <xref they may not always have an effect. <phrase condition="manual">See
linkend="sec-common-options" /> for a list of common options.</para> also <xref linkend="sec-common-options" /> for a list of common
options.</phrase></para>
<variablelist> <variablelist>
@ -112,6 +113,10 @@ lrwxrwxrwx 1 ... 2005-03-13 21:10 /home/eelco/bla/result -> /nix/store/1r1134
</variablelist> </variablelist>
<variablelist condition="manpage">
<xi:include href="opt-common.xml#xmlns(db=http://docbook.org/ns/docbook)xpointer(//db:variablelist[@xml:id='opt-common']/*)" />
</variablelist>
</refsection> </refsection>

View file

@ -5,7 +5,7 @@
<para>Most Nix commands accept the following command-line options:</para> <para>Most Nix commands accept the following command-line options:</para>
<variablelist> <variablelist xml:id="opt-common">
<varlistentry><term><option>--help</option></term> <varlistentry><term><option>--help</option></term>