Coder Social home page Coder Social logo

docbook2asciidoc's Introduction

This is a stylesheet for transforming DocBook 4.5 to AsciiDoc, originally started by bjepson.

Dependencies

The XSLT is written in XSLT 2.0, so you’ll need to run it with an XSLT 2.0 processor. You can use Saxon, which is included in this repo.

Run It

Run a command like this to output the AsciiDoc:

java -jar saxon9he.jar -s book.xml -o book.asc d2a.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.asc d2a.xsl chunk-output=true

Content within <bookinfo> 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.asc d2a.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.asc d2a.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.asc d2a.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 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.asc /Users/odewahn/Desktop/docbook2asciidoc/d2a.xsl chunk-output=true

docbook2asciidoc's People

Contributors

adamwitwer avatar bjepson avatar jhosman avatar magi42 avatar odewahn avatar pmuir avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.