2
0
Эх сурвалжийг харах

Added drupal as new target for doc makefile using new drupal.xsl (thanks to Jan).
The new target will generate docs without the html headers ready for inclusion into
drupal cms used by iptel.org

To build all module docs:
make exclude_modules="" doc_format="drupal" module-docs

Greger V. Teigre 19 жил өмнө
parent
commit
b462577b05
2 өөрчлөгдсөн 324 нэмэгдсэн , 152 устгасан
  1. 161 152
      Makefile.doc
  2. 163 0
      doc/stylesheets/drupal.xsl

+ 161 - 152
Makefile.doc

@@ -1,152 +1,161 @@
-#
-# $Id$
-#
-
-#
-# The name of the index file (the one which will be built by default
-# without specifying a target
-#
-DOCUMENTS ?= index
-
-#
-# The root of the document tree, this is used to determine the directory
-# of auxiliary files. The variable should be overwritten by per-directory
-# Makefiles
-#
-ROOT_DIR ?= ../../..
-
-#
-# Output directory where files produced by XSL stylesheets should be stored,
-# by default we output to the same directory, documents that are chunked may
-# choose to override this to write all chunks in a subdirectory instead
-#
-OUTPUT_DIR ?= .
-
-#
-# Stylesheet used to generate dependencies from XML files
-#
-DEP_XSL ?= $(ROOT_DIR)/doc/stylesheets/dep.xsl
-
-#
-# Default stylesheet used to generate XHTML
-#
-XHTML_XSL ?= $(ROOT_DIR)/doc/stylesheets/xhtml.xsl
-
-#
-# Default stylesheet used to generate HTML
-#
-HTML_XSL ?= $(ROOT_DIR)/doc/stylesheets/html.chunked.xsl
-
-#
-# Stylesheet used to generate plain text documents,
-# this is usually the one used for xhtml
-#
-TXT_XSL ?= $(ROOT_DIR)/doc/stylesheets/txt.xsl
-
-#
-# Stylesheet used to generate FO (Formatted Objects)
-# This is used by PDF generators
-#
-FO_XSL ?= $(ROOT_DIR)/doc/stylesheets/fo.xsl
-
-#
-# Disable document validation by default
-# 
-VALIDATE ?= 0
-
-CATALOG=$(ROOT_DIR)/doc/catalog.xml
-
-LYNX     ?= lynx
-DIA      ?= dia
-XSLTPROC ?= xsltproc
-XMLLINT ?= /usr/bin/xmllint
-XEP     ?= /usr/bin/xep
-
-LYNX_FLAGS     ?= -nolist
-DIA_ARGS       ?=
-XSLTPROC_FLAGS ?=
-XMLLINT_FLAGS ?= --xinclude --postvalid --noout
-XEP_FLAGS ?= 
-
-ifeq ($(VALIDATE), 0)
-	override XSLTPROC_FLAGS := $(XSLTPROC_FLAGS) --novalid
-endif
-
-alldep = Makefile $(ROOT_DIR)/Makefile.doc $(DEP_XSL)
-
-all: xhtml
-
-xml_files = $(addsuffix .xml, $(DOCUMENTS))
-dep_files = $(addsuffix .d, $(DOCUMENTS))
-xhtml_files = $(addsuffix .xhtml, $(DOCUMENTS))
-html_files = $(addsuffix .html, $(DOCUMENTS))
-txt_files = $(addsuffix .txt, $(DOCUMENTS))
-pdf_files = $(addsuffix .pdf, $(DOCUMENTS))
-
-xhtml: $(xhtml_files)
-html: $(html_files)
-txt: $(txt_files)
-pdf: $(pdf_files)
-
-%.xhtml: %.xml %.d $(alldep) $(XHTML_XSL)
-	XML_CATALOG_FILES=$(CATALOG) $(XSLTPROC) $(XSLTPROC_FLAGS) \
-        --xinclude \
-        --stringparam base.dir "$(OUTPUT_DIR)/" \
-        --stringparam root.filename "$(basename $<)" \
-        --stringparam html.ext ".xhtml" \
-        $(XHTML_XSL) $<
-
-%.html: %.xml %.d $(alldep) $(HTML_XSL)
-	XML_CATALOG_FILES=$(CATALOG) $(XSLTPROC) $(XSLTPROC_FLAGS) \
-        --xinclude \
-        --stringparam base.dir "$(OUTPUT_DIR)/" \
-        --stringparam root.filename "$(basename $<)" \
-        --stringparam html.ext ".html" \
-	--stringparam html.stylesheet ser.css \
-        $(HTML_XSL) $<
-
-%.fo: %.xml $(alldep) $(FO_XSL)
-	XML_CATALOG_FILES=$(CATALOG) $(XSLTPROC) $(XSLTPROC_FLAGS) \
-        --xinclude \
-        -o $@ $(FO_XSL) $<
-
-%.pdf: %.fo %.d $(alldep)
-	$(XEP) $(XEP_FLAGS) -fo $< -pdf $@
-
-%.txt: %.xml %.d $(alldep)
-	XML_CATALOG_FILES=$(CATALOG) $(XSLTPROC) $(XSLTPROC_FLAGS) \
-        --xinclude \
-        $(TXT_XSL) $< | $(LYNX) $(LYNX_FLAGS) -stdin -dump > $@
-
-%.png: %.dia $(alldep)
-	$(DIA) $(DIA_ARGS) -t png -e $@ $<
-
-%.d: %.xml $(alldep) 
-	$(XSLTPROC) $(XSLTPROC_FLAGS) \
-        --nonet \
-        --novalid \
-        --stringparam output "$@" \
-        $(DEP_XSL) $< 
-
-.PHONY: check
-check: $(xml_files)
-	XML_CATALOG_FILES=$(CATALOG) $(XMLLINT) $(XMLLINT_FLAGS) $<
-
-.PHONY: clean
-clean:
-	rm -f $(txt_files)
-	rm -f $(xhtml_files)
-	rm -f $(pdf_files)
-
-.PHONY: proper realclean distclean
-proper realclean distclean: clean
-	rm -f $(dep_files) *~
-
-
-ifeq (,$(MAKECMDGOALS))
-include $(dep_files) 
-endif
-ifneq (,$(filter-out clean proper realclean distclean check, $(MAKECMDGOALS)))
-include $(dep_files)
-endif
-
+#
+# $Id$
+#
+
+#
+# The name of the index file (the one which will be built by default
+# without specifying a target
+#
+DOCUMENTS ?= index
+
+#
+# The root of the document tree, this is used to determine the directory
+# of auxiliary files. The variable should be overwritten by per-directory
+# Makefiles
+#
+ROOT_DIR ?= ../../..
+
+#
+# Output directory where files produced by XSL stylesheets should be stored,
+# by default we output to the same directory, documents that are chunked may
+# choose to override this to write all chunks in a subdirectory instead
+#
+OUTPUT_DIR ?= .
+
+#
+# Stylesheet used to generate dependencies from XML files
+#
+DEP_XSL ?= $(ROOT_DIR)/doc/stylesheets/dep.xsl
+
+#
+# Default stylesheet used to generate XHTML
+#
+XHTML_XSL ?= $(ROOT_DIR)/doc/stylesheets/xhtml.xsl
+
+#
+# Default stylesheet used to generate Drupal HTML without html headers
+#
+DRUPAL_XSL ?= $(ROOT_DIR)/doc/stylesheets/drupal.xsl
+
+#
+# Default stylesheet used to generate HTML
+#
+HTML_XSL ?= $(ROOT_DIR)/doc/stylesheets/html.chunked.xsl
+
+#
+# Stylesheet used to generate plain text documents,
+# this is usually the one used for xhtml
+#
+TXT_XSL ?= $(ROOT_DIR)/doc/stylesheets/txt.xsl
+
+#
+# Stylesheet used to generate FO (Formatted Objects)
+# This is used by PDF generators
+#
+FO_XSL ?= $(ROOT_DIR)/doc/stylesheets/fo.xsl
+
+#
+# Disable document validation by default
+# 
+VALIDATE ?= 0
+
+CATALOG=$(ROOT_DIR)/doc/catalog.xml
+
+LYNX     ?= lynx
+DIA      ?= dia
+XSLTPROC ?= xsltproc
+XMLLINT ?= /usr/bin/xmllint
+XEP     ?= /usr/bin/xep
+
+LYNX_FLAGS     ?= -nolist
+DIA_ARGS       ?=
+XSLTPROC_FLAGS ?=
+XMLLINT_FLAGS ?= --xinclude --postvalid --noout
+XEP_FLAGS ?= 
+
+ifeq ($(VALIDATE), 0)
+	override XSLTPROC_FLAGS := $(XSLTPROC_FLAGS) --novalid
+endif
+
+alldep = Makefile $(ROOT_DIR)/Makefile.doc $(DEP_XSL)
+
+all: xhtml
+
+xml_files = $(addsuffix .xml, $(DOCUMENTS))
+dep_files = $(addsuffix .d, $(DOCUMENTS))
+xhtml_files = $(addsuffix .xhtml, $(DOCUMENTS))
+html_files = $(addsuffix .html, $(DOCUMENTS))
+txt_files = $(addsuffix .txt, $(DOCUMENTS))
+pdf_files = $(addsuffix .pdf, $(DOCUMENTS))
+
+xhtml: $(xhtml_files)
+html: $(html_files)
+txt: $(txt_files)
+pdf: $(pdf_files)
+drupal: override HTML_XSL := $(DRUPAL_XSL)
+drupal: $(html_files)
+
+
+%.xhtml: %.xml %.d $(alldep) $(XHTML_XSL)
+	XML_CATALOG_FILES=$(CATALOG) $(XSLTPROC) $(XSLTPROC_FLAGS) \
+        --xinclude \
+        --stringparam base.dir "$(OUTPUT_DIR)/" \
+        --stringparam root.filename "$(basename $<)" \
+        --stringparam html.ext ".xhtml" \
+        $(XHTML_XSL) $<
+
+%.html: %.xml %.d $(alldep) $(HTML_XSL)
+	XML_CATALOG_FILES=$(CATALOG) $(XSLTPROC) $(XSLTPROC_FLAGS) \
+        --xinclude \
+        --stringparam base.dir "$(OUTPUT_DIR)/" \
+        --stringparam root.filename "$(basename $<)" \
+        --stringparam html.ext ".html" \
+	--stringparam html.stylesheet ser.css \
+        $(HTML_XSL) $<
+
+%.fo: %.xml $(alldep) $(FO_XSL)
+	XML_CATALOG_FILES=$(CATALOG) $(XSLTPROC) $(XSLTPROC_FLAGS) \
+        --xinclude \
+        -o $@ $(FO_XSL) $<
+
+%.pdf: %.fo %.d $(alldep)
+	$(XEP) $(XEP_FLAGS) -fo $< -pdf $@
+
+%.txt: %.xml %.d $(alldep)
+	XML_CATALOG_FILES=$(CATALOG) $(XSLTPROC) $(XSLTPROC_FLAGS) \
+        --xinclude \
+        $(TXT_XSL) $< | $(LYNX) $(LYNX_FLAGS) -stdin -dump > $@
+
+%.png: %.dia $(alldep)
+	$(DIA) $(DIA_ARGS) -t png -e $@ $<
+
+%.d: %.xml $(alldep) 
+	$(XSLTPROC) $(XSLTPROC_FLAGS) \
+        --nonet \
+        --novalid \
+        --stringparam output "$@" \
+        $(DEP_XSL) $< 
+
+.PHONY: check
+check: $(xml_files)
+	XML_CATALOG_FILES=$(CATALOG) $(XMLLINT) $(XMLLINT_FLAGS) $<
+
+.PHONY: clean
+clean:
+	rm -f $(txt_files)
+	rm -f $(xhtml_files)
+	rm -f $(pdf_files)
+	rm -f $(html_files)
+
+.PHONY: proper realclean distclean
+proper realclean distclean: clean
+	rm -f $(dep_files) *~
+
+
+ifeq (,$(MAKECMDGOALS))
+include $(dep_files) 
+endif
+ifneq (,$(filter-out clean proper realclean distclean check, $(MAKECMDGOALS)))
+include $(dep_files)
+endif
+

