diff options
author | jfieber <jfieber@FreeBSD.org> | 1997-01-06 05:24:35 +0000 |
---|---|---|
committer | jfieber <jfieber@FreeBSD.org> | 1997-01-06 05:24:35 +0000 |
commit | 4f7f26c227fb9e61b123b73918fd29c1f74d8c3e (patch) | |
tree | f0287bb352cfd8f82bb3692dca3da7b95a615762 | |
parent | b660a5ae0e58381ec7ef6a8960e3a78491f6ed9c (diff) | |
download | FreeBSD-src-4f7f26c227fb9e61b123b73918fd29c1f74d8c3e.zip FreeBSD-src-4f7f26c227fb9e61b123b73918fd29c1f74d8c3e.tar.gz |
Marching on...
Lots of tweaks and new functionality. This now handles pretty much
everything that the linuxdoc to docbook translator generates. Output
is still a single (very large in the case of the handbaak) file but now
has minimal internal navigation links.
-rw-r--r-- | share/sgml/transpec/docbook-html.ts | 348 |
1 files changed, 294 insertions, 54 deletions
diff --git a/share/sgml/transpec/docbook-html.ts b/share/sgml/transpec/docbook-html.ts index d3cb25c..a5fc7d2 100644 --- a/share/sgml/transpec/docbook-html.ts +++ b/share/sgml/transpec/docbook-html.ts @@ -1,6 +1,6 @@ <!-- - $Id: docbook-html.ts,v 1.1 1996/11/09 02:04:05 jfieber Exp $ + $Id: docbook-html.ts,v 1.2 1996/12/17 01:48:30 jfieber Exp $ Copyright (C) 1996 John R. Fieber. All rights reserved. @@ -48,6 +48,7 @@ <!ENTITY lt CDATA "<"> <!ENTITY gt CDATA ">"> <!ENTITY amp CDATA "&"> +<!ENTITY wspace CDATA " "> <!ENTITY r.pass "1"> <!ENTITY r.astart "2"> @@ -56,6 +57,20 @@ <!ENTITY r.admona "7"> <!ENTITY r.admonb "8"> +<!ENTITY r.pttoc "17"> +<!ENTITY r.pttoci "18"> +<!ENTITY r.chtoc "19"> +<!ENTITY r.chtoci "20"> +<!ENTITY r.s1toc "21"> +<!ENTITY r.s1toci "22"> +<!ENTITY r.s2toc "23"> +<!ENTITY r.s2toci "24"> +<!ENTITY r.s3toc "25"> +<!ENTITY r.s3toci "26"> + +<!ENTITY hlofont CDATA '<FONT FACE="Helvetica">'> +<!ENTITY hlcfont CDATA '</FONT>'> + <!ENTITY cmap SYSTEM "/usr/share/sgml/transpec/html.cmap"> <!ENTITY sdata SYSTEM "/usr/share/sgml/transpec/html.sdata"> @@ -67,7 +82,7 @@ <cmap>&cmap;</cmap> <smap>&sdata;</smap> -<!-- Transform rules --> +<!-- Variables --> <var>partnum 1 <var>chapnum 1 <var>sect1num 1 @@ -82,6 +97,10 @@ <var>tabnum 1 <var>eqnum 1 +<var>tmpchapnum 1 + +<!-- Transform rules --> + <rule> <match> <gi>ABBREV @@ -91,11 +110,8 @@ <match> <gi>ABSTRACT <action> -<start><P ALIGN="CENTER"><STRONG>Abstract</STRONG></P> -<BLOCKQUOTE> -${_attval ID &r.astart;}</start> -<end>^${_attval ID &r.aend;} -</BLOCKQUOTE>^</end> +<start>${_attval ID &r.astart;}</start> +<end>${_attval ID &r.aend;}^</end> </rule> <rule> @@ -127,7 +143,9 @@ ${_attval ID &r.astart;}</start> <rule> <match> -<gi>ANCHOR + <gi>ANCHOR +<action> + <start><A NAME="${ID}"></A></start> </rule> <rule> @@ -138,6 +156,9 @@ ${_attval ID &r.astart;}</start> <rule> <match> <gi>APPLICATION +<action> +<start><I></start> +<end></I></end> </rule> <rule> @@ -224,7 +245,7 @@ ${_attval ID &r.astart;}^</start> <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>^</start> +<HTML><TITLE>${_followrel descendant TITLE &r.pass;}</TITLE><BODY BGCOLOR="#FFFFFF" TEXT="#000000">^</start> <end>^</BODY></HTML></end> </rule> @@ -238,6 +259,18 @@ ${_attval ID &r.astart;}^</start> <rule> <match> <gi>BOOKINFO +<relation>sibling PART +<action> +<end>^<H1>&hlofont;Contents&hlcfont;</H1> +${_followrel parent BOOK &r.pttoc;t}^</end> +</rule> + +<rule> +<match> +<gi>BOOKINFO +<action> +<end>^<H1>&hlofont;Contents&hlcfont;</H1> +${_followrel parent BOOK &r.chtoc;t}^</end> </rule> <rule> @@ -251,12 +284,20 @@ ${_attval ID &r.astart;}^</start> <rule> <match> <gi>CAUTION +<relation>child TITLE <action> <do>&r.admona; </rule> <rule> <match> +<gi>CAUTION +<action> +<do>&r.admonb; +</rule> + +<rule> +<match> <gi>CHAPTER <action> <start>^<!-- Start CHAPTER ${chapnum} (${ID}): @@ -277,9 +318,7 @@ ${_followrel child TITLE &r.pass;} -->^</start> <rule> <match> <gi>CITEREFENTRY -<action> -<start><TT></start> -<end></TT></end> +<!-- a link to a man page cgi would be good here... --> </rule> <rule> @@ -320,6 +359,9 @@ ${_followrel child TITLE &r.pass;} -->^</start> <rule> <match> <gi>COMMAND +<action> +<start><I></start> +<end></I></end> </rule> <rule> @@ -431,12 +473,61 @@ ${_followrel child TITLE &r.pass;} -->^</start> <end></A></end> </rule> +<!-- Emphasis --> +<!-- The remap attribute indicates the procedural markup tags + used in the linuxdoc DTD. --> + <rule> <match> -<gi>EMPHASIS + <gi>EMPHASIS + <attval>REMAP bf <action> -<start><EM></start> -<end></EM></end> + <start><B></start> + <end></B></end> +</rule> + +<rule> +<match> + <gi>EMPHASIS + <attval>REMAP it +<action> + <start><I></start> + <end></I></end> +</rule> + +<rule> +<match> + <gi>EMPHASIS + <attval>REMAP sf +<action> + <start>&hlofont;</start> + <end>&hlcfont;</end> +</rule> + +<rule> +<match> + <gi>EMPHASIS + <attval>REMAP sl +<action> + <start><I></start> + <end></I></end> +</rule> + +<rule> +<match> + <gi>EMPHASIS + <attval>REMAP tt +<action> + <start><TT></start> + <end></TT></end> +</rule> + +<rule> +<match> + <gi>EMPHASIS +<action> + <start><EM></start> + <end></EM></end> </rule> <rule> @@ -515,8 +606,8 @@ ${_followrel child TITLE &r.pass;}${_attval ID &r.aend;}^</start> <match> <gi>FILENAME <action> -<start><B></start> -<end></B></end> +<start><I></start> +<end></I></end> </rule> <rule> @@ -531,8 +622,8 @@ ${_followrel child TITLE &r.pass;}${_attval ID &r.aend;}^</start> <match> <gi>FIRSTTERM <action> -<start><STRONG></start> -<end></STRONG></end> +<start><I></start> +<end></I></end> </rule> <rule> @@ -668,12 +759,20 @@ ${_followrel child TITLE &r.pass;}${_attval ID &r.aend;}^</start> <rule> <match> <gi>IMPORTANT +<relation>child TITLE <action> <do>&r.admona; </rule> <rule> <match> +<gi>IMPORTANT +<action> +<do>&r.admonb; +</rule> + +<rule> +<match> <gi>INDEX </rule> @@ -968,6 +1067,14 @@ ${_followrel child TITLE &r.pass;}${_attval ID &r.aend;}^</start> <rule> <match> <gi>NOTE +<relation>child TITLE +<action> +<do>&r.admona; +</rule> + +<rule> +<match> +<gi>NOTE <action> <do>&r.admonb; </rule> @@ -1071,7 +1178,12 @@ ${_followrel child TITLE &r.pass;}${_attval ID &r.aend;}^</start> <rule> <match> -<gi>PART + <gi>PART +<action> +<start>^<!-- Start PART ${partnum} (${ID}): +${_followrel child TITLE &r.pass;} -->^</start> +<end>^<!-- End PART -->^</end> +<incr>partnum </rule> <rule> @@ -1205,6 +1317,9 @@ ${_followrel child TITLE &r.pass;}${_attval ID &r.aend;}^</start> <match> <gi>REFENTRYTITLE <context>CITEREFENTRY +<action> +<start><I></start> +<end></I></end> </rule> <rule> @@ -1323,6 +1438,20 @@ ${_followrel child TITLE &r.pass;}${_attval ID &r.aend;}^</start> <rule> <match> <gi>SCREEN +<context>PARA +<action> +<start></P> +<BLOCKQUOTE><PRE>^</start> +<end>^</PRE></BLOCKQUOTE> +<P></end> +</rule> + +<rule> +<match> +<gi>SCREEN +<action> +<start>^<PRE>^</start> +<end>^</PRE>^</end> </rule> <rule> @@ -1703,10 +1832,18 @@ ${_followrel child TITLE &r.pass;}${_attval ID &r.aend;}<TABLE border="border <rule> <match> <gi>TIP +<relation>child TITLE <action> <do>&r.admona; </rule> +<rule> +<match> +<gi>TIP +<action> +<do>&r.admonb; +</rule> + <!-- Titles in the preface --> <rule> @@ -1763,19 +1900,28 @@ ${_followrel child TITLE &r.pass;}${_attval ID &r.aend;}<TABLE border="border <rule> <match> <gi>TITLE -<context>CHAPTER +<context>^REF.* <action> -<start>^<H1>${_followrel parent CHAPTER 4}Chapter ${chapnum}:<BR>^</start> -<end>${_followrel parent CHAPTER 5}</H1>^</end> +<start>^<H3></start> +<end>^</H3></end> </rule> <rule> <match> <gi>TITLE -<context>^REF.* +<context>PART <action> -<start>^<H3></start> -<end>^</H3></end> +<start>^<H1><A NAME="pt-${partnum}"></A>&hlofont;${_followrel parent PART 4}Part ${partnum}:<BR>^</start> +<end>${_followrel parent PART 5}&hlcfont;</H1>${_followrel parent PART &r.chtoc;t}^</end> +</rule> + +<rule> +<match> +<gi>TITLE +<context>CHAPTER +<action> +<start>^<H1><A NAME="ch-${chapnum}"></A>&hlofont;${_followrel parent CHAPTER 4}${chapnum}&wspace;^</start> +<end>${_followrel parent CHAPTER 5}&hlcfont;</H1>${_followrel parent CHAPTER &r.s1toc;t}^</end> </rule> <rule> @@ -1783,8 +1929,8 @@ ${_followrel child TITLE &r.pass;}${_attval ID &r.aend;}<TABLE border="border <gi>TITLE <context>SECT1 <action> -<start>^<H2>${_followrel parent SECT1 4}${chapnum}.${sect1num}^</start> -<end>${_followrel parent SECT1 5}</H2>^</end> +<start>^<H2><A NAME="s1-${chapnum}-${sect1num}"></A>&hlofont;${_followrel parent SECT1 4}${chapnum}.${sect1num}&wspace;^</start> +<end>${_followrel parent SECT1 5}&hlcfont;</H2>${_followrel parent SECT1 &r.s2toc;t}^</end> </rule> <rule> @@ -1792,8 +1938,8 @@ ${_followrel child TITLE &r.pass;}${_attval ID &r.aend;}<TABLE border="border <gi>TITLE <context>SECT2 <action> -<start>^<H3>${_followrel parent SECT2 4}${chapnum}.${sect1num}.${sect2num}^</start> -<end>${_followrel parent SECT2 5}</H3>^</end> +<start>^<H3><A NAME="s2-${chapnum}-${sect1num}-${sect2num}"></A>&hlofont;${_followrel parent SECT2 4}${chapnum}.${sect1num}.${sect2num}&wspace^</start> +<end>${_followrel parent SECT2 5}&hlcfont;</H3>${_followrel parent SECT2 &r.s3toc;t}^</end> </rule> <rule> @@ -1801,8 +1947,8 @@ ${_followrel child TITLE &r.pass;}${_attval ID &r.aend;}<TABLE border="border <gi>TITLE <context>SECT3 <action> -<start>^<H4>${_followrel parent SECT3 4}${chapnum}.${sect1num}.${sect2num}.${sect3num}^</start> -<end>${_followrel parent SECT1 5}</H4>^</end> +<start>^<H4><A NAME="s3-${chapnum}-${sect1num}-${sect2num}-${sect3num}">&hlofont;${_followrel parent SECT3 4}${chapnum}.${sect1num}.${sect2num}.${sect3num}&wspace;^</start> +<end>${_followrel parent SECT1 5}&hlcfont;</H4>^</end> </rule> <rule> @@ -1810,8 +1956,8 @@ ${_followrel child TITLE &r.pass;}${_attval ID &r.aend;}<TABLE border="border <gi>TITLE <context>SECT4 <action> -<start>^<H4>${_followrel parent SECT4 4}</start> -<end>${_followrel parent SECT4 5}</H4>^</end> +<start>^<H4>&hlofont;${_followrel parent SECT4 4}</start> +<end>${_followrel parent SECT4 5}&hlcfont;</H4>^</end> </rule> <rule> @@ -1819,14 +1965,14 @@ ${_followrel child TITLE &r.pass;}${_attval ID &r.aend;}<TABLE border="border <gi>TITLE <context>SECT5 <action> -<start>^<H4>${_followrel parent SECT5 4}</start> -<end>${_followrel parent SECT5 5}</H4>^</end> +<start>^<H4>&hlofont;${_followrel parent SECT5 4}</start> +<end>${_followrel parent SECT5 5}&hlcfont;</H4>^</end> </rule> <rule> <match> <gi>TITLE -<context>FIGURE|EXAMPLE|TABLE|IMPORTANT +<context>FIGURE|EXAMPLE|TABLE|CAUTION|IMPORTANT|NOTE|TIP|WARNING <!--StartText: ^<P><B> --> <!--EndText: </B></P>^ --> <action> @@ -1951,8 +2097,10 @@ ${_followrel child TITLE &r.pass;}${_attval ID &r.aend;}<TABLE border="border <gi>VARIABLELIST <context>PARA <action> -<start></P>^<DL>^</start> -<end>^</DL>^<P></end> +<start></P> +<DL>^</start> +<end>^</DL> +<P></end> </rule> <rule> @@ -1981,20 +2129,36 @@ ${_followrel child TITLE &r.pass;}${_attval ID &r.aend;}<TABLE border="border <rule> <match> <gi>WARNING +<relation>child TITLE <action> <do>&r.admona; </rule> <rule> <match> +<gi>WARNING +<action> +<do>&r.admonb; +</rule> + +<rule> +<match> <gi>WORDASWORD </rule> <rule> <match> -<gi>XREF + <gi>XREF + <attval>REMAP . <action> -<replace><A HREF="#${LINKEND}"><EM>${_chasetogi TITLE &r.pass}</EM></A></replace> + <replace><A HREF="#${LINKEND}"><EM>${REMAP}</EM></A></replace> +</rule> + +<rule> +<match> + <gi>XREF +<action> + <replace><A HREF="#${LINKEND}"><EM>${_chasetogi TITLE &r.pass}</EM></A></replace> </rule> <rule> @@ -2011,8 +2175,8 @@ ${_followrel child TITLE &r.pass;}${_attval ID &r.aend;}<TABLE border="border <gi>_pass-text </rule> -<!-- Just output the anchor tag and ID. No content. --> -<rule id="&r.astart;"> + +<rule id="&r.astart;"> <!-- Just output the anchor tag and ID. No content. --> <match> <gi>_name <action> @@ -2053,17 +2217,18 @@ ${_followrel child TITLE &r.pass;}${_attval ID &r.aend;}<TABLE border="border <match> <gi>_admonition <action> -<start>^<TABLE border="border"> - <TR><TD><P align="center"><STRONG>${_attval ID &r.astart;}${_followrel child TITLE &r.pass;}${_attval ID &r.aend;}</STRONG></P>^</start> -<end>^</TD></TR></TABLE>^</end> +<start>^<TABLE border="0"> + <TR><TD BGCOLOR="EEEEFF"><P><STRONG>${_attval ID &r.astart;}${_followrel child TITLE &r.pass;}${_attval ID &r.aend;}:</STRONG></P>^</start> +<end></TD></TR></TABLE>^</end> </rule> <rule id="&r.admonb;"> <match> <gi>_admonition <action> -<start>^<TABLE border="border"> - <TR><TD>^</start> +<start>^<TABLE border="0"> +<TR> +<TD BGCOLOR="EEEEFF"><P><STRONG>${_attval ID &r.astart;}${_gi M}${_attval ID &r.aend;}:</STRONG></P></start> <end>^</TD></TR></TABLE>^</end> </rule> @@ -2075,18 +2240,93 @@ ${_followrel child TITLE &r.pass;}${_attval ID &r.aend;}<TABLE border="border <ignore>all </rule> -<rule> +<!-- Generate tables of contents. Each r.??toc scans the subtree for + sectional elements of the specified level, generating a list of links. --> + +<rule id="&r.pttoc;"> <match> -<gi>_Start + <relation>descendant PART <action> -<start>^<!-- Magic _Start GI -->^</start> + <replace>^<DL> +${_find gi PART &r.pttoci;} +</DL>${_set partnum 1}^</replace> </rule> -<rule> +<rule id="&r.pttoci;"> +<match> + <gi>_pttoc +<action> + <replace><DD>Part ${partnum}.&wspace;<EM><A HREF="#pt-${partnum}">${_followrel descendant TITLE &r.pass;}</A></EM></DD>^</replace> + <incr>partnum +</rule> + +<rule id="&r.chtoc;"> +<match> + <relation>descendant CHAPTER +<action> + <replace>^<DL> +${_set tmpchapnum ${chapnum}}${_find gi CHAPTER &r.chtoci;} +</DL>^</replace> + <set>chapnum ${tmpchapnum} +</rule> + +<rule id="&r.chtoci;"> +<match> + <gi>_chtoc +<action> + <replace><DD>${chapnum}.&wspace;<EM><A HREF="#ch-${chapnum}">${_followrel descendant TITLE &r.pass;}</A></EM></DD>^</replace> + <incr>chapnum +</rule> + +<rule id="&r.s1toc;"> +<match> + <relation>descendant SECT1 +<action> + <replace>^<DL> +${_find gi SECT1 &r.s1toci;} +</dl>${_set sect1num 1}^</replace> +</rule> + +<rule id="&r.s1toci;"> +<match> + <gi>_s1toc +<action> + <replace><DD>${chapnum}.${sect1num}.&wspace;<EM><A HREF="#s1-${chapnum}-${sect1num}">${_followrel descendant TITLE &r.pass;}</A></EM></DD>^</replace> + <incr>sect1num +</rule> + +<rule id="&r.s2toc;"> +<match> + <relation>descendant SECT2 +<action> + <replace>^<DL> +${_find gi SECT2 &r.s2toci;} +</dl>${_set sect2num 1}^</replace> +</rule> + +<rule id="&r.s2toci;"> +<match> + <gi>_s2toc +<action> + <replace><DD>${chapnum}.${sect1num}.${sect2num}.&wspace;<EM><A HREF="#s2-${chapnum}-${sect1num}-${sect2num}">${_followrel descendant TITLE &r.pass;}</A></EM></DD>^</replace> + <incr>sect2num +</rule> + +<rule id="&r.s3toc;"> +<match> + <relation>descendant SECT3 +<action> + <replace>^<DL> +${_find gi SECT3 &r.s3toci;} +</dl>${_set sect3num 1}^</replace> +</rule> + +<rule id="&r.s3toci;"> <match> -<gi>_End + <gi>_s3toc <action> -<start>^<!-- Magic _End GI -->^</start> + <replace><DD>${chapnum}.${sect1num}.${sect2num}.${sect3num}.&wspace;<EM><A HREF="#s3-${chapnum}-${sect1num}-${sect2num}-${sect3num}">${_followrel descendant TITLE &r.pass;}</A></EM></DD>^</replace> + <incr>sect3num </rule> </transpec> |