Преглед изворни кода

- Configurable output directory, filename, and extension
- New variable OUTPUT_DIR which can be overriden from doc Makefiles
- Separate stylesheet for plain-text documentation

Jan Janak пре 20 година
родитељ
комит
604587a580
2 измењених фајлова са 26 додато и 9 уклоњено
  1. 23 8
      Makefile.doc
  2. 3 1
      doc/Makefile

+ 23 - 8
Makefile.doc

@@ -14,17 +14,24 @@ DOCUMENTS ?= index
 #
 #
 ROOT_DIR ?= ../../..
 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
 # Stylesheet used to generate dependencies from XML files
 DEP_XSL ?= $(ROOT_DIR)/doc/stylesheets/dep.xsl
 DEP_XSL ?= $(ROOT_DIR)/doc/stylesheets/dep.xsl
 
 
-# Default stylesheet used to generate HTML
+# Default stylesheet used to generate XHTML
 XHTML_XSL ?= $(ROOT_DIR)/doc/stylesheets/xhtml.xsl
 XHTML_XSL ?= $(ROOT_DIR)/doc/stylesheets/xhtml.xsl
 
 
 #
 #
 # Stylesheet used to generate plain text documents,
 # Stylesheet used to generate plain text documents,
 # this is usually the one used for xhtml
 # this is usually the one used for xhtml
 #
 #
-TXT_XSL ?= $(XHTML_XSL)
+TXT_XSL ?= $(ROOT_DIR)/doc/stylesheets/txt.xsl
 
 
 #
 #
 # Disable document validation by default
 # Disable document validation by default
@@ -56,22 +63,31 @@ dep_files = $(addsuffix .d, $(DOCUMENTS))
 xhtml_files = $(addsuffix .xhtml, $(DOCUMENTS))
 xhtml_files = $(addsuffix .xhtml, $(DOCUMENTS))
 txt_files = $(addsuffix .txt, $(DOCUMENTS))
 txt_files = $(addsuffix .txt, $(DOCUMENTS))
 
 
-
 xhtml: $(xhtml_files)
 xhtml: $(xhtml_files)
 txt: $(txt_files)
 txt: $(txt_files)
 
 
 %.xhtml: %.xml %.d $(alldep) $(XHTML_XSL)
 %.xhtml: %.xml %.d $(alldep) $(XHTML_XSL)
-	XML_CATALOG_FILES=$(CATALOG) $(XSLTPROC) $(XSLTPROC_FLAGS) --xinclude -o $@ $(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) $<
 
 
 %.txt: %.xml %.d $(alldep)
 %.txt: %.xml %.d $(alldep)
-	XML_CATALOG_FILES=$(CATALOG) $(XSLTPROC) $(XSLTPROC_FLAGS) --xinclude $(TXT_XSL) $< | \
-	$(LYNX) $(LYNX_FLAGS) -stdin -dump > $@
+	XML_CATALOG_FILES=$(CATALOG) $(XSLTPROC) $(XSLTPROC_FLAGS) \
+        --xinclude \
+        $(TXT_XSL) $< | $(LYNX) $(LYNX_FLAGS) -stdin -dump > $@
 
 
 %.png: %.dia $(alldep)
 %.png: %.dia $(alldep)
 	$(DIA) $(DIA_ARGS) -t png -e $@ $<
 	$(DIA) $(DIA_ARGS) -t png -e $@ $<
 
 
 %.d: %.xml $(alldep) 
 %.d: %.xml $(alldep) 
-	$(XSLTPROC) $(XSLTPROC_FLAGS) --nonet --novalid --stringparam output $@ $(DEP_XSL) $< 
+	$(XSLTPROC) $(XSLTPROC_FLAGS) \
+        --nonet \
+        --novalid \
+        --stringparam output "$@" \
+        $(DEP_XSL) $< 
 
 
 .PHONY: check
 .PHONY: check
 check: $(xml_files)
 check: $(xml_files)
@@ -93,4 +109,3 @@ endif
 ifneq (,$(filter-out clean proper realclean distclean check, $(MAKECMDGOALS)))
 ifneq (,$(filter-out clean proper realclean distclean check, $(MAKECMDGOALS)))
 include $(dep_files)
 include $(dep_files)
 endif
 endif
-

+ 3 - 1
doc/Makefile

@@ -8,6 +8,8 @@ DOCUMENTS = doc_root
 #
 #
 ROOT_DIR=..
 ROOT_DIR=..
 
 
+OUTPUT_DIR=xhtml
+
 #
 #
 # Validate docbook documents before generating output
 # Validate docbook documents before generating output
 # (may be slow)
 # (may be slow)
@@ -18,7 +20,7 @@ ROOT_DIR=..
 # You can override the stylesheet used to generate
 # You can override the stylesheet used to generate
 # xhtml documents here
 # xhtml documents here
 #
 #
-#XHTML_XSL=$(ROOT_DIR)/doc/stylesheets/xhtml.xsl
+XHTML_XSL=$(ROOT_DIR)/doc/stylesheets/xhtml.chunked.xsl
 
 
 #
 #
 # You can override the stylesheet used to generate
 # You can override the stylesheet used to generate