Thread: htmlhelp generation

htmlhelp generation

From
Andreas Pflug
Date:
The attached Makefile patch together with stylesheet-hh.xsl allows "make
htmlhelp". stylesheet-hh.xsl is derived from stylesheet.xsl, after some
advise from PeterE.
The result isn't perfect, but quite usable.

Regards,
Andreas
Index: Makefile
===================================================================
RCS file: /projects/cvsroot/pgsql/doc/src/sgml/Makefile,v
retrieving revision 1.72
diff -c -r1.72 Makefile
*** Makefile    9 Mar 2004 20:10:10 -0000    1.72
--- Makefile    22 Nov 2004 17:31:29 -0000
***************
*** 215,220 ****
--- 215,223 ----
  testxml: stylesheet.xsl postgres.xml
      $(XSLTPROC) $(XSLTPROCFLAGS) --stringparam pg.version '$(VERSION)' $^

+ htmlhelp: stylesheet-hh.xsl postgres.xml
+     $(XSLTPROC) $(XSLTPROCFLAGS) --stringparam pg.version '$(VERSION)' $^
+

  ##
  ## Check
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version='1.0'
                xmlns="http://www.w3.org/TR/xhtml1/transitional"
                exclude-result-prefixes="#default">

<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/htmlhelp/htmlhelp.xsl"/>

<!-- Parameters -->
<xsl:param name="htmlhelp.use.hhk" select="'1'"/>
<xsl:param name="pg.fast" select="'0'"/>

<!--
<xsl:param name="draft.mode">
  <xsl:choose>
    <xsl:when test="contains($pg.version, 'devel')">yes</xsl:when>
    <xsl:otherwise>no</xsl:otherwise>
  </xsl:choose>
</xsl:param>
-->

<xsl:param name="show.comments">
  <xsl:choose>
    <xsl:when test="contains($pg.version, 'devel')">1</xsl:when>
    <xsl:otherwise>0</xsl:otherwise>
  </xsl:choose>
</xsl:param>


<xsl:param name="callout.graphics" select="'0'"></xsl:param>
<xsl:param name="toc.section.depth">2</xsl:param>
<xsl:param name="linenumbering.extension" select="'0'"></xsl:param>
<xsl:param name="generate.index" select="1 - $pg.fast"></xsl:param>
<xsl:param name="preface.autolabel" select="1 - $pg.fast"></xsl:param>
<xsl:param name="section.autolabel" select="1 - $pg.fast"></xsl:param>
<xsl:param name="section.label.includes.component.label" select="1 - $pg.fast"></xsl:param>
<xsl:param name="html.stylesheet" select="'stylesheet.css'"></xsl:param>
<xsl:param name="use.id.as.filename" select="'1'"></xsl:param>
<xsl:param name="make.valid.html" select="1"></xsl:param>
<xsl:param name="generate.id.attributes" select="1"></xsl:param>
<xsl:param name="generate.legalnotice.link" select="1"></xsl:param>
<xsl:param name="refentry.xref.manvolnum" select="0"/>
<xsl:param name="link.mailto.url">pgsql-docs@postgresql.org</xsl:param>
<xsl:param name="formal.procedures" select="0"></xsl:param>
<xsl:param name="punct.honorific" select="''"></xsl:param>
<xsl:param name="chunker.output.indent" select="'yes'"/>
<xsl:param name="chunk.quietly" select="1"></xsl:param>


<!-- Change display of some elements -->

<xsl:template match="command">
  <xsl:call-template name="inline.monoseq"/>
</xsl:template>

<xsl:template match="productname">
  <xsl:call-template name="inline.charseq"/>
</xsl:template>

<xsl:template match="structfield">
  <xsl:call-template name="inline.monoseq"/>
</xsl:template>

<xsl:template match="structname">
  <xsl:call-template name="inline.monoseq"/>
</xsl:template>

<xsl:template match="symbol">
  <xsl:call-template name="inline.monoseq"/>
</xsl:template>

<xsl:template match="systemitem">
  <xsl:call-template name="inline.charseq"/>
</xsl:template>

<xsl:template match="token">
  <xsl:call-template name="inline.monoseq"/>
</xsl:template>

<xsl:template match="type">
  <xsl:call-template name="inline.monoseq"/>
</xsl:template>

<xsl:template match="programlisting/emphasis">
  <xsl:call-template name="inline.boldseq"/>
</xsl:template>


<!-- Special support for Tcl synopses -->

<xsl:template match="optional[@role='tcl']">
  ?<xsl:call-template name="inline.charseq"/>?
</xsl:template>


<!--
  Format multiple terms in varlistentry vertically, instead
  of comma-separated.
 -->

<xsl:template match="varlistentry/term[position()!=last()]">
  <span class="term">
    <xsl:call-template name="anchor"/>
    <xsl:apply-templates/>
  </span><br/>
</xsl:template>

</xsl:stylesheet>

Re: htmlhelp generation

From
Tom Lane
Date:
Andreas Pflug <pgadmin@pse-consulting.de> writes:
> The attached Makefile patch together with stylesheet-hh.xsl allows "make
> htmlhelp". stylesheet-hh.xsl is derived from stylesheet.xsl, after some
> advise from PeterE.

