]> granicus.if.org Git - docbook-dsssl/commitdiff
Added support for automatic generation of map and context files for HTML Help. Topic...
authorJirka Kosek <jirka@kosek.cz>
Wed, 28 Nov 2001 09:34:47 +0000 (09:34 +0000)
committerJirka Kosek <jirka@kosek.cz>
Wed, 28 Nov 2001 09:34:47 +0000 (09:34 +0000)
xsl/html/param.ent
xsl/html/param.xweb
xsl/htmlhelp/htmlhelp.xsl
xsl/params/htmlhelp.alias.file.xml [new file with mode: 0644]
xsl/params/htmlhelp.force.map.and.alias.xml [new file with mode: 0644]
xsl/params/htmlhelp.map.file.xml [new file with mode: 0644]

index 4301206d214e691b7db317ba5c755581f5164de7..2be31036d17c7ee918c220c86df01325359cb9dc 100644 (file)
 <!ENTITY htmlhelp.hhc SYSTEM "../params/htmlhelp.hhc.xml">
 <!ENTITY htmlhelp.hhp.tail SYSTEM "../params/htmlhelp.hhp.tail.xml">
 <!ENTITY htmlhelp.enumerate.images SYSTEM "../params/htmlhelp.enumerate.images.xml">
+<!ENTITY htmlhelp.force.map.and.alias SYSTEM "../params/htmlhelp.force.map.and.alias.xml">
+<!ENTITY htmlhelp.map.file SYSTEM "../params/htmlhelp.map.file.xml">
+<!ENTITY htmlhelp.alias.file SYSTEM "../params/htmlhelp.alias.file.xml">
index 576b37d8c3c4b63f45e7e378f4000e69b6aa88a7..8d35b1b51484a00f6fc4c1f9fbeee6bc3a6b9b35 100644 (file)
@@ -242,6 +242,9 @@ to be incomplete. Don't forget to read the source, too :-)</para>
 &htmlhelp.hhc;
 &htmlhelp.hhp.tail;
 &htmlhelp.enumerate.images;
+&htmlhelp.force.map.and.alias;
+&htmlhelp.map.file;
+&htmlhelp.alias.file;
 </reference>
 
 <appendix><title>The Stylesheet</title>
@@ -395,6 +398,9 @@ around all these parameters.</para>
 <src:fragref linkend="htmlhelp.hhc.frag"/>
 <src:fragref linkend="htmlhelp.hhp.tail.frag"/>
 <src:fragref linkend="htmlhelp.enumerate.images.frag"/>
+<src:fragref linkend="htmlhelp.force.map.and.alias.frag"/>
+<src:fragref linkend="htmlhelp.map.file.frag"/>
+<src:fragref linkend="htmlhelp.alias.file.frag"/>
 </xsl:stylesheet>
 </src:fragment>
 
index e2f035427e447d9496b562827ca01cdb0fb89368..9729b096bbd183cd9d94da63398341b6cbac1b9c 100644 (file)
 
   <xsl:call-template name="hhp"/>
   <xsl:call-template name="hhc"/>
