Short Attention Span Docbook
This package gives you all the tools you need to author books and articles with the open-source Docbook toolchain.
Contained in this package are the Docbook XSLT stylesheets, a validation package, XML-FO to PDF translation, and a project generator with build scripts. This uses the dookbook-xsl-ns stylesheets.
Installation and Usage
In order to use this, you'll need a Java Runtime Environment. JRE 1.6 is fine.
You also need Ruby 1.8.7 or higher with RubyGems and Rake. Most standard installations of Ruby will include these dependencies.
Basic installation for (Potential) Authors and Writers
This repository is for technical people who want to get the latest bleeding-edge version of this toolchain so they can customize it to fit their needs. Authors and other end users should download the re-distributable packages available at www.napcs.com/products/docbook which are more stable.
Developers and Integrators
If you're interested in creating a more customized toolchain as part of a continuous build process, etc, you should clone the repository
git clone git://github.com/napcs/docbook
This copies only the necessary files to c:/docbook on windows or ~/docbook on Linux and Mac OS. If you want to install elsewhere, specify a path
sudo rake install DIR=/opt/docbook
You'll be prompted to add the install directory to your path. Also add the SHORT_ATTENTION_SPAN_DOCBOOK_PATH environment variable to the installation directory to make it easier to run the generators and find everything.
Staying on the Bleeding Edge
If you really want to keep current, you can clone the repo
git clone git://github.com/napcs/docbook ~/docbook_edge
And set your ENV variable for SHORT_ATTENTION_SPAN_DOCBOOK_PATH to point there. You may also wish to add ~/docbook_edge to your path.
Then you can fetch updates with
git pull origin master
This way you can write against the most current files.
Creating a book
Create a new book with sample info using the generate script.
generate book foobook with_sample
Creating docbook project... - foobook/xsl - foobook/images - foobook/images/sample.png - foobook/book.xml - foobook/chapter01.xml - foobook/Rakefile - foobook/w3centities-f.ent - foobook/xsl/pdf.xsl - foobook/xsl/epub.xsl - foobook/xsl/epub.css - foobook/xsl/mobi.xsl - foobook/xsl/mobi.css - foobook/xsl/html.xsl - foobook/xsl/html.css - foobook/xsl/rtf.xsl
Create a PDF of the book:
cd foobook rake book.pdf
Edit book.xml to add your own information, chapters, images, and more. Edit xsl/pdf.xml to change how things look.
Create an HTML version the same way
You'll see the output at html/index.html
This package can create EPUB files too. And while RTF files will build, the support here is relatively weak and is a limitation of Apache FOP's RTF support.
See readme_files/docbook.pdf for more information, like how to use Draft mode, pre-and-postprocessing hooks, and adding covers. There's also more on installation and usage for end users there, and it serves as documentation, as the PDF's docbook source is available there as well.
The build system works best when you have an environment variable set. On Linux, you would add this to your .bashrc or other profile scripts.
On Windows, add this to your environment variables in Control Panel.
Please fork and pull. Don't update the changelog. Make small patches I can pull in.
* Updates Docbook XSLT to 1.78.1
* When rendering fails, book.tmp.xml is no longer deleted, making error discovery easier. * Added .rhtml (erb) highlighting file * Modified the Ruby highlighting file to add new tokens for Rails * Modified the HTML highlighting file to recognize some HTML5 elements
* Updated FOP to 1.1 * Minor changes to the default PDF stylesheet
2012-07-20 - v1.6.1
* Added highlighting for CoffeeScript * fixed incorrect xpath which was always using article instead of book. Closes #11 * readme fixes, minor comment changes in template Rakefile * changed error message to make kindlegen path clearer. Closes #17 * Fixed load paths so installation works.
2011-10-25 - v1.6.0
* Fixed sample template issues * Added basic support for .mobi format for Amazon Kindle. You'll need kindlegen on your path though. * Removed Relames validation and replaced with Jing so that validation actually validates included files. * Added validation before preprocessor. This will result in validation running twice, but this now handles cases where you are transforming book.tmp.xml in your own preprocessor. * Fixed issue where epubs were not getting the right cover file added. * Removed sections of the README that are now out of date.
2011-10-20 - v1.5.2
* Now properly catching issues where FO to PDF conversion encounters errors.
2011-09-19 - v1.5.1
* Changed how external commands are run to prevent blocking on larger books.
2011-09-19 - v1.5.0
* Changed to local validation (Eric Davis) * Refactored generators for projects and added tests * Refactored validation and added tests * Created quieter output by default and added VERBOSE=true option * Colored output on OSX and Linux. (Win32console was too buggy with STDERR so it's not enabled.)
2011-08-28 - v1.4.2
* Changed HTML generation slightly. Cleans up after itself much better, and html files are also removed by the cleanup task.
2011-08-28 - v184.108.40.206
* Fixed install script's documentation rake task that was aborting improperly.
* Fixed the validation code. You'll find out if you have a bad doc much quicker now.
* Updated FOP to 1.0. * Improved RTF output * Cover support for ePub is done. It requires the use of the <tt>cover</tt> element though, so it's different than PDF covers. * PDF cover support is now the default. No need for an extra task. If the cover.pdf file exists, it will be used. * Updated Docbook XSL-NS to 1.76.1. See xsl/RELEASE-NOTES.txt for more details. * Downgraded Docbook XSL-NS ePub XSLT to 1.76.0 due to regression bug with epub ToC. * Improved HTML output. HTML output is now copied to the html/ directory and all images are collected and copied there as well. * Added an HTML stylesheet. * Added examples to the default stylesheet that show how to customize the generated text for cross references. * Added entries to the ePub stylesheet * Tested ePub output on Adobe Digital Editions, iBooks 1.2 and Stanza on the iPad.
* Builds PDFs under Ruby 1.9.2 * Postprocess callbacks work (Thanks Eric Davis)
* Fixed issue where book.pdf could not be rebuilt unless the pdf was removed * Fixed chapter generation to not create a useless folder when not using chapter subfolders.
2010-07-12 - v220.127.116.11
* Fixed issue with epub interfering with PDF and other file creation - bad regex.
2010-06-30 - v1.3
* Disabled ePub support for Windows for now. * Refactoring of libraries to lay the groundwork for alternate adapters like Prince, PDFKit, XEP, and others. * Minor work on epub output. Looks decent in Stanza and iBooks now.
2010-04-20 - v18.104.22.168
* Added a DEBUG=true flag to help troubleshoot setup errors.
2010-03-29 - v1.2.1
* MUCH improved cleanup routine now finds any pdf with the same name as one of your xml files. * rake book.pdf now builds if you change any xml file in the project. Useful for rebuilding a book after changing a chapter. * Created a method to share rake tasks between projects. Put tasks in $HOME/.docbook_rakefile. It's loaded after all other tasks, so you can use this to extend existing tasks, or provide common pre/postprocess hooks for all of your book projects.
2010-03-24 - v1.2.0
* Added preprocess and postprocess hooks. Detailed information is in the readme_files/docbook.pdf file.
2010-03-21 - v22.214.171.124
* PDF XSLT improvements for TOC and xrefs. Fixed rake task
2010-03-18 - v1.1.4
* Refactored code in the makefile into much more organized modules so that the build chain can be expanded better. Much more to do. * Fixed erroneous installation messages for exporting environment vars on linux * Fixed missing dependent doc task on install
2010-02-22 - v1.1.3
* Added style rule to template pdf.xsl to keep code listings together.
2010-02-02 - v1.1.2
* Changed where the cover script looks for covers. Covers should be in the covers/subfolder of your project
2009-12-31 - v1.1.1
* Added multivalent library for merging * New "add cover" support - slap a nice cover on your books * Minor documentation updates * Added "clean" task * Made buiding "book.pdf" or "article.pdf" default tasks * Default task "touches" the book or article file to force a rebuild even if nothing changed
2009-12-09 - v1.1.01
* HTML stylesheet customization layer * added version flag for generator and for rakefiles * added VERSION file containing the version of the buildchain used by the generator.
2009-12-09 - v1.1.0
* Installation tasks, fixed Windows issues
2009-12-08 - v1.1rc3
* Added Rake tasks for building, testing, and installing * Updated stylesheet
2009-12-03 - v1.1rc2
added DRAFT option
2009-09-18 - v1.1rc1
Highlighting support works differently which changes a lot of the process.The highlighting customizations needed to be changed, and an additional layer needed to be placed inbetween your customization layer and the base styles. Unfortunately, this breaks your existing projects. However, just generate a new book and move your xml files into the new project. If you've made customizations, manually move those into the pdf.xsl file.
The stylesheets now take the path parameter via an external XML property, which is set in the make file. You need the new make file to make things work on your projects.
Added support for entitites
Updated FOP to 0.9.5
Updated stylesheets to 1.75.2