python implementation of Gitbook. Currently PyBook only creates an ODT version of the book for now that can be viewed by libreoffice/openoffice. This could be easily then converted to a PDF version.
For a starter, Clone GitBook's Javascript Book:
$ git clone git@github.com:GitbookIO/javascript.git gitbook-javascript
$ cd gitbook-javascript
$ pybook build --verbose
$ ls build/book.odt
Or you can start writing you own book from stratch:
$ mkdir pybook-example
$ cd pybook-example
$ pybook init --verbose
Below is a preview of Javascript Book:
Using pip:
# pip install git+https://github.com/bijanebrahimi/pybook.git
Install manually:
$ git clone https://github.com/bijanebrahimi/pybook.git
$ cd pybook
# python setup install
$ pybook --help
A Book MUST contain at least a README and SUMMARY file and those are the only files PyBook currently supports:
- README.md: Introduction of the book
- SUMMARY.md: Chapters Structure
- LANGS.md: Multi-Languages book
- GLOSSAR.mdY: List of terms with descriptions
According to wikipedia Book Design this file contains an Introduction/Epigraph to the writing. the default
# Introduction
This is an Introduction to the book
PyBook uses a SUMMARY.md file to define the structure of chapters and subchapters of the book.
# Summary
- [An Introduction](intro.md)
- [Who this book is for?](intro_who.md)
- [Getting Help](help.md)
[Appendix 1](appendix_1.md)
If there is a book.json
at the root of your Book diectory, PyBook will uses it as a configuration file. A configuration file is used to change the Book's defaults.
{
"title": "Book's Title",
"author": "Author's Name",
"description": "a short text to describe the writing",
"language": "en",
"direction": "ltr",
"structure": {
"readme": "README.md",
"summary": "SUMMARY.md",
},
"variables": {
"key": "value"
}
}
PyBook uses jinja2
to render Book's chapters.
For more information please visit GitBook Templating and Jinja2 Documentation.
- 0.1.3: Fixed creation of chapters at init
- 0.1.2: removed python 2.6 support
- 0.1.1: added python 2.7 support
- 0.1: added odt renderer