Skip to content
This repository was archived by the owner on Jul 2, 2019. It is now read-only.

Commit 50d9bbb

Browse files
tmzullingergitster
authored andcommitted
Documentation: Avoid use of xmlto --stringparam
The --stringparam option is not available on older xmlto versions. Instead, set man.base.url.for.relative.links via a .xsl file. Older docbook versions will ignore this without causing grief to users of older xmlto versions. Signed-off-by: Todd Zullinger <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 165ca62 commit 50d9bbb

File tree

3 files changed

+23
-11
lines changed

3 files changed

+23
-11
lines changed

Documentation/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ gitman.info
88
howto-index.txt
99
doc.dep
1010
cmds-*.txt
11+
manpage-base-url.xsl

Documentation/Makefile

+12-11
Original file line numberDiff line numberDiff line change
@@ -104,18 +104,15 @@ XMLTO_EXTRA += -m manpage-suppress-sp.xsl
104104
endif
105105

106106
# Newer DocBook stylesheet emits warning cruft in the output when
107-
# this is not set, and if set it shows an absolute link. We can
108-
# use MAN_BASE_URL=http://www.kernel.org/pub/software/scm/git/docs/
109-
# but distros may want to set it to /usr/share/doc/git-core/docs/ or
110-
# something like that.
107+
# this is not set, and if set it shows an absolute link. Older
108+
# stylesheets simply ignore this parameter.
111109
#
112-
# As older stylesheets simply ignore this parameter, it ought to be
113-
# safe to set it to empty string when the base URL is not specified,
114-
# but unfortunately we cannot do so unconditionally because at least
115-
# xmlto 0.0.18 is reported to lack --stringparam option.
116-
ifdef MAN_BASE_URL
117-
XMLTO_EXTRA += --stringparam man.base.url.for.relative.links=$(MAN_BASE_URL)
110+
# Distros may want to use MAN_BASE_URL=file:///path/to/git/docs/
111+
# or similar.
112+
ifndef MAN_BASE_URL
113+
MAN_BASE_URL = file://$(htmldir)/
118114
endif
115+
XMLTO_EXTRA += -m manpage-base-url.xsl
119116

120117
# If your target system uses GNU groff, it may try to render
121118
# apostrophes as a "pretty" apostrophe using unicode. This breaks
@@ -244,14 +241,18 @@ clean:
244241
$(RM) howto-index.txt howto/*.html doc.dep
245242
$(RM) technical/api-*.html technical/api-index.txt
246243
$(RM) $(cmds_txt) *.made
244+
$(RM) manpage-base-url.xsl
247245

248246
$(MAN_HTML): %.html : %.txt
249247
$(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
250248
$(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
251249
$(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $< && \
252250
mv $@+ $@
253251

254-
%.1 %.5 %.7 : %.xml
252+
manpage-base-url.xsl: manpage-base-url.xsl.in
253+
sed "s|@@MAN_BASE_URL@@|$(MAN_BASE_URL)|" $< > $@
254+
255+
%.1 %.5 %.7 : %.xml manpage-base-url.xsl
255256
$(QUIET_XMLTO)$(RM) $@ && \
256257
xmlto -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
257258

Documentation/manpage-base-url.xsl.in

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!-- manpage-base-url.xsl:
2+
special settings for manpages rendered from newer docbook -->
3+
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4+
version="1.0">
5+
6+
<!-- set a base URL for relative links -->
7+
<xsl:param name="man.base.url.for.relative.links"
8+
>@@MAN_BASE_URL@@</xsl:param>
9+
10+
</xsl:stylesheet>

0 commit comments

Comments
 (0)