Bug 13495

Summary: Please provide XSLT for generating devhelp index
Product: dbus Reporter: Martin Pitt <martin.pitt>
Component: coreAssignee: Simon McVittie <smcv>
Status: RESOLVED FIXED QA Contact: Rob Taylor <rob.taylor>
Severity: normal    
Priority: medium CC: walters, will
Version: unspecifiedKeywords: patch
Hardware: All   
OS: All   
URL: http://git.collabora.co.uk/?p=user/smcv/dbus-smcv.git;a=shortlog;h=refs/heads/doxygenate
Whiteboard: review+
i915 platform: i915 features:
Attachments: XSLT for doxygen to devhelp
add devhelp support and install/uninstall
Generate XML from Doxygen
[2/8] Add doxygen_to_devhelp.xsl (from Fedora, via Debian)
[3/8] configure.in: require autoconf 2.60
[4/8] Check for xsltproc in configure.in
[5/8] Use a stamp file to represent the Doxygen output
[6/8] docs: use $(MKDIR_P), which we already check for in configure.in
[7/8] Install the Doxygen documentation to $(htmldir)
[8/8] Build dbus.devhelp using doxygen_to_devhelp.xsl and install it

Description Martin Pitt 2007-12-03 05:13:42 UTC
Hello,

Fedora recently added an XSLT to their dbus package to generate a devhelp index from the API documentation. Ubuntu adopted this XSLT to do the same.

It seems worthwhile to ship this file upstream, so that distributions can easily build a devhelp index (after enabling XML code generation in Doxyfile.in, which is  another patch, but trivial).

Thanks for considering,

Martin
Comment 1 Martin Pitt 2007-12-03 05:15:07 UTC
Created attachment 12912 [details]
XSLT for doxygen to devhelp

Usage:

  xsltproc -o dbus.devhelp doxygen_to_devhelp.xsl doc/api/xml/index.xml
Comment 2 Marc-Andre Lureau 2008-03-30 09:28:33 UTC
Created attachment 15572 [details] [review]
add devhelp support and install/uninstall

tested with "--enable-xml-doc --enable-doxygen" and "--disable-xml-doc --disable-doxygen", make install / make uninstall & make distcheck.
Comment 3 Simon McVittie 2011-01-13 07:24:20 UTC
Adding this to my to-do list: Fedora, Ubuntu, Debian and Maemo all seem to patch this, one way or another.
Comment 4 Simon McVittie 2011-01-13 09:49:39 UTC
Review of attachment 15572 [details] [review]:

(This has bit-rotted a bit in the intervening 2 years, and the patch no longer applies cleanly.)

::: doc/Makefile.am
@@ +33,3 @@
 
+install-doc: $(HTML_FILES)
+	@$(NORMAL_INSTALL)

What does $(NORMAL_INSTALL) do? It looks like undocumented automake internals to me?

@@ +58,3 @@
+# Build a DevHelp reference from the doxygen xml
+$(devhelp_file): $(XML_INDEX) $(devhelp_stylesheet)
+	xsltproc --stringparam book_title "${PACKAGE_NAME} Reference Manual" \

configure.ac will need to check for xsltproc

@@ +61,3 @@
+		--stringparam book_name "${PACKAGE_NAME}" \
+		--stringparam reference_prefix "../../../doc/${PACKAGE_NAME}/reference/html" \
+		--stringparam docdir "../../../doc/${PACKAGE_NAME}" \

These parameters don't really make the XSLT fully generic: it still contains references to the tutorial, FAQ, spec, API reference. Nice idea, but I'm not going to commit this version right now; I'll stick with the Fedora one attached above (which we've been using for ages in Debian).

@@ +64,3 @@
+		-o $@ $(devhelp_stylesheet) $(XML_INDEX)
+
+$(HTML_INDEX) $(XML_INDEX): $(doxygen_configfile_source) $(beautify_docs_source) $(top_srcdir)/dbus/*.h

What's beautify_docs_source?

@@ +94,3 @@
+	-rm -f $(HTML_FILES) $(devhelp_file)
+	-rm -rf api
+	-rm -f $(devhelp_file)

Ignoring errors (the "-" prefix) is generally undesirable.

::: doc/doxygen_to_devhelp.xsl
@@ +23,3 @@
+	<sub name="API Reference" link="{$reference_prefix}/index.html"/>
+      </chapters>
+    </book>

This is mis-nested: <functions> are also meant to be in the <book>.
Comment 5 Simon McVittie 2011-01-14 04:48:55 UTC
Created attachment 42022 [details] [review]
Generate XML from Doxygen

This is a useful input format for XSLT, for instance to make a Devhelp
index.
    
Originally from Matthias Clasen in Fedora's dbus/1.0.1-2 package, via
Ubuntu, Debian and Maemo.
Comment 6 Simon McVittie 2011-01-14 04:50:05 UTC
Created attachment 42023 [details] [review]
[2/8] Add doxygen_to_devhelp.xsl (from Fedora, via Debian)

Originally committed by Matthias Clasen <mclasen@fedoraproject.org>.
Comment 7 Simon McVittie 2011-01-14 04:50:39 UTC
Created attachment 42024 [details] [review]
[3/8] configure.in: require autoconf 2.60

We already require it in practice, for AC_PROG_MKDIR_P. It also defines
$(htmldir).
Comment 8 Simon McVittie 2011-01-14 04:51:05 UTC
Created attachment 42025 [details] [review]
[4/8] Check for xsltproc in configure.in
Comment 9 Simon McVittie 2011-01-14 04:51:32 UTC
Created attachment 42026 [details] [review]
[5/8] Use a stamp file to represent the Doxygen output

This avoids thinking it's up to date if the Doxygen build fails, but writes
partial output to index.html before failing.
Comment 10 Simon McVittie 2011-01-14 04:52:00 UTC
Created attachment 42027 [details] [review]
[6/8] docs: use $(MKDIR_P), which we already check for in configure.in

mkdir -p isn't 100% portable, whereas $(MKDIR_P) can either be mkdir -p,
install -d or (as a last resort) ./install-sh -d.
Comment 11 Simon McVittie 2011-01-14 04:52:52 UTC
Created attachment 42028 [details] [review]
[7/8] Install the Doxygen documentation to $(htmldir)

Use ./configure --docdir=/foo (or --htmldir=/foo) to control where it
ends up. For instance, Debian could use:

    --docdir=/usr/share/doc/dbus-1-doc --htmldir='${docdir}/html'
Comment 12 Simon McVittie 2011-01-14 04:53:18 UTC
Created attachment 42029 [details] [review]
[8/8] Build dbus.devhelp using doxygen_to_devhelp.xsl and install it
Comment 13 Will Thompson 2011-02-25 03:36:39 UTC
These patches look good. I like devhelp.
Comment 14 Simon McVittie 2011-02-25 08:53:56 UTC
Patches applied, will be in 1.4.8 and 1.5.0. Thanks!

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.