Changeset 38342 for trunk/doc-new


Ignore:
Timestamp:
Jul 16, 2008, 1:09:17 PM (11 years ago)
Author:
simon@…
Message:

doc-new: New target "guide-chunked" which generates a chunked version of the guide.

The table of contents is automatically added to every page after the
generation and the section links are clickable like the normal guide. All
files are created in guide/html/chunked.

The tclsh binary has to be available as a simple Tcl script is used to add the
table of contents. If you know a better way to do this please change it.

Location:
trunk/doc-new
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc-new/Makefile

    r38339 r38342  
    1616RM       = /bin/rm
    1717SED      = /usr/bin/sed
     18TCLSH    = /usr/bin/tclsh
    1819XSLTPROC = $(PREFIX)/bin/xsltproc
    1920XMLLINT  = $(PREFIX)/bin/xmllint
     
    2627MAN-SRC   = $(MAN)/xml
    2728# Result directories.
    28 GUIDE-RESULT = $(GUIDE)/html
    29 MAN-RESULT   = $(MAN)/man/
     29GUIDE-RESULT       = $(GUIDE)/html
     30GUIDE-RESULT-CHUNK = $(GUIDE-RESULT)/chunked
     31MAN-RESULT         = $(MAN)/man/
    3032# Man temporary directory.
    3133MAN-TMP = $(MAN)/tmp
    3234
    3335# Path to the docbook xsl files.
    34 DOCBOOK   = $(PREFIX)/share/xsl/docbook-xsl
    35 GUIDE-XSL = $(DOCBOOK)/xhtml/profile-docbook.xsl
    36 MAN-XSL   = $(MAN)/resources/macports.xsl
     36DOCBOOK         = $(PREFIX)/share/xsl/docbook-xsl
     37GUIDE-XSL       = $(DOCBOOK)/xhtml/profile-docbook.xsl
     38GUIDE-XSL-CHUNK = $(DOCBOOK)/xhtml/chunk.xsl
     39MAN-XSL         = $(MAN)/resources/macports.xsl
    3740
    3841# Docbook html stylesheet for the guide.
     
    4548                     --stringparam section.label.includes.component.label 1 \
    4649                     --stringparam profile.condition "noman"
     50# Additional parameters for the chunked guide.
     51STRINGPARAMS-CHUNK = --stringparam chunk.section.depth 0
    4752
    4853
     
    5661        $(CP) $(GUIDE)/resources/$(STYLESHEET) $(GUIDE-RESULT)/$(STYLESHEET)
    5762        $(CP) $(GUIDE)/resources/images/* $(GUIDE-RESULT)/
    58         $(XSLTPROC) --xinclude $(STRINGPARAMS) --output $(GUIDE-RESULT)/index.html \
     63        $(XSLTPROC) --xinclude $(STRINGPARAMS) \
     64            --output $(GUIDE-RESULT)/index.html \
    5965            $(GUIDE-XSL) $(GUIDE-SRC)/guide.xml
    6066        # Convert all sections (h1-h9) to a link so it's easy to link to them.
     
    6369            's|(<h[0-9] [^>]*><a id="([^"]*)"></a>)([^<]*)(</h[0-9]>)|\1<a href="#\2">\3</a>\4|g' \
    6470            $(GUIDE-RESULT)/index.html
     71
     72# Generate the chunked html guide with one section per file.
     73guide-chunked:
     74        $(MKDIR) -p $(GUIDE-RESULT-CHUNK)
     75        $(CP) $(GUIDE)/resources/$(STYLESHEET) $(GUIDE-RESULT-CHUNK)/$(STYLESHEET)
     76        $(CP) $(GUIDE)/resources/images/* $(GUIDE-RESULT-CHUNK)/
     77        $(XSLTPROC) --xinclude $(STRINGPARAMS) $(STRINGPARAMS-CHUNK) \
     78            --output $(GUIDE-RESULT-CHUNK)/index.html \
     79            $(GUIDE-XSL-CHUNK) $(GUIDE-SRC)/guide.xml
     80        # Convert all sections (h1-h9) to a link so it's easy to link to them.
     81        # If someone knows a better way to do this please change it.
     82        $(SED) -i "" -E \
     83            's|(<h[0-9] [^>]*><a id="([^"]*)"></a>)([^<]*)(</h[0-9]>)|\1<a href="#\2">\3</a>\4|g' \
     84            $(GUIDE-RESULT-CHUNK)/*.html
     85        # Add the table of contents to every junked html file.
     86        # If someone knows a better way to do this please change it.
     87        $(TCLSH) toc-for-chunked.tcl $(GUIDE-RESULT-CHUNK)
     88
    6589
    6690# Generate the man pages using DocBook from the xml source in $(MAN-SRC).
Note: See TracChangeset for help on using the changeset viewer.