From: Michael Smith Date: Tue, 24 May 2005 22:40:41 +0000 (+0000) Subject: Make xrefs and olinks work, and prevent instances of “ and X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6122c8882861de52db2a2c5557787d35b6f97a91;p=docbook-dsssl Make xrefs and olinks work, and prevent instances of “ and ” entities in output (closes #741578 and #956072; thanks to Jens Granseuer and Sam Steingold for reporting the problems) ::Problem: If you include an xref in a source document, instead of getting the xref text you would expect in the output, you just get "[xref to refsect1]", where "refsect" is the name of the target element for the xref. If you include an olink, it works as expected -- except that the output text has “ and ” entities (double "curly" quotation marks). ::Cause: The manpages/docbook.xsl driver imports the html/docbook.xsl stylesheet, which in turn imports the html/xref.xsl file. The manpages/docbook.xsl file then imports the manpages/xref.xsl file. That file contains a "xref" template that overrides the the one in html/xref.xsl and that, by design, does nothing except to generate the "[xref to refsect1]" text instead of the expected xref output. On the other hand, the manpages stylesheets don't override the "olink" template; therefore, the "olink" template from the html/xref.xsl file is used "as is". And being that it is intended for HTML output, that template uses the “ and ” to wrap titles in xref output. ::Fix: The original manpages/xref.xsl file has now been removed. The build for the manpages distribution now makes that file, using the textify.xsl stylesheet to automatically generate it from the html/xref.xsl file. It is built in such a away that it basically just contains special copies of the "xref" and "olink" templates that cause “ and ” instances to be transformed into "\(lq" and "\(rq" (groff "left quote" and "right quote"). It might seem odd that templates from the html/xref.xsl are used, since those templates a designed to generate hyperlinks of the form the section called "Bar". But it works because the manpages stylesheets end up using the text value of the output of the above. Thus, the and parts are stripped out, leaving just the text between ('the section called "Bar"'). ::Affects Only affects output of xref and olink elements. The fix may not be complete and/or may cause other problems. Please test. In particular, while it may fix the “ and ” problem that English lang/locales users have run into, it doesn't fix the corresponding problem for output of xrefs and olinks in many non-English locales, which use quoting characters other than “ and ” To give just one example of many: in Japanese, the quoting characters are 「 and 」 ("left corner bracket" and "right corner bracket"). It is possible to "fix" the problem for all locales; but it is just a question of whether there is enough of a demand for it that it is worth doing. --- diff --git a/xsl/manpages/.cvsignore b/xsl/manpages/.cvsignore index e2d754768..bf7e41f8e 100644 --- a/xsl/manpages/.cvsignore +++ b/xsl/manpages/.cvsignore @@ -2,3 +2,4 @@ Makefile.param param.xml param.xsl profile-docbook.xsl +xref.xsl diff --git a/xsl/manpages/Makefile b/xsl/manpages/Makefile index cb31e51a1..0f17ee1fc 100644 --- a/xsl/manpages/Makefile +++ b/xsl/manpages/Makefile @@ -1,17 +1,19 @@ -XSLT=../../cvstools/saxon -XJPARSE=../../cvstools/xjparse +include ../../cvstools/Makefile.incl PARAMPROF=.param.profiled PARAMSTRIP=.param.stripped include Makefile.param -all: param.xsl profile-docbook.xsl +all: xref.xsl param.xsl profile-docbook.xsl xml: param.xml html: param.html +xref.xsl: ../html/xref.xsl + $(XSLT) $< textify.xsl $@ + param.html: param.xml $(XSLT) $< ../docsrc/lrefentry.xsl $@ diff --git a/xsl/manpages/textify.xsl b/xsl/manpages/textify.xsl new file mode 100644 index 000000000..b6642251b --- /dev/null +++ b/xsl/manpages/textify.xsl @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + * This file was created automatically by textify.xsl + + * as part of the DocBook manpages stylesheet build + + * + + * DocBook Project developers: DO NOT EDIT THIS FILE. + + * + + * Instead, edit a source stylesheet and then re-run + + * textify.xsl to generate a new version of this file. + + + + + + + + + + + + + + + + xml + UTF-8 + + + + + + + + + + + + + + + + + + + + + + + + content + + + + replace-entities + + content + $content + + + + + + + + + + + + + + + diff --git a/xsl/manpages/xref.xsl b/xsl/manpages/xref.xsl deleted file mode 100644 index 671b87d93..000000000 --- a/xsl/manpages/xref.xsl +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - xref to nonexistent id - - - - - - - - - - - - - - - - - - - - [xref to - - ] - - - - -