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>
index | next in thread | raw e-mail
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 " ">
! <!ENTITY hlofont CDATA '<FONT COLOR="#660000">'>
<!ENTITY hlofont CDATA '<FONT FACE="Helvetica">'>
<!ENTITY hlcfont CDATA '</FONT>'>
--- 52,58 ----
<!ENTITY wspace CDATA " ">
! <!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}<HR NOSHADE></start>
! <end><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}
! <P></start>
! <end></P>
${_action &r.blkpe;t}</end>
</rule>
<rule> <!-- Author's institutional affiliation -->
<match>
<gi>AFFILIATION
- <action>
- <start><BR></start>
</rule>
<rule> <!-- Prose explanation of a nonprose element -->
--- 209,222 ----
<gi>ADDRESS
<action>
<start>${_action &r.blkps;t}
! <ADDRESS></start>
! <end></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>^<P></start>
! <!-- <end></P>^ -->
</rule>
<rule> <!-- Short description of author -->
--- 347,354 ----
<match>
<gi>AUTHOR
<action>
! <start>^<P ALIGN="LEFT"></start>
! <end></P>^</end>
</rule>
<rule> <!-- Short description of author -->
***************
*** 357,362 ****
--- 359,367 ----
<rule> <!-- Wrapper for Author information -->
<match>
<gi>AUTHORGROUP
+ <action>
+ <start><P ALIGN="LEFT"></start>
+ <end></P></end>
</rule>
<rule> <!-- Initials or other identifier for the author of a Revision or Comment -->
***************
*** 431,444 ****
<match>
<gi>BOOK
<action>
! <start>^<!-- Generated on ${date} using ${transpec} -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML><TITLE>${_followrel descendant TITLE &r.pass;}</TITLE>
! <BODY BGCOLOR="#FFFFFF" TEXT="#000000">
${_isset inchdr &r.inchdr;}^</start>
<end>^${_set fnotenum 1}${_action &r.fnote;t}
${_isset incftr &r.incftr;}
! </BODY></HTML></end>
</rule>
<rule> <!-- Information about a book used in a bibliographical citation -->
--- 436,449 ----
<match>
<gi>BOOK
<action>
! <start>${_! rm -f ${fnotefile}}^<!-- Generated on ${date} using ${transpec} -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML><TITLE>${_followrel descendant TITLE &r.pass;}</TITLE>
! <BODY BGCOLOR="#F0F0F0" TEXT="#000000">
${_isset inchdr &r.inchdr;}^</start>
<end>^${_set fnotenum 1}${_action &r.fnote;t}
${_isset incftr &r.incftr;}
! </BODY></HTML>${_! rm -f ${fnotefile}}</end>
</rule>
<rule> <!-- Information about a book used in a bibliographical citation -->
***************
*** 684,691 ****
<match>
<gi>EMAIL
<action>
! <start><A HREF="mailto:${_action &r.pass;}"></start>
! <end></A></end>
</rule>
<!-- Emphasis: The remap attribute indicates the procedural markup tags
--- 689,696 ----
<match>
<gi>EMAIL
<action>
! <start>&lt;<A HREF="mailto:${_action &r.pass;}"></start>
! <end></A>&gt;</end>
</rule>
<!-- Emphasis: The remap attribute indicates the procedural markup tags
***************
*** 745,751 ****
<gi>ENTRY
<context>ROW THEAD
<action>
! <start>^<TH></start>
<end></TH>^</end>
</rule>
--- 750,756 ----
<gi>ENTRY
<context>ROW THEAD
<action>
! <start>^<TH ALIGN="LEFT" VALIGN="MIDDLE"></start>
<end></TH>^</end>
</rule>
***************
*** 854,867 ****
<match>
<gi>FOOTNOTE
<action>
- <start><A NAME="rfn-${fnotenum}"></A><SUP><SMALL><A HREF="#fn-${fnotenum}">${fnotenum}</A></SMALL></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}}<A NAME="rfn-${fnotenum}"></A><SUP><SMALL><A HREF="#fn-${LINKEND}">[${fnotenum}]</A></SMALL></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}
! <P><A HREF="${_filename}">[image]</A></P>
${_action &r.blkpe;t}</replace>
</rule>
--- 979,985 ----
<gi>GRAPHIC
<action>
<replace>${_action &r.blkps;t}
! <P><IMG SRC="${_filename}"></P>
${_action &r.blkpe;t}</replace>
</rule>
***************
*** 1228,1233 ****
--- 1234,1242 ----
<rule> <!-- Hypertext link -->
<match>
<gi>LINK
+ <action>
+ <start><A HREF="#${LINKEND}"></start>
+ <end></A></end>
</rule>
<rule> <!-- Wrapper for the elements of items in an ItemizedList or
***************
*** 1631,1638 ****
<match>
<gi>PUBDATE
<action>
! <start><P></start>
! <end></P></end>
</rule>
<rule> <!-- Publisher of a document -->
--- 1640,1647 ----
<match>
<gi>PUBDATE
<action>
! <start><DIV ALIGN="LEFT">Last Revised: </start>
! <end></DIV></end>
</rule>
<rule> <!-- Publisher of a document -->
***************
*** 1809,1815 ****
<match>
<gi>ROW
<action>
! <start>^<TR valign="top">^</start>
<end>^</TR>^</end>
</rule>
--- 1818,1824 ----
<match>
<gi>ROW
<action>
! <start>^<TR ALIGN="LEFT" VALIGN="TOP">^</start>
<end>^</TR>^</end>
</rule>
***************
*** 2283,2288 ****
--- 2292,2315 ----
<end>&hlcfont;</H1>^</end>
</rule>
+ <rule> <!-- Text of an abstract -->
+ <match>
+ <gi>TITLE
+ <context>ABSTRACT
+ <action>
+ <start>^<H2>&hlofont;</start>
+ <end>&hlcfont;</H2>^</end>
+ </rule>
+
+ <rule> <!-- Title of a legalnotice -->
+ <match>
+ <gi>TITLE
+ <context>LEGALNOTICE
+ <action>
+ <start>^<H3>&hlofont;</start>
+ <end>&hlcfont;</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>^<H4>&hlofont;</start>
+ <end>&hlcfont;</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}
<DL>^</start>
<end>^</DL>
${_action &r.blkpe;t}</end>
--- 2606,2612 ----
<match>
<gi>VARIABLELIST
<action>
! <start>${_action &r.blkps;t}<STRONG>${_followrel child TITLE &r.pass;}</STRONG>
<DL>^</start>
<end>^</DL>
${_action &r.blkpe;t}</end>
***************
*** 2773,2779 ****
<match>
<relation>descendant FOOTNOTE
<action>
! <replace><H1>&hlofont;Notes&hlcfont;</H1>
<TABLE width="100%">
${_find top gi FOOTNOTE &r.fnotei;}
</TABLE></replace>
--- 2818,2824 ----
<match>
<relation>descendant FOOTNOTE
<action>
! <replace><HR NOSHADE WIDTH="100%"><BR><H1>&hlofont;Footnotes&hlcfont;</H1>
<TABLE width="100%">
${_find top gi FOOTNOTE &r.fnotei;}
</TABLE></replace>
***************
*** 2783,2789 ****
<match>
<gi>_fnote
<action>
! <start>^<TR><TD VALIGN="TOP"><B><A NAME="fn-${fnotenum}"></A><A HREF="#rfn-${fnotenum}">${fnotenum}.</A></B></TD>
<TD VALIGN="TOP"></start>
<end></TD><TR></end>
<incr>fnotenum
--- 2828,2835 ----
<match>
<gi>_fnote
<action>
! <start>^<TR><TD VALIGN="TOP"><B><A NAME="fn-${fnotenum}"></A><A NAME="fn-${ID}"></A>
! ${_! process-footnotes ${fnotefile} ${ID} }
<TD VALIGN="TOP"></start>
<end></TD><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
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199704111115.AA088227335>