+ 163 - 0
doc/stylesheets/drupal.xsl

@@ -0,0 +1,163 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" xmlns="http://www.w3.org/1999/xhtml" version="1.0" exclude-result-prefixes="exsl">
+
+    <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"/>
+    <xsl:import href="xhtml.common.xsl"/>
+
+    <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/xhtml/chunk-common.xsl"/>
+
+    <xsl:include href="http://docbook.sourceforge.net/release/xsl/current/xhtml/manifest.xsl"/>
+    <xsl:include href="http://docbook.sourceforge.net/release/xsl/current/xhtml/chunk-code.xsl"/>
+    
+    <xsl:param name="use.id.as.filename">yes</xsl:param>
+    <xsl:param name="chunk.quietly">1</xsl:param>
+    <xsl:param name="suppress.header.navigation">1</xsl:param>
+
+
+<xsl:template name="chunk-element-content">
+  <xsl:param name="prev"/>
+  <xsl:param name="next"/>
+  <xsl:param name="nav.context"/>
+  <xsl:param name="content">
+    <xsl:apply-imports/>
+  </xsl:param>
+
+<!--
+ <xsl:call-template name="user.preroot"/>
+-->
+      <xsl:call-template name="user.header.navigation"/>
+
+      <xsl:call-template name="header.navigation">
+        <xsl:with-param name="prev" select="$prev"/>
+        <xsl:with-param name="next" select="$next"/>
+        <xsl:with-param name="nav.context" select="$nav.context"/>
+      </xsl:call-template>
+
+      <xsl:call-template name="user.header.content"/>
+
+      <xsl:copy-of select="$content"/>
+
+      <xsl:call-template name="user.footer.content"/>
+
+      <xsl:call-template name="footer.navigation">
+        <xsl:with-param name="prev" select="$prev"/>
+        <xsl:with-param name="next" select="$next"/>
+        <xsl:with-param name="nav.context" select="$nav.context"/>
+      </xsl:call-template>
+
+      <xsl:call-template name="user.footer.navigation"/>
+</xsl:template>
+
+<!---    
+    <xsl:template name="dbhtml-chunk">
+	<xsl:param name="pis" select="./processing-instruction('dbhtml')"/>
+	<xsl:call-template name="dbhtml-attribute">
+	    <xsl:with-param name="pis" select="$pis"/>
+	    <xsl:with-param name="attribute">chunk</xsl:with-param>
+	</xsl:call-template>
+    </xsl:template>
+-->
+    <!-- Override chunk template, it will also check if the dbhtml PI contains
+         chunk="yes" attribute and if so then it will start a new chunk. This
+         allows for fine-grained manual chunking
+    -->
+<!--
+    <xsl:template name="chunk">
+	<xsl:param name="node" select="."/>
+
+	<xsl:variable name="make_chunk">
+	    <xsl:call-template name="dbhtml-chunk">
+		<xsl:with-param name="pis" select="$node/processing-instruction('dbhtml')"/>
+	    </xsl:call-template>
+	</xsl:variable>
+
+	<xsl:choose>
+	    <xsl:when test="$make_chunk='yes'">1</xsl:when>
+	    <xsl:when test="not($node/parent::*)">1</xsl:when>
+	    <xsl:when test="local-name($node)='sect1' and 
+		            $chunk.section.depth &gt;= 1 and 
+		            ($chunk.first.sections != 0 or
+		            count($node/preceding-sibling::sect1) &gt; 0)
+		           ">
+		<xsl:text>1</xsl:text>
+	    </xsl:when>
+	    <xsl:when test="local-name($node)='sect2' and 
+		            $chunk.section.depth &gt;= 2 and 
+		            ($chunk.first.sections != 0 or 
+		            count($node/preceding-sibling::sect2) &gt; 0)
+		           ">
+		<xsl:call-template name="chunk">
+		    <xsl:with-param name="node" select="$node/parent::*"/>
+		</xsl:call-template>
+	    </xsl:when>
+	    <xsl:when test="local-name($node)='sect3' and 
+		            $chunk.section.depth &gt;= 3 and 
+		            ($chunk.first.sections != 0 or
+		            count($node/preceding-sibling::sect3) &gt; 0)
+		           ">
+		<xsl:call-template name="chunk">
+		    <xsl:with-param name="node" select="$node/parent::*"/>
+		</xsl:call-template>
+	    </xsl:when>
+	    <xsl:when test="local-name($node)='sect4' and 
+		            $chunk.section.depth &gt;= 4 and 
+		            ($chunk.first.sections != 0 or 
+		            count($node/preceding-sibling::sect4) &gt; 0)
+		           ">
+		<xsl:call-template name="chunk">
+		    <xsl:with-param name="node" select="$node/parent::*"/>
+		</xsl:call-template>
+	    </xsl:when>
+	    <xsl:when test="local-name($node)='sect5' and 
+		            $chunk.section.depth &gt;= 5 and 
+		            ($chunk.first.sections != 0 or 
+		            count($node/preceding-sibling::sect5) &gt; 0)
+		           ">
+		<xsl:call-template name="chunk">
+		    <xsl:with-param name="node" select="$node/parent::*"/>
+		</xsl:call-template>
+	    </xsl:when>
+	    <xsl:when test="local-name($node)='section' and 
+		            $chunk.section.depth&gt;=count($node/ancestor::section)+1
+		            and  ($chunk.first.sections != 0 or 
+		            count($node/preceding-sibling::section) &gt; 0)
+		           ">
+		<xsl:call-template name="chunk">
+		    <xsl:with-param name="node" select="$node/parent::*"/>
+		</xsl:call-template>
+	    </xsl:when>
+	    
+	    <xsl:when test="local-name($node)='preface'">1</xsl:when>
+	    <xsl:when test="local-name($node)='chapter'">1</xsl:when>
+	    <xsl:when test="local-name($node)='appendix'">1</xsl:when>
+	    <xsl:when test="local-name($node)='article'">1</xsl:when>
+	    <xsl:when test="local-name($node)='part'">1</xsl:when>
+	    <xsl:when test="local-name($node)='reference'">1</xsl:when>
+	    <xsl:when test="local-name($node)='refentry'">1</xsl:when>
+
+	    <xsl:when test="local-name($node)='index' and 
+		            ($generate.index != 0 or count($node/*) &gt; 0) 
+		            and (local-name($node/parent::*) = 'article' or 
+		            local-name($node/parent::*) = 'book' or 
+		            local-name($node/parent::*) = 'part')">1
+	    </xsl:when>
+	    <xsl:when test="local-name($node)='bibliography' and 
+		            (local-name($node/parent::*) = 'article' or 
+		            local-name($node/parent::*) = 'book' or 
+		            local-name($node/parent::*) = 'part')">1</xsl:when>
+	    <xsl:when test="local-name($node)='glossary' and 
+		            (local-name($node/parent::*) = 'article' or 
+		            local-name($node/parent::*) = 'book' or 
+		            local-name($node/parent::*) = 'part')">1</xsl:when>
+	    <xsl:when test="local-name($node)='colophon'">1</xsl:when>
+	    <xsl:when test="local-name($node)='book'">1</xsl:when>
+	    <xsl:when test="local-name($node)='set'">1</xsl:when>
+	    <xsl:when test="local-name($node)='setindex'">1</xsl:when>
+	    <xsl:when test="local-name($node)='legalnotice' and $generate.legalnotice.link != 0">1</xsl:when>
+	    <xsl:otherwise>0</xsl:otherwise>
+	</xsl:choose>
+    </xsl:template>
+-->
+
+</xsl:stylesheet>