https://github.com/oreillymedia/docbook2asciidoc
XSL for transforming DocBook to AsciiDoc
https://github.com/oreillymedia/docbook2asciidoc
Last synced: 17 days ago
JSON representation
XSL for transforming DocBook to AsciiDoc
- Host: GitHub
- URL: https://github.com/oreillymedia/docbook2asciidoc
- Owner: oreillymedia
- License: mit
- Created: 2012-02-23T17:05:02.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2017-02-02T21:53:09.000Z (about 8 years ago)
- Last Synced: 2025-02-15T06:41:20.277Z (2 months ago)
- Language: XSLT
- Homepage:
- Size: 4.94 MB
- Stars: 61
- Watchers: 38
- Forks: 33
- Open Issues: 13
-
Metadata Files:
- Readme: README.asciidoc
- License: LICENSE
Awesome Lists containing this project
README
This is a stylesheet for transforming DocBook 4.5 to http://www.methods.co.nz/asciidoc/[AsciiDoc], originally started by https://github.com/bjepson[bjepson].
== Dependencies
This project has a http://git-scm.com/book/en/v2/Git-Tools-Submodules[submodule] (https://github.com/oreillymedia/docbook2htmlbook). To clone down the repo with the submodule, use the ++--recursive++ flag:
----
git clone --recursive [email protected]:oreillymedia/docbook2htmlbook.git
----If you don't use ++--recursive++ to clone, you'll need to initialize the subdirectory as a separate couple steps:
----
$ cd docbook2htmlbook
$ git submodule init
$ git submodule update
----To update the submodule from then on, you can either cd into the subdirectory and pull, or you can run this command:
----
git submodule update --remote docbook2htmlbook
----The XSLT is written in XSLT 2.0, so you'll need to run it with an XSLT 2.0 processor. You can use http://sourceforge.net/projects/saxon/files/Saxon-HE/9.2/saxonhe9-2-1-5j.zip/download[Saxon], which is included in this repo.
== Run It
Run a command like this on a consolidated DocBook file to output the AsciiDoc - use either d2a_docbook.xsl or d2a_htmlbook.xsl, depending on your project needs:
----
java -jar saxon9he.jar -s book.xml -o book.asciidoc d2a_docbook.xsl
----If you'd like the AsciiDoc output to be "chunked" into separate files for each preface/chapter/appendix, add the parameter
+chunk-output=true+:----
java -jar saxon9he.jar -s book.xml -o book.asciidoc d2a_docbook.xsl chunk-output=true
----Content within of the DocBook source will be output as XML to the filename specified in the parameter "bookinfo-doc-name". For example:
----
java -jar saxon9he.jar -s book.xml -o book.asciidoc d2a_docbook.xsl chunk-output=true bookinfo-doc-name="mybookinfo.xml"
----Default value of "bookinfo-doc-name" is "book-docinfo.xml"
=== Other Parameter Options:
* If you'd like the Glossary element to be output inside a DocBook passthrough, instead of Asciidoc markup, add the parameter +glossary-passthrough=true+:
----
java -jar saxon9he.jar -s book.xml -o book.asciidoc d2a_docbook.xsl glossary-passthrough=true
----
* If you'd like to strip out the indexterm elements, use the parameter +strip-indexterms=true+:
----
java -jar saxon9he.jar -s book.xml -o book.asciidoc d2a_docbook.xsl strip-indexterms=true
----== Example
This example shows how to run this script for a subversion repository
First, you have to clone this repo so that you'll have the code.
----
$ git clone --recursive https://[email protected]/oreillymedia/docbook2asciidoc.git
----Second, pull down the repo for the book you want:
----
$ svn checkout https://prod.oreilly.com/internal/books/9781449307110/
----Third, make a new directory where the asciidoc files will go:
----
$ cd ~/Desktop
$ mkdir test
$ cd test
----Finally, run the file command to convert the big docbook file into separate asciidoc files. Note that you'll need Java 1.5 [*NEED TO CONFIRM VERSION*] or higher. You'll also need to add hardcoded paths to the saxon jar file and to :
----
java -jar /Users/odewahn/Desktop/docbook2asciidoc/saxon9he.jar -s /Users/odewahn/Desktop/9781449307110/current/book.xml -o book.asciidoc /Users/odewahn/Desktop/docbook2asciidoc/d2a_docbook.xsl chunk-output=true
----