Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Nov 2000 22:48:27 +0000
From:      Nik Clayton <nik@freebsd.org>
To:        doc@freebsd.org
Subject:   Indexing in DocBook
Message-ID:  <20001112224826.A7270@canyon.nothing-going-on.org>

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

--qMm9M+Fa2AknHoGS
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Folks,

Attached, find a first draft at support for automatic index generation.

This is so that people can play around with it, and let me know what breaks.
Of course, if it breaks, feel free to fix it :-)

The patch touches a number of files:

    .../fdp-primer/*    I needed something to test it on, so I've added
                        a couple of simple index entries to the primer.

                        Note the use of <indexterm><primary>...</></>
                        and the "significance" attribute that I use once.

    doc.docbook.mk      Introduce the GEN_INDEX variable, and conditionally
                        build the index.sgml file if it's defined.

This only works for HTML at the moment, I haven't investigated doing it 
for PS and PDF.  This probably means that PS and PDF generation will be 
broken -- naturally, I don't intend to commit any of this until that's
solved.

N  
-- 
Internet connection, $19.95 a month.  Computer, $799.95.  Modem, $149.95.
Telephone line, $24.95 a month.  Software, free.  USENET transmission,
hundreds if not thousands of dollars.  Thinking before posting, priceless.
Somethings in life you can't buy.  For everything else, there's MasterCard.
  -- Graham Reed, in the Scary Devil Monastery

--qMm9M+Fa2AknHoGS
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=diff

Index: en_US.ISO_8859-1/books/fdp-primer/book.sgml
===================================================================
RCS file: /home/ncvs/doc/en_US.ISO_8859-1/books/fdp-primer/book.sgml,v
retrieving revision 1.12
diff -u -r1.12 book.sgml
--- en_US.ISO_8859-1/books/fdp-primer/book.sgml	2000/07/16 16:36:17	1.12
+++ en_US.ISO_8859-1/books/fdp-primer/book.sgml	2000/11/12 21:55:37
@@ -37,6 +37,7 @@
 
 <!ENTITY % chapters SYSTEM "chapters.ent"> %chapters;
 <!ENTITY % not.published "INCLUDE">
+<!ENTITY index SYSTEM "index.sgml">
 ]>
 
 <book>
@@ -282,7 +283,8 @@
   &chap.see-also;
 
   &app.examples;
-  
+
+  &index;  
 </book>
 
 <!--
Index: en_US.ISO_8859-1/books/fdp-primer/overview/chapter.sgml
===================================================================
RCS file: /home/ncvs/doc/en_US.ISO_8859-1/books/fdp-primer/overview/chapter.sgml,v
retrieving revision 1.5
diff -u -r1.5 chapter.sgml
--- en_US.ISO_8859-1/books/fdp-primer/overview/chapter.sgml	2000/07/07 18:38:23	1.5
+++ en_US.ISO_8859-1/books/fdp-primer/overview/chapter.sgml	2000/11/12 21:58:27
@@ -44,7 +44,10 @@
       effectively use the tools available to you when writing
       documentation</emphasis>.</para>
   
-  <para>Every one is welcome to join the FDP.  There is no minimum
+  <para><indexterm>
+      <primary>Membership</primary>
+    </indexterm>
+Every one is welcome to join the FDP.  There is no minimum
     membership requirement, no quota of documentation you need to
     produce per month.  All you need to do is subscribe to the
     <email>freebsd-doc@FreeBSD.org</email> mailing list.</para>
Index: en_US.ISO_8859-1/books/fdp-primer/sgml-primer/chapter.sgml
===================================================================
RCS file: /home/ncvs/doc/en_US.ISO_8859-1/books/fdp-primer/sgml-primer/chapter.sgml,v
retrieving revision 1.15
diff -u -r1.15 chapter.sgml
--- en_US.ISO_8859-1/books/fdp-primer/sgml-primer/chapter.sgml	2000/11/01 22:38:35	1.15
+++ en_US.ISO_8859-1/books/fdp-primer/sgml-primer/chapter.sgml	2000/11/12 22:39:41
@@ -570,7 +570,10 @@
 	<term><literal>PUBLIC "-//W3C//DTD HTML 4.0//EN"</literal></term>
 
 	<listitem>
-	  <para>Lists the Formal Public Identifier (FPI) for the DTD that this
+	  <para>Lists the Formal Public Identifier (FPI)<indexterm>
+	      <primary>Formal Public Identifier</primary>
+	    </indexterm>
+ for the DTD that this
 	    document conforms to.  Your SGML parser will use this to find the
 	    correct DTD when processing this document.</para>
 
@@ -592,7 +595,10 @@
     </variablelist>
     
     <sect2>
-      <title>Formal Public Identifiers (FPIs)</title>
+      <title>Formal Public Identifiers (FPIs)<indexterm significance="preferred">
+	  <primary>Formal Public Identifier</primary>
+	</indexterm>
+</title>
 
       <note>
 	<para>You don't need to know this, but it's useful background, and
Index: share/mk/doc.docbook.mk
===================================================================
RCS file: /home/ncvs/doc/share/mk/doc.docbook.mk,v
retrieving revision 1.25
diff -u -r1.25 doc.docbook.mk
--- share/mk/doc.docbook.mk	2000/10/31 14:39:13	1.25
+++ share/mk/doc.docbook.mk	2000/11/12 22:33:33
@@ -26,6 +26,7 @@
 #			SRCS causes the documents to be rebuilt.
 #
 
+
 # ------------------------------------------------------------------------
 #
 # Variables used by both users and documents:
@@ -42,6 +43,10 @@
 #
 #	NO_TIDY		If you do not want to use tidy, set this to "YES".
 #
+#       GEN_INDEX       If defined, index.sgml will be added to the list
+#                       of dependencies for source files, and collateindex.pl
+#                       will be run to generate index.sgml.
+#
 # Documents should use the += format to access these.
 #
 
@@ -148,10 +153,14 @@
 CLEANFILES+= ${DOC}.tar
 .elif ${_cf} == "pdb"
 _docs+= ${DOC}.pdb ${.CURDIR:T}.pdb
-+CLEANFILES+= ${DOC}.pdb ${.CURDIR:T}.pdb
+CLEANFILES+= ${DOC}.pdb ${.CURDIR:T}.pdb
 .endif
 .endfor
 
+.if defined(GEN_INDEX)
+CLEANFILES+=HTML.index
+.endif
+
 #
 # Build a list of install-${format}.${compress_format} targets to be
 # by "make install". Also, add ${DOC}.${format}.${compress_format} to
@@ -181,12 +190,20 @@
 all: ${_docs}
 
 index.html HTML.manifest: ${SRCS} ${LOCAL_IMAGES_LIB} ${IMAGES_PNG}
+.if defined(GEN_INDEX)
+	${JADE} -V html-index -ioutput.html -ioutput.html.images ${JADEOPTS} -d ${DSLHTML} -t sgml ${MASTERDOC}
+	perl ${PREFIX}/share/sgml/docbook/dsssl/modular/bin/collateindex.pl -o index.sgml HTML.index
+.endif
 	${JADE} -V html-manifest -ioutput.html -ioutput.html.images ${JADEOPTS} -d ${DSLHTML} -t sgml ${MASTERDOC}
 .if !defined(NO_TIDY)
 	-tidy -i -m -f /dev/null ${TIDYFLAGS} `xargs < HTML.manifest`
 .endif
 
 ${DOC}.html: ${SRCS} ${LOCAL_IMAGES_LIB} ${IMAGES_PNG}
+.if defined(GEN_INDEX)
+	${JADE} -V html-index -ioutput.html -ioutput.html.images -V nochunks ${JADEOPTS} -d ${DSLHTML} -t sgml ${MASTERDOC}
+	perl ${PREFIX}/share/sgml/docbook/dsssl/modular/bin/collateindex.pl -o index.sgml HTML.index
+.endif
 	${JADE} -ioutput.html -ioutput.html.images -V nochunks ${JADEOPTS} -d ${DSLHTML} -t sgml ${MASTERDOC} > ${.TARGET} || (rm -f ${.TARGET} && false)
 .if !defined(NO_TIDY)
 	-tidy -i -m -f /dev/null ${TIDYFLAGS} ${.TARGET}

--qMm9M+Fa2AknHoGS--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-doc" in the body of the message




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