Um ... what's an htmlhelp?

            regards, tom lane

Re: htmlhelp generation

From
Peter Eisentraut
Date:
Am Montag, 22. November 2004 22:23 schrieb Tom Lane:
> Um ... what's an htmlhelp?

It's the kind of format the Windows'ish programs use for their internal help
browsers.  It consists of regular HTML plus some index files.  pgAdmin needs
it, and maybe the Windows binary package would like it as well.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

Re: htmlhelp generation

From
Peter Eisentraut
Date:
Am Montag, 22. November 2004 18:34 schrieb Andreas Pflug:
> The attached Makefile patch together with stylesheet-hh.xsl allows "make
> htmlhelp". stylesheet-hh.xsl is derived from stylesheet.xsl, after some
> advise from PeterE.

Installed.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

Re: htmlhelp generation

From
Tom Lane
Date:
Peter Eisentraut <peter_e@gmx.net> writes:
> Am Montag, 22. November 2004 18:34 schrieb Andreas Pflug:
>> The attached Makefile patch together with stylesheet-hh.xsl allows "make
>> htmlhelp". stylesheet-hh.xsl is derived from stylesheet.xsl, after some
>> advise from PeterE.

> Installed.

It would be nice if "make clean" would get rid of what this produces.

            regards, tom lane

Re: htmlhelp generation

From
"Magnus Hagander"
Date:
>> The attached Makefile patch together with stylesheet-hh.xsl
>allows "make
>> htmlhelp". stylesheet-hh.xsl is derived from stylesheet.xsl,
>after some
>> advise from PeterE.
>
>Installed.

From what I can tell, this XSL will download and import another XSL from
docbook.sourceforge.net every time you run "make" on it. Perhaps a copy
of this file should be included in cvs to make sure we can still build
when sourceforge is down?

//Magnus

Re: htmlhelp generation

From
Andrew Dunstan
Date:

Magnus Hagander wrote:

>From what I can tell, this XSL will download and import another XSL from
>docbook.sourceforge.net every time you run "make" on it. Perhaps a copy
>of this file should be included in cvs to make sure we can still build
>when sourceforge is down?
>
>
>
>

Using xsl:import here is not a good idea even if sourceforge isn't down
- the imported file could change without our knowing, and thus the
principle of least surprise would be violated, ISTM.

cheers

andrew



Re: htmlhelp generation

From
Peter Eisentraut
Date:
Magnus Hagander wrote:
> From what I can tell, this XSL will download and import another XSL
> from docbook.sourceforge.net every time you run "make" on it.

Normally, you or your operating system should set up an XML catalog
that maps that URI to a local copy.  For example, my system has

/etc/xml/catalog:
...
<delegateSystem systemIdStartString="http://docbook.sourceforge.net/release/xsl/"
catalog="file:///etc/xml/docbook-xsl.xml"/>

and

/etc/xml/docbook-xsl.xml:
...
<delegateSystem systemIdStartString="http://docbook.sourceforge.net/release/xsl/"
catalog="file:///usr/share/xml/docbook/stylesheet/nwalsh/catalog.xml"/>

This is no different from the public identifier mapping in the SGML
world, only that in the XML case it is possible, as a fallback, to
fetch the data over the net.  Whether you actually do that is between
you and your XSLT processor.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

Re: htmlhelp generation

From
"Magnus Hagander"
Date:
>> From what I can tell, this XSL will download and import another XSL
>> from docbook.sourceforge.net every time you run "make" on it.
>
>Normally, you or your operating system should set up an XML catalog
>that maps that URI to a local copy.  For example, my system has
>
>/etc/xml/catalog:
>...

Hmm. Never seen that in any of the XSL systems I've used. There is
certainly no such system in the XSLT processors that are included in
Windows these days. But since those aren't used to build the docs,
that's not a good reference point I guess. If there is a standard way to
do it, there is less need to include anything in our cvs. IIRC, we don't
include the docbook stylesheets either, right?


Which brings up a different point - has anybody managed to set up a
system to build the docs *on win32*?


//Magnus

Re: htmlhelp generation

From
Peter Eisentraut
Date:
Magnus Hagander wrote:
> Hmm. Never seen that in any of the XSL systems I've used. There is
> certainly no such system in the XSLT processors that are included in
> Windows these days.

I don't know what's "included" in Windows, but all the usual ones you
can download from the net support XML catalogs.

> Which brings up a different point - has anybody managed to set up a
> system to build the docs *on win32*?

Cygwin includes openjade, and xsltproc runs natively, so there shouldn't
be much of a problem.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

Re: htmlhelp generation

From
Christopher Kings-Lynne
Date:
>>Um ... what's an htmlhelp?
>
> It's the kind of format the Windows'ish programs use for their internal help
> browsers.  It consists of regular HTML plus some index files.  pgAdmin needs
> it, and maybe the Windows binary package would like it as well.

I've trivially generated them from docbook xml using the htmlhelp.xsl
stylesheet that comes with docbook and the free html help compiler from MS.

Chris