From 93238ddbeabef3b131cae48d3f35e9f541ec545b Mon Sep 17 00:00:00 2001 From: Gaetan Nadon Date: Wed, 2 Mar 2011 09:06:04 -0500 Subject: DocBook/XML: add support for docbook external references Documents external references ----------------------------- A new feature with version 1.7 is references to documents in other packages. For example a protocol specifications may refer to another one or to a library implementing it. This feature works with PDF, HTML, PS (and epub?) generated documents and will generate links to the other versions of the same type, i.e. html docs will link to other html docs, and pdf docs will link to other pdf docs. New: generating target databases -------------------------------- All documents will generate a target db, analogous to a symbol table which will be consulted by other documents to find linking information. This is accomplished with xsltproc. New: consulting target databases -------------------------------- While documents are being converted from xml to html/pdf/ps, they will consult the target dbs of each document they which to refer to. This is accomplished with xmlto. New: master database -------------------- A hand written database has been created which provides an association between the target dbs and the document themselves. It also reflects the hierarchical structure of the documents relative to the installation dir. New: xorg-xhtml.xsl and xorg-fo.xsl ----------------------------------- A number of motivations are behind the new (and split) versions of xorg.xsl. This module must remain backward compatible to build previous versions of documentation. It was originally designed a while ago for sgml. Given that all documents makefile had to change, it seemed a good opportunity to break from the past. Among the differences: The location of xorg.css is no longer set in the stylesheet. The chunked html is no longer supported. The html and fo parameters are kept separate. Additional parameters for external references. Now allows different values for html/fo xsl for the same parameter should that be required. The xorg-xhtml.xsl imports html/docbook.xsl The xorg-fo.xsl imports fo/docbook.xsl Co-authored-by: Matt Dew Acked-by: Dan Nicholson Signed-off-by: Gaetan Nadon --- Makefile.am | 8 +- README | 133 ++++++++++++++++ configure.ac | 3 + masterdb/.gitignore | 4 + masterdb/Makefile.am | 26 ++++ masterdb/masterdb.xml | 422 ++++++++++++++++++++++++++++++++++++++++++++++++++ xorg-fo.xsl | 87 +++++++++++ xorg-xhtml.xsl | 51 ++++++ xorg.xsl | 1 - 9 files changed, 732 insertions(+), 3 deletions(-) create mode 100644 masterdb/.gitignore create mode 100644 masterdb/Makefile.am create mode 100644 masterdb/masterdb.xml create mode 100644 xorg-fo.xsl create mode 100644 xorg-xhtml.xsl diff --git a/Makefile.am b/Makefile.am index e3fcca5..74fe5cb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -19,9 +19,13 @@ # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -sgmldir = $(sgmlrootdir)/X11 +SUBDIRS = masterdb -dist_sgml_DATA = defs.ent xorg.css xorg.xsl +dist_sgmlx11_DATA = \ + defs.ent xorg.css \ + xorg.xsl \ + xorg-xhtml.xsl \ + xorg-fo.xsl pkgconfigdir = $(datadir)/pkgconfig pkgconfig_DATA = xorg-sgml-doctools.pc diff --git a/README b/README index 5d60900..07e760b 100644 --- a/README +++ b/README @@ -5,6 +5,139 @@ source who want to produce formatted documentation from their builds, or those who have installed the HTML version of the documentation, which refers to the included common xorg.css stylesheet. +Documents external references +----------------------------- +A new feature with version 1.7 is references to documents in other +packages. For example a protocol specifications may refer to another +one or to a library implementing it. + +This feature works with PDF, HTML, PS (and epub?) generated documents +and will generate links to the other versions of the same type, i.e. html +docs will link to other html docs, and pdf docs will link to other pdf +docs. + +Due to the modular nature of the X window System and the flexibility +it provides to O/S builders, one should not expect all links to +be resolved all the time. A more recent version of a package may be +installed or an older version may be retained for a long period of time. +Not all packages are installed either. + +Build challenges +---------------- +The X Window System is composed of over 200 packages. The documentation is +included with the package it documents so the information matches the code. +The build is organized to satisfy C code building requirements, but this +paradigm does not fit very well for building documentation. + +For a document to build a reference to another document, it needs to have +information about this document which may or may not be there, or may be +at an unexpected version. The document it refers to may also wish to refer +to the former document. + +Local X builds +-------------- +When building X as a sandbox on a workstation, using a simple build script +to configure and build all packages in the right order is all you need +to get a working system, including documentation. You will not get all +the links in the documentation resolved correctly due to build order +and/or bi-directional references. + +Unless you are updating or testing the documentation, you do not need to +worry about this glitch. A simple workaround is to build each affected +package using "make clean install && make clean install" in any order. +This will give a chance to each package to get information about the other one +through the installed files. + +O/S X builds +------------ +O/S builders often repackage X code and documentation, however they face the +same challenges as described above. Users can update packages through +the package management system or install additional packages. To use the +earlier example, if a protocol is installed without its implementing +library there will be a broken reference. + +Build assumptions +----------------- +Packages provide great flexibility, including the one to install each package +documentation in a separate, totally unrelated directory using the --docdir +configure option. For external references to work, it is assumed that +the each package installs the documentation using the relative +doc/${PACKAGE_TARNAME} location. + +The Docbook stylesheet technology will create references with paths relative +to this location. It will navigate up to "doc" using ../ and then navigate +down to the document it refers to. + +Diagnosing a broken reference +----------------------------- +A document reference is created at build time while the document is being +transformed from Docbook/XML to HTML or another format. If this reference +is missing, the document must be rebuilt. + +To build the reference, the docbook stylesheet consults a database stored +in this package which is called masterdb.xml. This database supplies the +relative directory structure of where the documents are located as well +as including target document references in the various *.db files. +These files are generated and installed while the documents are being build. + +This is what a Docbook/XML reference from docA to docB looks like (docA.xml): +Title + +This is what an HTML reference from docA to docB looks like (docA.html): +Title + +This is what an HTML targetdoc for docB looks like (docB.html.db): +
+ +This is what an HTML reference from docA to docB looks like (docA.html) +when the reference cannot be resolved: +Title + +This can be caused by one or more of the following: + + - docB may not longer contain the text (targetptr) docA is referring to. + - docB.html.db file may not have been installed by docB package + - masterdb.html.xml is missing a entry for docB + - masterdb.html.xml cannot be loaded so all refs are broken. + - an XSLT processor which does not support xinclude is being used + - docB.html.db was generated without --xinclude option for the processor + - xsltproc is not at version 1.1.26 or later + - for PDF/PS formats, the fragment is ignored, always points to top of docB + +Some pitfalls +------------------------- + in docA.xml: the id must match the file basename. +In xorg-*.xsl, +supplies docid for *.db. The document id must be unique across +all documents. + +The baseuri attribute in masterdb.xml is required for pdf/ps references +to work. It cannot be replaced with olink.base.uri in the makefile. + +The pdf/ps "inside the document" references only started working with +docbook-xsl v 1.76.1 which is not yet available to your favorite O/S. +In xorg-fo.xsl, insert.olink.pdf.frag must be set to zero which allows +the reference to at least point to the top of the document. + +XSL toolchain +------------- +The following minimum versions are needed for external references to work: +XSLT processor: 1.1.26 +libxml2: 2.7.6 +libxslt1.1: 1.1.26 +The exact triplet may vary by distribution, sometimes a version is skipped. +If you are close enough, try it. + +References +---------- +http://docbook.org/tdg/en/html/docbook.html +http://docbook.sourceforge.net/release/xsl/current/doc/html/ +http://docbook.sourceforge.net/release/xsl/current/doc/fo/ +http://www.sagehill.net/docbookxsl/OlinkPrintOutput.html + + +------------------------------------------------------------------------------- + All questions regarding this software should be directed at the Xorg mailing list: diff --git a/configure.ac b/configure.ac index c4b0940..9f28636 100644 --- a/configure.ac +++ b/configure.ac @@ -35,7 +35,10 @@ XORG_MACROS_VERSION(1.8) XORG_DEFAULT_OPTIONS AC_SUBST([sgmlrootdir],['${datarootdir}/sgml']) +AC_SUBST([sgmlx11dir],['${sgmlrootdir}/X11']) +AC_SUBST([sgmldbsdir],['${sgmlx11dir}/dbs']) AC_CONFIG_FILES([Makefile + masterdb/Makefile xorg-sgml-doctools.pc]) AC_OUTPUT diff --git a/masterdb/.gitignore b/masterdb/.gitignore new file mode 100644 index 0000000..f0a77b4 --- /dev/null +++ b/masterdb/.gitignore @@ -0,0 +1,4 @@ +masterdb.html.xml +masterdb.pdf.xml +masterdb.ps.xml +masterdb.txt.xml diff --git a/masterdb/Makefile.am b/masterdb/Makefile.am new file mode 100644 index 0000000..b967d68 --- /dev/null +++ b/masterdb/Makefile.am @@ -0,0 +1,26 @@ + +master_PRE = masterdb.xml +sgmldbs_DATA = \ + $(master_PRE:xml=html.xml) \ + $(master_PRE:xml=pdf.xml) \ + $(master_PRE:xml=ps.xml) \ + $(master_PRE:xml=txt.xml) + +EXTRA_DIST = $(master_PRE) +CLEANFILES = $(sgmldbs_DATA) + +%.html.xml: %.xml + $(AM_V_GEN)$(SED) -e 's|__ext__|html|g' \ + -e 's|__db__|html|g' < $< > $@ + +%.txt.xml: %.xml + $(AM_V_GEN)$(SED) -e 's|__ext__|txt|g' \ + -e 's|__db__|html|g' < $< > $@ + +%.pdf.xml: %.xml + $(AM_V_GEN)$(SED) -e 's|__ext__|pdf|g' \ + -e 's|__db__|fo|g' < $< > $@ + +%.ps.xml: %.xml + $(AM_V_GEN)$(SED) -e 's|__ext__|ps|g' \ + -e 's|__db__|fo|g' < $< > $@ diff --git a/masterdb/masterdb.xml b/masterdb/masterdb.xml new file mode 100644 index 0000000..7480f21 --- /dev/null +++ b/masterdb/masterdb.xml @@ -0,0 +1,422 @@ + + +] +> + + +This is the X.org document collection. All documentation in X is (should be) +listed here. This allows crosslinking between documents. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xorg-fo.xsl b/xorg-fo.xsl new file mode 100644 index 0000000..d57f7ac --- /dev/null +++ b/xorg-fo.xsl @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + new + + + + + + + + + + + + + + + + + + + + + + blue + + + + + green + + + + + + + + + + DejaVu Serif + serif,Symbol,AR PL UMing CN,AR PL ShanHeiSun Uni,GNU Unifont + + diff --git a/xorg-xhtml.xsl b/xorg-xhtml.xsl new file mode 100644 index 0000000..fc2e95d --- /dev/null +++ b/xorg-xhtml.xsl @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xorg.xsl b/xorg.xsl index 5ab03c9..0a2ff62 100644 --- a/xorg.xsl +++ b/xorg.xsl @@ -74,5 +74,4 @@ DEALINGS IN THE SOFTWARE. DejaVu Serif serif,Symbol,AR PL UMing CN,AR PL ShanHeiSun Uni,GNU Unifont - -- cgit v1.2.3