[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] svnbook revision number, take #2 (was Re: doc/book request)

From: Bruce A. Mah <bmah_at_packetdesign.com>
Date: 2003-05-14 01:23:55 CEST

This time with a proper (I think?) log message, incorporating feedback
from other list members. Tested with HTML, partially tested with
PostScript.

Bruce.

-----

Log:

Automatically include a version number in renditions of the book,
as reported by svnversion.

* doc/book/Makefile
  ($(BOOK_VERSION_SOURCE)): Generate a version.xml
  file that defines the output of svnversion as an XML entity.
  ($(BOOK_HTML_TARGET), book-html-chunk, $(BOOK_PDF_TARGET),
  $(BOOK_PS_TARGET)): Depend on the generated version.xml file.
  book-clean: Remove the generated version.xml file.

* doc/book/book/book.xml: Include the generated version.xml file
  and insert its svn.version entity in an appropriate place in the
  bookinfo element.

Index: doc/book/book/book.xml
===================================================================
--- doc/book/book/book.xml (revision 5924)
+++ doc/book/book/book.xml (working copy)
@@ -1,6 +1,8 @@
 <?xml version="1.0"?>
 <!DOCTYPE book SYSTEM "../tools/dtd/dblite.dtd"
 [
+<!ENTITY % vers SYSTEM "version.xml">
+%vers;
 <!ENTITY ch00 SYSTEM "ch00.xml">
 <!ENTITY ch01 SYSTEM "ch01.xml">
 <!ENTITY ch02 SYSTEM "ch02.xml">
@@ -53,8 +55,11 @@
     </editor>
 
     <pagenums>350 pages (est.)</pagenums>
- <pubdate>(TBA)</pubdate>
 
+ <!-- Using revnumber would be more appropriate, but our stylesheets -->
+ <!-- don't seem to render it. -->
+ <pubdate>Draft Revision &svn.version;</pubdate>
+
   </bookinfo>
 
   <!-- External entity refs -->
Index: doc/book/Makefile
===================================================================
--- doc/book/Makefile (revision 5924)
+++ doc/book/Makefile (working copy)
@@ -4,6 +4,7 @@
 
 ## You shouldn't normally need to edit anything below here.
 SHELL = /bin/sh
+SVNVERSION = svnversion
 
 BOOK_TOP = .
 BOOK_HTML_CHUNK_DIR = $(BOOK_DIR)/html-chunk
@@ -13,6 +14,7 @@
 BOOK_PS_TARGET = $(BOOK_DIR)/book.ps
 BOOK_FO_TARGET = $(BOOK_DIR)/book.fo
 BOOK_XML_SOURCE = $(BOOK_DIR)/book.xml
+BOOK_VERSION_SOURCE = $(BOOK_DIR)/version.xml
 BOOK_ALL_SOURCE = $(BOOK_DIR)/*.xml
 BOOK_INSTALL_DIR = $(INSTALL_DIR)/book
 
@@ -61,15 +63,17 @@
 
 clean: book-clean misc-docs-clean
 
+$(BOOK_VERSION_SOURCE):
+ echo '<!ENTITY svn.version "'`$(SVNVERSION) .`'">' > $(BOOK_VERSION_SOURCE)
 
 book-html: $(BOOK_HTML_TARGET)
 
-$(BOOK_HTML_TARGET): $(BOOK_ALL_SOURCE)
+$(BOOK_HTML_TARGET): $(BOOK_ALL_SOURCE) $(BOOK_VERSION_SOURCE)
         $(XSLTPROC) $(BOOK_HTML_XSLTPROC_OPTS) \
            --output $(BOOK_HTML_TARGET) $(XSL_HTML) $(BOOK_XML_SOURCE)
 
 ## This trailing slash is essential that xsltproc will output pages to the dir
-book-html-chunk: $(BOOK_ALL_SOURCE)
+book-html-chunk: $(BOOK_ALL_SOURCE) $(BOOK_VERSION_SOURCE)
         mkdir -p $(BOOK_HTML_CHUNK_DIR)
         $(XSLTPROC) $(BOOK_HTML_XSLTPROC_OPTS) \
            --output $(BOOK_HTML_CHUNK_DIR)/ \
@@ -81,12 +85,12 @@
 
 book-ps: $(BOOK_PS_TARGET)
 
-$(BOOK_PDF_TARGET): $(BOOK_ALL_SOURCE)
+$(BOOK_PDF_TARGET): $(BOOK_ALL_SOURCE) $(BOOK_VERSION_SOURCE)
         $(XSLTPROC) $(BOOK_PDF_XSLTPROC_OPTS) \
            --output $(BOOK_FO_TARGET) $(XSL_FO) $(BOOK_XML_SOURCE)
         $(RUN_FOP) $(BOOK_TOP) -fo $(BOOK_FO_TARGET) -pdf $(BOOK_PDF_TARGET)
 
-$(BOOK_PS_TARGET): $(BOOK_ALL_SOURCE)
+$(BOOK_PS_TARGET): $(BOOK_ALL_SOURCE) $(BOOK_VERSION_SOURCE)
         $(XSLTPROC) $(BOOK_PS_XSLTPROC_OPTS) \
            --output $(BOOK_FO_TARGET) $(XSL_FO) $(BOOK_XML_SOURCE)
         $(RUN_FOP) $(BOOK_TOP) -fo $(BOOK_FO_TARGET) -ps $(BOOK_PS_TARGET)
@@ -114,6 +118,7 @@
         $(INSTALL) $(BOOK_PS_TARGET) $(BOOK_INSTALL_DIR)
 
 book-clean:
+ rm -f $(BOOK_VERSION_SOURCE)
         rm -f $(BOOK_HTML_TARGET) $(BOOK_FO_TARGET)
         rm -rf $(BOOK_HTML_CHUNK_DIR)
         rm -f $(BOOK_PDF_TARGET) $(BOOK_PS_TARGET)

  • application/pgp-signature attachment: stored
Received on Wed May 14 01:24:54 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.