<!-- * Notesources with the same earmark are assigned the same -->
<!-- * number. -->
<!-- * -->
-<!-- * By design, that index excludes any element whose whose string -->
-<!-- * value is identical to value of its url xlink:href attribute). -->
+<!-- * By design, that index excludes any element whose string value -->
+<!-- * is identical to the value of its url xlink:href attribute). -->
<!-- * -->
<!-- * 2. Puts a numbered marker inline to mark the place where the -->
<!-- * notesource occurs in the main text flow. -->
<!-- * earmarks is that we need to get and check the sets of -->
<!-- * earmarks for uniqueness per-Refentry (not per-document). -->
<!-- * -->
-<!-- * FIXME: as -->
-<!-- * with "repeat" URLS, alt instances that have the same string value -->
+<!-- * FIXME: -->
+<!-- * as with "repeat" URLS, alt instances that have the same string value -->
<!-- * as preceding ones (likely to occur for repeat acroynyms and -->
<!-- * abbreviations) should be listed only once in the endnotes list, -->
<!-- * and numbered accordingly inline; split man.indent.width into -->
</xsl:when>
<xsl:otherwise>
<!-- * otherwise, this earmark has empty content, -->
- <!-- * which means its corresponding notesources is an -->
+ <!-- * which means its corresponding notesource is an -->
<!-- * imagedata, audiodata, or videodata instance; in -->
- <!-- * that case, we use the value of the notesoures's -->
+ <!-- * that case, we use the value of the notesource's -->
<!-- * @fileref attribute (which is stored in the -->
<!-- * earmark uri attribute) as the "contents" for -->
<!-- * this endnote/notesource -->
- <xsl:value-of select="@uri"/>
+ <xsl:call-template name="display.uri">
+ <xsl:with-param name="uri" select="@uri"/>
+ </xsl:call-template>
</xsl:otherwise>
</xsl:choose>
<xsl:text> </xsl:text>
<xsl:call-template name="suppress.hyphenation"/>
<xsl:text>\%</xsl:text>
</xsl:if>
- <xsl:value-of select="@uri"/>
+ <xsl:call-template name="display.uri">
+ <xsl:with-param name="uri" select="@uri"/>
+ </xsl:call-template>
<xsl:text> </xsl:text>
<xsl:text>.RE</xsl:text>
<xsl:text> </xsl:text>
</xsl:for-each>
</xsl:template>
+<xsl:template name="display.uri">
+ <xsl:param name="uri"/>
+ <xsl:choose>
+ <xsl:when test="contains($uri, ':')">
+ <!-- * if this URI contains a colon character, it’s probably -->
+ <!-- * an absolute URI with a scheme, so we output it as-is -->
+ <xsl:value-of select="$uri"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- * otherwise this is probably not an absolute URI, so we -->
+ <!-- * need to prepend $man.base.url.for.relative.links to -->
+ <!-- * give the URI some "context" in man-page output -->
+ <xsl:value-of
+ select="concat($man.base.url.for.relative.links, $uri)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
</xsl:stylesheet>
<!ENTITY man.authors.section.enabled SYSTEM "../params/man.authors.section.enabled.xml">
<!ENTITY man.break.after.slash SYSTEM "../params/man.break.after.slash.xml">
+<!ENTITY man.base.url.for.relative.links SYSTEM "../params/man.base.url.for.relative.links.xml">
<!ENTITY man.charmap.enabled SYSTEM "../params/man.charmap.enabled.xml">
<!ENTITY man.charmap.subset.profile SYSTEM "../params/man.charmap.subset.profile.xml">
<!ENTITY man.charmap.subset.profile.english SYSTEM "../params/man.charmap.subset.profile.english.xml">
&man.endnotes.list.enabled;
&man.endnotes.list.heading;
&man.endnotes.are.numbered;
+&man.base.url.for.relative.links;
&man.links.are.underlined;
</reference>
<reference xml:id="lists">
<src:fragref linkend="man.authors.section.enabled.frag"/>
<src:fragref linkend="man.break.after.slash.frag"/>
+<src:fragref linkend="man.base.url.for.relative.links.frag"/>
<src:fragref linkend="man.charmap.enabled.frag"/>
<src:fragref linkend="man.charmap.subset.profile.frag"/>
<src:fragref linkend="man.charmap.subset.profile.english.frag"/>
--- /dev/null
+<refentry xmlns="http://docbook.org/ns/docbook"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:src="http://nwalsh.com/xmlns/litprog/fragment"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="5.0" xml:id="man.base.url.for.relative.links">
+ <refmeta>
+ <refentrytitle>man.base.url.for.relative.links</refentrytitle>
+ <refmiscinfo class="other" otherclass="datatype">string</refmiscinfo>
+ </refmeta>
+ <refnamediv>
+ <refname>man.base.url.for.relative.links</refname>
+ <refpurpose>Specifies a base URL for relative links</refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv>
+ <src:fragment xml:id="man.base.url.for.relative.links.frag"><xsl:param name="man.base.url.for.relative.links">[set $man.base.url.for.relative.links]/</xsl:param></src:fragment>
+ </refsynopsisdiv>
+
+ <refsection><info><title>Description</title></info>
+
+ <para>For any “notesource” listed in the auto-generated
+ “NOTES” section of output man pages (which is generated when
+ the value of the
+ <parameter>man.endnotes.list.enabled</parameter> parameter
+ is non-zero), if the notesource is a link source with a
+ relative URI, the URI is displayed in output with the value
+ of the
+ <parameter>man.base.url.for.relative.links</parameter>
+ parameter prepended to the value of the link URI.</para>
+
+ <note>
+ <para>A link source is an notesource that references an
+ external resource:
+ <itemizedlist>
+ <listitem>
+ <para>a <tag>ulink</tag> element with a <tag
+ class="attribute">url</tag> attribute</para>
+ </listitem>
+ <listitem>
+ <para>any element with an <tag
+ class="attribute">xlink:href</tag> attribute</para>
+ </listitem>
+ <listitem>
+ <para>an <tag>imagedata</tag>, <tag>audiodata</tag>, or
+ <tag>videodata</tag> element</para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </note>
+
+ <para>If you use relative URIs in link sources in your DocBook
+ <tag>refentry</tag> source, and you leave
+ <parameter>man.base.url.for.relative.links</parameter>
+ unset, the relative links will appear “as is” in the “Notes”
+ section of any man-page output generated from your source.
+ That’s probably not what you want, because such relative
+ links are only usable in the context of HTML output. So, to
+ make the links meaningful and usable in the context of
+ man-page output, set a value for
+ <parameter>man.base.url.for.relative.links</parameter> that
+ points to the online version of HTML output generated from
+ your DocBook <tag>refentry</tag> source. For
+ example:
+ <programlisting
+ ><xsl:param name="man.base.url.for.relative.links"
+ >http://www.kernel.org/pub/software/scm/git/docs/</xsl:param></programlisting>
+ </para>
+
+ </refsection>
+
+ <refsection><info><title>Related Parameters</title></info>
+ <para><parameter>man.endnotes.list.enabled</parameter></para>
+ </refsection>
+
+</refentry>