[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to make "Debian Reference" as scalable SGML

On Mon, Feb 11, 2002 at 08:59:35PM -0800, Osamu Aoki wrote:
> ### Roadmap to the next stage for "Debian reference" ###
... More thinking on how to separate content from structure

I am thinking to structure the "Debian reference" document so that the
content of each <chapt>, <sect> or <sect1> section is written in a
separate small file.  There is always chance to make <sect> to be
<sect1> or <sect> to become <chapt> during reorganization.  That should
not affect each document.  Creating this modular structure should make
maintenance easier.

It will be a lot of work to impliment it.  But maintenance shall be
easier afterward.  What do you think?

==== Detail plan ====

Main SGML contains only structure, for example as follows:

<!doctype debiandoc public "-//DebianDoc//DTD DebianDoc//EN"
        <!-- textual data entities -->
        <!entity % date     system "date.ent"> %date;
        <!entity % default  system "default.ent"> %default;
        <!entity % dynamic  system "dynamic.ent"> %dynamic;
<!-- CVS revision of this document "$Revision: 1.3 $"  -->

<book id="quick-reference">
        <name>Osamu Aoki</name>
        <name>Qref team (Appendix B)</name>
<version> &version;, &date;</version>

<toc sect1>

<chapt id="html-name-of-chapt-1"><heading>&header-example;</heading>
        <sect id="sect-1"><heading>&header-sect-1;</heading>
                <sect1 id="sect-11"><heading>&header-sect1-11;</heading>
                <sect1 id="sect-12"><heading>&header-sect1-12;</heading>
        <sect id="sect-2"><heading>&header-sect-1;</heading>
                <sect1 id="sect-21"><heading>&header-sect1-21;</heading>
                <sect1 id="sect-22"><heading>&header-sect1-22;</heading>

Then each files in "en" directory contains a comment line at first line which
define content of <heading>...</heading>.

This starting line is, for example:
<!--####"Section 2 title text here"####-->

"Makefile" script will extract this comment dynamically and create SGML
tags and write them to "dynamic.ent". 

        : > $@                       # clear the file
        @echo "<!entity language \"$(TLANG)\">" >> $@
        @echo "<!entity % lang-$(TLANG) \"INCLUDE\">" >> $@
        @for filesgml in $(basename $(notdir $(wildcard $(TLANG)/*.sgml))) ; do
        echo "<!entity file-$${filesgml}        system \"$(TLANG)/$${filesgml}.sgml\">" >> $@ ; \
        head -n1 $(TLANG)/$${filesgml}.sgml | \
        sed -e "s/--####/entity header-$${filesgml}     /" -e "s/####--//" >> $@ ; \

Here TLANG should contain target language such as "en".  Also, this
removes needs to current 'sed "s/@@@@/$(TLANG)/"' hack.

+  Osamu Aoki <debian@aokiconsulting.com> @ Cupertino, CA USA         +

Reply to: