Converter to various book formats (PDF, epub, mobi)
Clone or download
Pull request Compare This branch is 807 commits ahead, 31 commits behind yeyanchao:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
css
diff
docbook-xsl
docs
fonts
lib
scripts
static
submitted-patches
test-ccap
xsl
xslt2
.gitignore
README.md
__init__.py
collection2dbk.py
collection2epub.py
collection2xhtml.py
collectiondbk2pdf.py
content2epub.py
license.txt
module2dbk.py
module2epub.py
readme.txt
termsprinkler.py
util.py

README.md

As all documents, this is a work in progress

oer.exports

To install and get it running:

System Dependencies

Tested with python 2.4 and python 2.7 but it will probably work with all versions in between.

For Ubuntu/Debian

sudo apt-get install python-virtualenv        # for the following commands
sudo apt-get install libxslt1-dev libxml2-dev # For lxml to compile
sudo apt-get install librsvg2-bin             # To convert SVG and math to PNG
sudo apt-get install otf-stix

also: apt-get install imagemagick # PNG resizing apt-get install inkscape # svg processing apt-get install ruby # Hmmm... apt-get install libxml2-utils # for xmllint apt-get install zip # building the zip

For Osx

Install http://mxcl.github.com/homebrew/

brew install librsvg
brew install imagemagick
brew install node           # Only if you want to compile the `.less` files
sudo npm install -g less    # Only if you want to compile the `.less` files

Install python virtualenv

sudo easy_install virtualenv

For all Operating Systems

This will set up the virtual environment in your terminal (all packages are not installed globally).

cd oer.exports
virtualenv .
source bin/activate
easy_install lxml argparse pil

Once you run these steps, every time you open a terminal you will need to run source bin/activate.

Install PrinceXML

Finally, you will need to install http://princexml.com (remember the path to where it gets installed).

Optional: Local docbook-xsl files

The docbook-xsl has files that point to http://docbook.sourceforge.net . Loading these is slow and sometimes times out.

You can download the zip file from http://sourceforge.net/projects/docbook/files/docbook-xsl-ns/ (1.72 works) and replace the docbook-xsl directory with its contents.

Generate Books

Ok, let's make sure you can create a PDF and EPUB!

To generate a PDF:

python collectiondbk2pdf.py -p ${path-to-wkhtml2pdf-or-princexml} -d ./test-ccap -s ccap-physics ./result.pdf

To generate an EPUB:

./scripts/module2epub.sh "Connexions" ./test-ccap ./test-ccap.epub "col12345" ./xsl/dbk2epub.xsl ./static/content.css

Alternative script for EPUB:

# For a collection:
python content2epub.py -c ./static/content.css -e ./xsl/dbk2epub.xsl -t "collection" -o ./test-ccap.epub ./test-ccap/

# For just a module:
python content2epub.py -c ./static/content.css -e ./xsl/dbk2epub.xsl -t "module" -o ./m123.epub -i "m123" ./test-ccap/m-section/

License:

This software is subject to the provisions of the GNU Affero General Public License Version 3.0 (AGPL). See license.txt for details. Copyright (c) 2012 Rice University