= DocBook Bootstrap
== Purpose Setting up a DocBook build environment seems to be extra difficult and cumbersome. The goal of this project is to create a platform independent, easy to depoly environment that brings you to the core tasks of getting started with THE document within seconds.
.Objectives
== Setup and Usage
image::https://github.com/jceb/docbook-bootstrap/blob/master/examples/clone-template.gif[Set up docbook project]
template
folder and put it where you want to
create your next document/project.
clone-template
script will do the work under Linux and
MacOSX.Makefile
as needed. (The document can
also be passed as an argument to make: make in=FILE
)make
to convert the document to PDF. It will be stored in the
build
directory.
make html
to create HTML outputmake help
to get a list of supported output formatsmake watch
and make stopwatch
to automatically start/stop
document builds through <<additional-software-needed,watchman>>.build.properties
holds the general settings for building a DocBook
file. Platform specific values are stored in the
build.properties.PLATFORM
files. Customization of stylesheets is
possible. Check out the included stylesheet for some ideas:
stylesheets/fo/docbook.xsl
== Details
[[output_formats]]
=== Output Formats / Build Tasks
Run the following tasks the create the desired output
format, e.g. ant pdf
. All output is stored it the directory build
,
it's customizable throught the variable output.dir
:
pdf
: create PDF output (default task)epub
: create EPUB outputepub3
: create EPUB3 outputxhtml
: create XHTML outputxhtmlchunk
: create chunked XHTML outputxhtml5
: create XHTML5 outputxhtml5chunk
: create chunked XHTML5 outputvalidate
: validates the DocBook documentclean
: delete all dynamically created files/the "out" directorytest
: execute all creation tasks one after the other[[input_formats]] === Input Formats
See section <<additional_software,Additional Software Needed>> for more
information. Set property file.format
to asciidoc
and change
file.suffix
to the suffix of the input file - it's necessary because
there doesn't seem to be way to figure this out using Ant.
=== Examples .Convert any DocBook file to PDF without editing build.properties This takes advantage of ant's ability to specify properties on the commmand line.
ant -Dfile=myfile.xml pdf
.Convert this AsciiDoc file to PDF Actually, it doesn't work yet! The reason is that AsciiDoc doesn't ship a DocBook 5 backend. When you run this command, you can take the resulting DocBook file (build/README.xml) and tweak it to make compile properly.
ant -Dfile=README.adoc -Dfile.format=asciidoc -Dfile.suffix=adoc pdf
== Customization
=== Include custom Fonts It is possible to include custom fonts into fop-generated documents. Follow these steps:
.Include True Type Fonts
Copy all required True Type Fonts in the directory lib/fonts
.
.Generate XML description for the custom True Type Font
Execute the following command in the fop folder lib/fop
to generate an
XML description for each font:
for font in ../fonts/*.ttf; do java -cp lib/commons-io-1.3.1.jar:lib/commons-logging-1.0.4.jar:build/fop.jar:lib/avalon-framework-cvs-20020806.jar:lib/xml-apis.jar:lib/xercesImpl-2.2.1.jar:lib/xalan-2.4.1.jar org.apache.fop.fonts.apps.TTFReader "${font}" "${font%.ttf}.xml" done
On Linux and Mac OS X systems executing the command
lib/fonts/compile.sh
will perform this task as well.
The following discussions might also be of interest to you:
.Include fonts in fop.xconf Add the custom font to the fonts section. Here is an example for the ukai font:
.Include fonts in stylesheet
Add the font to the fo-stylesheet (stylesheets/fo/docbook.xsl
):