Correctly display local file links in the print stylesheet.

Local-file URLs are encoded as file://localhost/path/file which is
fine for HTML but this looks ugly when printed.

Add a function to chop off the "file://localhost" so that the above
URL would be printed as "/path/file" but still link to
"file://localhost/path/file" for HTML output.
This commit is contained in:
Murray Stokely 2001-07-20 04:59:28 +00:00
parent 14b35ee415
commit a6695a0034
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=9980
3 changed files with 33 additions and 6 deletions
en_US.ISO8859-1/books/handbook
introduction
mirrors
share/sgml

View file

@ -1,7 +1,7 @@
<!--
The FreeBSD Documentation Project
$FreeBSD: doc/en_US.ISO8859-1/books/handbook/introduction/chapter.sgml,v 1.46 2001/07/17 00:11:19 chern Exp $
$FreeBSD: doc/en_US.ISO8859-1/books/handbook/introduction/chapter.sgml,v 1.47 2001/07/17 02:31:55 murray Exp $
-->
<chapter id="introduction">
@ -814,7 +814,7 @@
<listitem>
<para><ulink
url="file:/usr/share/doc/handbook/index.html">file:/usr/share/doc/handbook/index.html</ulink></para>
url="file://localhost/usr/share/doc/handbook/index.html">/usr/share/doc/handbook/index.html</ulink></para>
</listitem>
</varlistentry>
@ -823,7 +823,7 @@
<listitem>
<para><ulink
url="file:/usr/share/doc/faq/index.html">file:/usr/share/doc/faq/index.html</ulink></para>
url="file://localhost/usr/share/doc/faq/index.html">/usr/share/doc/faq/index.html</ulink></para>
</listitem>
</varlistentry>
</variablelist>

View file

@ -1,7 +1,7 @@
<!--
The FreeBSD Documentation Project
$FreeBSD: doc/en_US.ISO8859-1/books/handbook/mirrors/chapter.sgml,v 1.131 2001/07/06 13:03:03 dd Exp $
$FreeBSD: doc/en_US.ISO8859-1/books/handbook/mirrors/chapter.sgml,v 1.132 2001/07/19 23:18:07 chern Exp $
-->
<appendix id="mirrors">
@ -1757,7 +1757,7 @@
by a configuration file called the <filename>supfile</filename>.
There are some sample <filename>supfiles</filename> in the
directory <ulink
url="file:/usr/share/examples/cvsup/">/usr/share/examples/cvsup/</ulink>.</para>
url="file://localhost/usr/share/examples/cvsup/">/usr/share/examples/cvsup/</ulink>.</para>
<para>The information in a <filename>supfile</filename> answers
the following questions for cvsup:</para>

View file

@ -1,4 +1,4 @@
<!-- $FreeBSD: doc/share/sgml/freebsd.dsl,v 1.36 2001/07/16 05:00:20 murray Exp $ -->
<!-- $FreeBSD: doc/share/sgml/freebsd.dsl,v 1.37 2001/07/17 02:22:29 murray Exp $ -->
<!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
<!ENTITY % output.html "IGNORE">
@ -198,6 +198,33 @@
(define withpgpkeys
#f)
;; If a link is entered as "file://localhost/usr/ports" in the docs
;; then we only want to display "/usr/ports" in printed form.
(define (fix-url url)
(if (and (> (string-length url) 15)
(string=? (substring url 0 16) "file://localhost"))
(substring url 16 (string-length url))
url))
(element ulink
(make sequence
(if (node-list-empty? (children (current-node)))
(literal (fix-url (attribute-string (normalize "url"))))
(make sequence
($charseq$)
(if %footnote-ulinks%
($ss-seq$ + (literal (footnote-number (current-node))))
(if (and %show-ulinks%
(not (equal? (fix-url (attribute-string (normalize "url")))
(data-of (current-node)))))
(make sequence
(literal " (")
(literal (fix-url (attribute-string (normalize "url"))))
(literal ")"))
(empty-sosofo)))))))
(define (toc-depth nd)
(if (string=? (gi nd) (normalize "book"))
3