+  <xsl:if test="($rootid = '' and //processing-instruction('dbhh')) or
+                ($rootid != '' and key('id',$rootid)//processing-instruction('dbhh'))">
+    <xsl:call-template name="hh-map"/>
+    <xsl:call-template name="hh-alias"/>
+  </xsl:if>
 </xsl:template>
 
 <!-- ==================================================================== -->
@@ -131,6 +136,19 @@ Title=</xsl:text>
     </xsl:otherwise>
   </xsl:choose>
 </xsl:if>
+
+<xsl:if test="($htmlhelp.force.map.and.alias != 0) or 
+              ($rootid = '' and //processing-instruction('dbhh')) or
+              ($rootid != '' and key('id',$rootid)//processing-instruction('dbhh'))">
+  <xsl:text>
+[ALIAS]
+#include </xsl:text><xsl:value-of select="$htmlhelp.alias.file"/><xsl:text>
+
+[MAP]
+#include </xsl:text><xsl:value-of select="$htmlhelp.map.file"/><xsl:text>
+</xsl:text>
+</xsl:if>
+
 <xsl:value-of select="$htmlhelp.hhp.tail"/>
 </xsl:template>
 
@@ -605,6 +623,88 @@ Title=</xsl:text>
 
 <!-- ==================================================================== -->
 
+<xsl:template name="hh-map">
+  <xsl:call-template name="write.text.chunk">
+    <xsl:with-param name="filename" select="$htmlhelp.map.file"/>
+    <xsl:with-param name="method" select="'text'"/>
+    <xsl:with-param name="content">
+     <xsl:choose>
+       <xsl:when test="$rootid != ''">
+         <xsl:apply-templates select="key('id',$rootid)" mode="hh-map"/>
+       </xsl:when>
+       <xsl:otherwise>
+         <xsl:apply-templates select="/" mode="hh-map"/>
+       </xsl:otherwise>
+     </xsl:choose>
+    </xsl:with-param>
+    <xsl:with-param name="encoding" select="$htmlhelp.encoding"/>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="processing-instruction('dbhh')" mode="hh-map">
+  <xsl:variable name="topicname">
+    <xsl:call-template name="dbhtml-attribute">
+      <xsl:with-param name="pis"
+                      select="."/>
+      <xsl:with-param name="attribute" select="'topicname'"/>
+    </xsl:call-template>
+  </xsl:variable>
+  <xsl:variable name="topicid">
+    <xsl:call-template name="dbhtml-attribute">
+      <xsl:with-param name="pis"
+                      select="."/>
+      <xsl:with-param name="attribute" select="'topicid'"/>
+    </xsl:call-template>
+  </xsl:variable>
+  <xsl:text>#define </xsl:text>
+  <xsl:value-of select="$topicname"/>
+  <xsl:text>&#9;</xsl:text>
+  <xsl:value-of select="$topicid"/>
+  <xsl:text>&#xA;</xsl:text>
+</xsl:template>
+
+<xsl:template match="text()" mode="hh-map"/>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="hh-alias">
+  <xsl:call-template name="write.text.chunk">
+    <xsl:with-param name="filename" select="$htmlhelp.alias.file"/>
+    <xsl:with-param name="method" select="'text'"/>
+    <xsl:with-param name="content">
+     <xsl:choose>
+       <xsl:when test="$rootid != ''">
+         <xsl:apply-templates select="key('id',$rootid)" mode="hh-alias"/>
+       </xsl:when>
+       <xsl:otherwise>
+         <xsl:apply-templates select="/" mode="hh-alias"/>
+       </xsl:otherwise>
+     </xsl:choose>
+    </xsl:with-param>
+    <xsl:with-param name="encoding" select="$htmlhelp.encoding"/>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="processing-instruction('dbhh')" mode="hh-alias">
+  <xsl:variable name="topicname">
+    <xsl:call-template name="dbhtml-attribute">
+      <xsl:with-param name="pis"
+                      select="."/>
+      <xsl:with-param name="attribute" select="'topicname'"/>
+    </xsl:call-template>
+  </xsl:variable>
+  <xsl:value-of select="$topicname"/>
+  <xsl:text>=</xsl:text>
+  <xsl:call-template name="href.target">
+    <xsl:with-param name="object" select=".."/>
+  </xsl:call-template>
+  <xsl:text>&#xA;</xsl:text>
+</xsl:template>
+
+<xsl:template match="text()" mode="hh-alias"/>
+
+<!-- ==================================================================== -->
+
 <xsl:template name="href.target.with.base.dir">
   <xsl:value-of select="$base.dir"/>
   <xsl:call-template name="href.target"/>
diff --git a/xsl/params/htmlhelp.alias.file.xml b/xsl/params/htmlhelp.alias.file.xml
new file mode 100644 (file)
index 0000000..ff67d1c
--- /dev/null
@@ -0,0 +1,23 @@
+<refentry id="htmlhelp.alias.file">
+<refmeta>
+<refentrytitle>htmlhelp.alias.file</refentrytitle>
+<refmiscinfo role="type">string</refmiscinfo>
+</refmeta>
+<refnamediv>
+<refname>htmlhelp.alias.file</refname>
+<refpurpose>Filename of map file.</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv>
+<src:fragment id='htmlhelp.alias.file.frag'>
+<xsl:param name="htmlhelp.alias.file" select="'alias.h'"/>
+</src:fragment>
+</refsynopsisdiv>
+
+<refsect1><title>Description</title>
+
+<para>Change this parameter if you want different name of map file
+than <filename>alias.h</filename>.</para>
+
+</refsect1>
+</refentry>
diff --git a/xsl/params/htmlhelp.force.map.and.alias.xml b/xsl/params/htmlhelp.force.map.and.alias.xml
new file mode 100644 (file)
index 0000000..92a9e69
--- /dev/null
@@ -0,0 +1,24 @@
+<refentry id="htmlhelp.force.map.and.alias">
+<refmeta>
+<refentrytitle>htmlhelp.force.map.and.alias</refentrytitle>
+<refmiscinfo role="type">boolean</refmiscinfo>
+</refmeta>
+<refnamediv>
+<refname>htmlhelp.force.map.and.alias</refname>
+<refpurpose>Should be [MAP] and [ALIAS] section added to project file unconditionaly?</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv>
+<src:fragment id='htmlhelp.force.map.and.alias.frag'>
+<xsl:param name="htmlhelp.force.map.and.alias" select="0"/>
+</src:fragment>
+</refsynopsisdiv>
+
+<refsect1><title>Description</title>
+
+<para>You should turn on this flag, if you have your own
+<filename>alias.h</filename> and <filename>contex.h</filename> files
+and you want include reference to them in project file.</para>
+
+</refsect1>
+</refentry>
diff --git a/xsl/params/htmlhelp.map.file.xml b/xsl/params/htmlhelp.map.file.xml
new file mode 100644 (file)
index 0000000..49ee9cb
--- /dev/null
@@ -0,0 +1,23 @@
+<refentry id="htmlhelp.map.file">
+<refmeta>
+<refentrytitle>htmlhelp.map.file</refentrytitle>
+<refmiscinfo role="type">string</refmiscinfo>
+</refmeta>
+<refnamediv>
+<refname>htmlhelp.map.file</refname>
+<refpurpose>Filename of map file.</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv>
+<src:fragment id='htmlhelp.map.file.frag'>
+<xsl:param name="htmlhelp.map.file" select="'context.h'"/>
+</src:fragment>
+</refsynopsisdiv>
+
+<refsect1><title>Description</title>
+
+<para>Change this parameter if you want different name of map file
+than <filename>context.h</filename>.</para>
+
+</refsect1>
+</refentry>