From 399eacb9da9e6c7cf56fb31e95ebfcbdca95d6ec Mon Sep 17 00:00:00 2001 From: Eduardo de Santana Medeiros Alexandre Date: Fri, 18 Apr 2014 15:12:18 -0300 Subject: [PATCH] Add the posibility to pass the edition as an attribute How to test this change: ./a2x.py -f pdf -a edition="2" doc/book.txt See the result at botton of first page. --- doc/asciidoc.txt | 20 ++++++++++++++++++++ docbook45.conf | 3 +++ 2 files changed, 23 insertions(+) diff --git a/doc/asciidoc.txt b/doc/asciidoc.txt index 4665dcf..46c3b1d 100644 --- a/doc/asciidoc.txt +++ b/doc/asciidoc.txt @@ -719,6 +719,26 @@ DocBook:: distribution. The rendering of meta-data elements (or not) is DocBook processor dependent. +Passing the Edition as an attribute ++++++++++++++++++++++++++++++++++++ + +You can pass the `edition` of the book as an attribute: + + $ a2x -f pdf -a edition="Second" book.txt + +[WARNING] +If you are planning using it as an attribute, and were using it inside +<> you should remove the `edition` tag from there. +Asciidoc doesn't do any check, if you using it in both places (docinfo +and attribute) the generated xml will have two `edition` tags at the +`bookinfo` xml section. + +If you are writting your book in a version control systems you can +extract a build number and use it as the Edition. Here's an example +http://git-scm.com/book/en/Distributed-Git-Maintaining-a-Project#Generating-a-Build-Number[with git]: + + $ a2x -f pdf -a edition=`git describe --tags` book.txt + [[X86]] Preamble diff --git a/docbook45.conf b/docbook45.conf index 76cbd0f..01280fb 100644 --- a/docbook45.conf +++ b/docbook45.conf @@ -692,6 +692,9 @@ template::[header-declarations] template::[docinfo] +# If you have specified the edition in your docinfo, +# docbook uses the last one, defined here: +{edition? {edition}} [footer]