Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Apr 1997 16:15:35 +0500
From:      "A JOSEPH KOSHY" <koshy@india.hp.com>
To:        jfieber@freebsd.org
Cc:        freebsd-doc@freebsd.org
Subject:   Some enhancements to docbook-html.ts
Message-ID:  <199704111115.AA088227335@fakir.india.hp.com>

next in thread | raw e-mail | index | archive | help

In the process of using Docbook to write a paper I had occasion to enhance
the translation spec in a few places:

	- FOOTNOTE and FOOTNOTEREF are now decoupled so that we can have
	  multiple references to one footnote instance.  This works, but 
	  is a hack; I wasn't able to think up a clearer way, sorry.

	  This currently uses an auxiliary script `process-footnotes'.

	- ABSTRACT elements now generate a properly formatted abstract
	  at the beginning of the document.
	
	- LEGALNOTICE elements are now formatted correctly

	- PUBDATE works correctly

	- AUTHORGROUP, AUTHOR, AFFILIATION, ADDRESS are better in what they
	  produce, but they are still not perfect.
	
	- EMAIL generates angle-bracket delimited email addresses.

	- THEAD, ROW (TABLE) output now explicitly sets alignment.  Not sure
	  how this could be generalized to allow user control.  
	
	- GRAPHIC elements now generate an inline <IMG> construct allowing
	  embedded figures on the HTML page.

	- TITLE elements that are children of SIMPLESECT and VARIABLELIST
	  work correctly now.

A context diff is enclosed; thanks for the good work!  Comments are welcome.

PS: Should I send-pr this too?

Koshy
<koshy@india.hp.com>			My Personal Opinions Only

------------------------------------------------------------------------------
*** /usr/share/sgml/transpec/docbook-html.ts	Tue Apr  1 20:15:15 1997
--- ./docbook-html.ts	Fri Apr 11 13:35:22 1997
***************
*** 52,58 ****
  
  <!ENTITY wspace CDATA "&nbsp;&nbsp;">
  
! <!ENTITY hlofont CDATA '<FONT COLOR="#660000">'>
  <!ENTITY hlofont CDATA '<FONT FACE="Helvetica">'>
  <!ENTITY hlcfont CDATA '</FONT>'>
  
--- 52,58 ----
  
  <!ENTITY wspace CDATA "&nbsp;&nbsp;">
  
! <!ENTITY hlofont CDATA '<FONT COLOR="#000000">'>
  <!ENTITY hlofont CDATA '<FONT FACE="Helvetica">'>
  <!ENTITY hlcfont CDATA '</FONT>'>
  
***************
*** 153,158 ****
--- 153,161 ----
  
  <var>anchorinhibit 0</var>
  
+ <!-- Temporary file for footnote handling -->
+ <var>fnotefile !echo /tmp/instant$$
+ 
  <!-- Transform rules -->
  
  <rule> <!-- Abbreviation, especially one followed by a period -->
***************
*** 164,170 ****
  <match>
  <gi>ABSTRACT
  <action>
! <start>${_action &r.anchor;t}</start>
  </rule>
  
  <rule> <!-- Keycap used with a meta key to activate a graphical user interface -->
--- 167,174 ----
  <match>
  <gi>ABSTRACT
  <action>
! <start>^${_action &r.anchor;t}&lt;HR NOSHADE></start>
! <end>&lt;HR NOSHADE>^</end>
  </rule>
  
  <rule> <!-- Keycap used with a meta key to activate a graphical user interface -->
***************
*** 205,220 ****
  <gi>ADDRESS
  <action>
  <start>${_action &r.blkps;t}
! &lt;P></start>
! <end>&lt;/P>
  ${_action &r.blkpe;t}</end>
  </rule>
  
  <rule> <!-- Author's institutional affiliation -->
  <match>
  <gi>AFFILIATION
- <action>
- <start>&lt;BR></start>
  </rule>
  
  <rule> <!-- Prose explanation of a nonprose element -->
--- 209,222 ----
  <gi>ADDRESS
  <action>
  <start>${_action &r.blkps;t}
! &lt;ADDRESS></start>
! <end>&lt;/ADDRESS>
  ${_action &r.blkpe;t}</end>
  </rule>
  
  <rule> <!-- Author's institutional affiliation -->
  <match>
  <gi>AFFILIATION
  </rule>
  
  <rule> <!-- Prose explanation of a nonprose element -->
***************
*** 345,352 ****
  <match>
  <gi>AUTHOR
  <action>
! <start>^&lt;P></start>
! <!-- <end>&lt;/P>^ -->
  </rule>
  
  <rule> <!-- Short description of author -->
--- 347,354 ----
  <match>
  <gi>AUTHOR
  <action>
! <start>^&lt;P ALIGN="LEFT"></start>
! <end>&lt;/P>^</end>
  </rule>
  
  <rule> <!-- Short description of author -->
***************
*** 357,362 ****
--- 359,367 ----
  <rule> <!-- Wrapper for Author information -->
  <match>
  <gi>AUTHORGROUP
+ <action>
+ <start>&lt;P ALIGN="LEFT"></start>
+ <end>&lt;/P></end>
  </rule>
  
  <rule> <!-- Initials or other identifier for the author of a Revision or Comment -->
***************
*** 431,444 ****
  <match>
  <gi>BOOK
  <action>
! <start>^&lt;!-- Generated on ${date} using ${transpec} -->
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
  &lt;HTML>&lt;TITLE>${_followrel descendant TITLE &r.pass;}&lt;/TITLE>
! &lt;BODY BGCOLOR="#FFFFFF" TEXT="#000000">
  ${_isset inchdr &r.inchdr;}^</start>
  <end>^${_set fnotenum 1}${_action &r.fnote;t}
  ${_isset incftr &r.incftr;}
! &lt;/BODY>&lt;/HTML></end>
  </rule>
  
  <rule> <!-- Information about a book used in a bibliographical citation -->
--- 436,449 ----
  <match>
  <gi>BOOK
  <action>
! <start>${_! rm -f ${fnotefile}}^&lt;!-- Generated on ${date} using ${transpec} -->
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
  &lt;HTML>&lt;TITLE>${_followrel descendant TITLE &r.pass;}&lt;/TITLE>
! &lt;BODY BGCOLOR="#F0F0F0" TEXT="#000000">
  ${_isset inchdr &r.inchdr;}^</start>
  <end>^${_set fnotenum 1}${_action &r.fnote;t}
  ${_isset incftr &r.incftr;}
! &lt;/BODY>&lt;/HTML>${_! rm -f ${fnotefile}}</end>
  </rule>
  
  <rule> <!-- Information about a book used in a bibliographical citation -->
***************
*** 684,691 ****
  <match>
  <gi>EMAIL
  <action>
! <start>&lt;A HREF="mailto:${_action &r.pass;}"></start>
! <end>&lt;/A></end>
  </rule>
  
  <!-- Emphasis: The remap attribute indicates the procedural markup tags
--- 689,696 ----
  <match>
  <gi>EMAIL
  <action>
! <start>&amp;lt;&lt;A HREF="mailto:${_action &r.pass;}"></start>
! <end>&lt;/A>&amp;gt;</end>
  </rule>
  
  <!-- Emphasis: The remap attribute indicates the procedural markup tags
***************
*** 745,751 ****
  <gi>ENTRY
  <context>ROW THEAD
  <action>
! <start>^&lt;TH></start>
  <end>&lt;/TH>^</end>
  </rule>
  
--- 750,756 ----
  <gi>ENTRY
  <context>ROW THEAD
  <action>
! <start>^&lt;TH ALIGN="LEFT" VALIGN="MIDDLE"></start>
  <end>&lt;/TH>^</end>
  </rule>
  
***************
*** 854,867 ****
  <match>
  <gi>FOOTNOTE
  <action>
- <start>&lt;A NAME="rfn-${fnotenum}">&lt;/A>&lt;SUP>&lt;SMALL>&lt;A HREF="#fn-${fnotenum}">${fnotenum}&lt/A>&lt/SMALL>&lt;/SUP></start>
  <ignore>all
- <incr>fnotenum
  </rule>
  
  <rule> <!-- Location of a footnote mark -->
  <match>
  <gi>FOOTNOTEREF
  </rule>
  
  <rule> <!-- Word or words in a language other than that of the containing document -->
--- 859,873 ----
  <match>
  <gi>FOOTNOTE
  <action>
  <ignore>all
  </rule>
  
  <rule> <!-- Location of a footnote mark -->
  <match>
  <gi>FOOTNOTEREF
+ <action>
+ <start>${_! echo "${fnotenum}	${LINKEND}" >> ${fnotefile}}&lt;A NAME="rfn-${fnotenum}">&lt;/A>&lt;SUP>&lt;SMALL>&lt;A HREF="#fn-${LINKEND}">[${fnotenum}]&lt;/A>&lt;/SMALL>&lt;/SUP></start>
+ <incr>fnotenum
  </rule>
  
  <rule> <!-- Word or words in a language other than that of the containing document -->
***************
*** 973,979 ****
  <gi>GRAPHIC
  <action>
  <replace>${_action &r.blkps;t}
! &lt;P>&lt;A HREF="${_filename}">[image]&lt;/A>&lt;/P>
  ${_action &r.blkpe;t}</replace>
  </rule>
  
--- 979,985 ----
  <gi>GRAPHIC
  <action>
  <replace>${_action &r.blkps;t}
! &lt;P>&lt;IMG SRC="${_filename}">&lt;/P>
  ${_action &r.blkpe;t}</replace>
  </rule>
  
***************
*** 1228,1233 ****
--- 1234,1242 ----
  <rule> <!-- Hypertext link -->
  <match>
  <gi>LINK
+ <action>
+ <start>&lt;A HREF="#${LINKEND}"></start>
+ <end>&lt;/A></end>
  </rule>
  
  <rule> <!-- Wrapper for the elements of items in an ItemizedList or
***************
*** 1631,1638 ****
  <match>
  <gi>PUBDATE
  <action>
! <start>&lt;P></start>
! <end>&lt;/P></end>
  </rule>
  
  <rule> <!-- Publisher of a document -->
--- 1640,1647 ----
  <match>
  <gi>PUBDATE
  <action>
! <start>&lt;DIV ALIGN="LEFT">Last Revised: </start>
! <end>&lt;/DIV></end>
  </rule>
  
  <rule> <!-- Publisher of a document -->
***************
*** 1809,1815 ****
  <match>
  <gi>ROW
  <action>
! <start>^&lt;TR valign="top">^</start>
  <end>^&lt;/TR>^</end>
  </rule>
  
--- 1818,1824 ----
  <match>
  <gi>ROW
  <action>
! <start>^&lt;TR ALIGN="LEFT" VALIGN="TOP">^</start>
  <end>^&lt;/TR>^</end>
  </rule>
  
***************
*** 2283,2288 ****
--- 2292,2315 ----
  <end>&hlcfont;&lt;/H1>^</end>
  </rule>
  
+ <rule> <!-- Text of an abstract -->
+ <match>
+ <gi>TITLE
+ <context>ABSTRACT
+ <action>
+ <start>^&lt;H2>&hlofont;</start>
+ <end>&hlcfont;&lt;/H2>^</end>
+ </rule>
+ 
+ <rule> <!-- Title of a legalnotice -->
+ <match>
+ <gi>TITLE
+ <context>LEGALNOTICE
+ <action>
+ <start>^&lt;H3>&hlofont;</start>
+ <end>&hlcfont;&lt;/H2>^</end>
+ </rule>
+ 
  <rule> <!-- Text of a heading or the title of a block-oriented element -->
  <match>
  <gi>TITLE
***************
*** 2439,2444 ****
--- 2466,2480 ----
  <ignore>all
  </rule>
  
+ <rule> <!-- Text of a simple section -->
+ <match>
+ <gi>TITLE
+ <context>SIMPLESECT
+ <action>
+ <start>^&lt;H4>&hlofont;</start>
+ <end>&hlcfont;&lt;/H4>^</end>
+ </rule>
+ 
  <rule> <!-- Text of a heading or the title of a block-oriented element -->
  <match>
  <gi>TITLE
***************
*** 2447,2457 ****
--- 2483,2502 ----
  <ignore>all
  </rule>
  
+ <rule> <!-- Title for a variablelist -->
+ <match>
+ <gi>TITLE
+ <context>VARIABLELIST
+ <action>
+ <ignore>all
+ </rule>
+ 
  <rule> <!-- Text of a heading or the title of a block-oriented element -->
  <match>
  <gi>TITLE
  </rule>
  
+ 
  <rule> <!-- Abbreviated title -->
  <match>
  <gi>TITLEABBREV
***************
*** 2561,2567 ****
  <match>
  <gi>VARIABLELIST
  <action>
! <start>${_action &r.blkps;t}
  &lt;DL>^</start>
  <end>^&lt;/DL>
  ${_action &r.blkpe;t}</end>
--- 2606,2612 ----
  <match>
  <gi>VARIABLELIST
  <action>
! <start>${_action &r.blkps;t}&lt;STRONG>${_followrel child TITLE &r.pass;}&lt;/STRONG>
  &lt;DL>^</start>
  <end>^&lt;/DL>
  ${_action &r.blkpe;t}</end>
***************
*** 2773,2779 ****
  <match>
  <relation>descendant FOOTNOTE
  <action>
! <replace>&lt;H1>&hlofont;Notes&hlcfont;&lt;/H1>
  &lt;TABLE width="100%">
  ${_find top gi FOOTNOTE &r.fnotei;}
  &lt;/TABLE></replace>
--- 2818,2824 ----
  <match>
  <relation>descendant FOOTNOTE
  <action>
! <replace>&lt;HR NOSHADE WIDTH="100%">&lt;BR>&lt;H1>&hlofont;Footnotes&hlcfont;&lt;/H1>
  &lt;TABLE width="100%">
  ${_find top gi FOOTNOTE &r.fnotei;}
  &lt;/TABLE></replace>
***************
*** 2783,2789 ****
  <match>
  <gi>_fnote
  <action>
! <start>^&lt;TR>&lt;TD VALIGN="TOP">&lt;B>&lt;A NAME="fn-${fnotenum}">&lt/A>&lt;A HREF="#rfn-${fnotenum}">${fnotenum}.&lt/A>&lt;/B>&lt;/TD>
  &lt;TD VALIGN="TOP"></start>
  <end>&lt;/TD>&lt;TR></end>
  <incr>fnotenum
--- 2828,2835 ----
  <match>
  <gi>_fnote
  <action>
! <start>^&lt;TR>&lt;TD VALIGN="TOP">&lt;B>&lt;A NAME="fn-${fnotenum}">&lt/A>&lt;A NAME="fn-${ID}">&lt;/A>
! ${_! process-footnotes ${fnotefile} ${ID} }
  &lt;TD VALIGN="TOP"></start>
  <end>&lt;/TD>&lt;TR></end>
  <incr>fnotenum

------------------------------------------------------------------------------
*** /dev/null	Fri Apr 11 16:11:58 1997
--- ./process-footnotes	Fri Apr 11 16:14:14 1997
***************
*** 0 ****
--- 1,11 ----
+ #!/bin/sh
+ 
+ footnotefile=$1
+ pattern=$2
+ shift; shift;
+ 
+ awk "
+      /$pattern$/ {
+        printf(\"<A HREF=\\\"#rfn-%s\\\">%s</A><BR>\n\",\$1,\$1);
+      }
+      " $footnotefile



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199704111115.AA088227335>