• Stars
    star
    179
  • Rank 206,848 (Top 5 %)
  • Language
    CSS
  • License
    Other
  • Created over 12 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Template to create PDF, ePub and Kindle books with Asciidoctor

Template for Writing an eBook

This is a new version of the classic template for eBooks. You can use this code to kickstart your writing project from scratch.

Design Guidelines

Why using such a complex setup instead of just using a simpler tool like Word or Pages?

The primary motivation of this template is versioning. Being able to use plain text files as input for the book brings the possibility of versioning each change individually using Git, Subversion or any other similar tool. This also opens up the door to collaboration among team members when editing a document.

The second motivation is to separate the presentation and the layout of the final book from its contents. Other output file types could be added in the future.

This also brings the possibility of using any text editor in just about any operating system; files are just plain text files that can be edited with gEdit, Notepad, Emacs, Vim, TextEdit, or any other similar tool.

Markup languages like Markdown or Asciidoc (used in this template) are simpler and more readable than LaTeX or other SGML-like languages, making the files readable and lean even when edited in a text editor without any syntax highlighting or formatting support.

Finally, being able to streamline the creation of the three versions of the book in just one command-line operation allows the whole setup to be automatized.

The choice of Asciidoctor comes from the following features:

  • Syntax highlighting of Swift and Kotlin code in all outputs (Pandoc does not support Swift at the moment.)

  • Multi-file projects (Pandoc, because of Markdown, does not support the include mechanism that AsciiDoc provides.)

History

This toolkit started as a pure LaTeX workflow in 2009. In late 2011 the system moved to Markdown and it used Pandoc to generate the artifacts. In 2012 the choice was AsciiDoc, and in 2016 this new system was finally developed, using AsciiDoctor.

How To Use

The master.asciidoc file at the root of this project provides the guiding structure of the book. Chapters can be shuffled around, independently of their contents or internal structure.

Individual chapters are stored in the chapters folder, one file per chapter.

Images are stored as PNG files in the images folder. Data files (XML, CSV, etc,) are located in the data folder.

The Makefile creates a temporary _build folder, copies all the different elements in it (the master file, the chapters and the images) and commands the execution of the whole toolchain in order to get the final result:

  • Unix man page

  • Self-contained HTML5

  • PDF

  • EPUB3

  • Kindle (.mobi)

UML diagrams are generated by text through PlantUML.

  1. Execute the make command. This will create the PDF, ePub and HTML versions of the book.

  2. make pdf, make html, make epub and make kindle each generate the specified version of the booklet.

  3. make clean removes the _build folder.

After the build process completes, the compiled eBooks will be available at the _build subfolder.

Requirements and Installation Instructions

This section explains the different required libraries, for both macOS and Ubuntu Linux.

macOS (Sierra)

Before using this template, make sure to have Homebrew and Rubygems installed, then run the following commands to install the required dependencies:

$ xcode-select --install # (required for nokogiri, itself a requirement for asciidoc-epub3)
$ brew install plantuml glib gdk-pixbuf cairo pango cmake libxml2
$ gem install pygments.rb kindlegen asciimath asciidoctor asciidoctor-diagram asciidoctor-mathematical epubcheck
$ gem install asciidoctor-pdf asciidoctor-epub3 --pre

Install the font dependencies for asciidoctor-mathematical:

cd ~/Library/Fonts; \
curl -LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/cmex10.ttf \
     -LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/cmmi10.ttf \
     -LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/cmr10.ttf \
     -LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/cmsy10.ttf \
     -LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/esint10.ttf \
     -LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/eufm10.ttf \
     -LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/msam10.ttf \
     -LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/msbm10.ttf

If you experience compilation problems with asciidoctor-mathematical you can brew link gettext --force if needed. Follow the installation instructions from the project in case of issues.

Ubuntu Linux (16.04/16.10/18.04)

Install the following libraries:

sudo apt-get install -y plantuml cmake ruby-dev libxml2-dev libcairo2-dev \
    libpango1.0-dev bison flex libgdk-pixbuf2.0-dev libffi-dev ttf-lyx \
    intltool
sudo gem install pygments.rb kindlegen asciimath asciidoctor \
    asciidoctor-diagram epubcheck
sudo gem install asciidoctor-pdf asciidoctor-epub3 --pre
sudo MATHEMATICAL_SKIP_STRDUP=1 gem install mathematical
sudo gem install asciidoctor-mathematical

[Unfortunately](asciidoctor/asciidoctor-epub3#179) the current versions of Asciidoctor on Ubuntu exhibit a weird behaviour when using asciidoctor-diagram during the generation of EPUB output.

Docker

The project includes a Dockerfile which can be built using the following command:

docker build -t "ebook-template" .

Once built, the Docker container can be used as follows on the local folder where the Makefile is located:

docker run -v ${PWD}:/workdir ebook-template

License

See the LICENSE.adoc file.

More Repositories

1

SwiftMoment

A time and calendar manipulation library for iOS 9+, macOS 10.11+, tvOS 9+, watchOS 2+ written in Swift 4.
Swift
1,617
star
2

nib2objc

Set of tools and utilities (command line, GUI, Mac Service) to transform NIB files for the iPhone into Objective-C code files
Objective-C
1,131
star
3

CoreTextWrapper

An Objective-C wrapper around Core Text for creating multi-column text and loading custom fonts
Objective-C
539
star
4

iPhoneWebServicesClient

This project showcases different transport formats and libraries to consume web services from an iOS application.
Objective-C
297
star
5

Senbei

An iPhone client for Fat Free CRM
Objective-C
155
star
6

iphonerestwrapper

This is an Xcode project (for iPhone), showing an Objective-C class (called Wrapper) which can be used to interact with remote REST web services.
Objective-C
152
star
7

async-uitableview

Sample project using the ASIHTTPRequest to load the public Flickr RSS feed, and then load the images in a UITableView in asynchronous fashion
Objective-C
134
star
8

PracticalCommonLisp_ePub

"Practical Common Lisp" by Peter Seibel in ePub format
HTML
118
star
9

bluewoki

A simple Bluetooth-based walkie-talkie for iOS using GameKit
Objective-C
99
star
10

iphone-keypad

A highly sloppy copy of Apple's own iPhone keypad
Objective-C
48
star
11

editorrific

This project features a simple editor similar to the one used in the Twitterriffic iPhone application.
Objective-C
46
star
12

cortito

Cortito - URL Shortener written in PHP
PHP
43
star
13

imagecachetest

This iPhone application is inspired on Alex Curylo’s article about the problems of UIImage’s imageNamed: method.
Objective-C
40
star
14

Sencha-Touch-2-Up-And-Running

Code of the book "Sencha Touch 2: Up and Running" published by O'Reilly
JavaScript
39
star
15

PlaygroundBookGenerator

Ruby scripts that can generate a whole Swift Playgrounds for iPad book from a Markdown file
Ruby
36
star
16

fontbrowser

iPhone Font Browser - This iPhone application is based on code from the Under the Bridge blog and allows users and developers to browse and play with the fonts available in the iPhone OS.
Objective-C
36
star
17

cocoarestwrapper

This is an Xcode project (for Mac OS X), showing an Objective-C class (called Wrapper) which can be used to interact with remote REST web services.
Objective-C
36
star
18

AKCascadingStyle

This project provides a simple framework to centralize style information (fonts, colors, etc) in iPhone and Mac applications.
Objective-C
29
star
19

EasyTableView

A set of UITableViewController and UINavigationController subclasses for quickly prototyping iPhone applications.
Objective-C
28
star
20

Mobile-JavaScript-Application-Development

Code of the book "Mobile JavaScript Application Development" published by O'Reilly
JavaScript
24
star
21

opengles2-xcode-book

This project contains sample code taken from the "OpenGL ES 2.0 Programming Guide" book, by Aaftab Munshi, Dan Ginsburg and Dave Shreiner, adapted for Xcode and the iPhone OS 3.0
Objective-C
21
star
22

iphonestripview

Sample project using a UIKit-based strip component, like those featured in the LinkedIn and Facebook applications.
20
star
23

CodeaCalc

A very simple calculator made with Codea on the iPad
Lua
19
star
24

TwitThis

Sample project showing a helper class which wraps the complexity of having to deal with many different Twitter clients from the same iPhone application
Objective-C
13
star
25

Lorenz

iPhone OS + Mac OS X (app + screen saver) implementation in OpenGL ES 1.1 of the Lorenz Attractor
Objective-C
10
star
26

django-blog-engine

A minimalistic blog application, done as a learning exercise of both Python and the Django Framework.
Python
7
star
27

Backlog

The demo application I showed at the iPhone Dev Day 2009
Objective-C
6
star
28

AKOLibrary

iOS Framework used in projects by akosma software
Objective-C
5
star
29

remproject

The project aims to the creation of an UML tool suitable both for academia and the industry, including Ivar Jacobson's proposed extensions for Aspect-Oriented Software Development (AOSD).
C++
5
star
30

CodeaSort

Implementation of sorting algorithms in Lua, for Codea
Lua
5
star
31

DelegateOrder

Project showing how to determine delegate object method call in Objective-C with NSProxy
Objective-C
5
star
32

GoogleReaderShared

A simple command-line utility for reading and parsing "shared" items in Google Reader
Ruby
4
star
33

Sencha-Touch-2-Minimal-MVC

Minimal Sencha Touch 2 MVC application, as created live during SwissJeese 2012
JavaScript
4
star
34

Swift-Presentation

Cocoa framework used to present Swift
Swift
4
star
35

swift-linux-docker

The Dockerfile and other stuff required to build a complete Swift on Linux Docker image
Shell
3
star
36

SwiftTribool

3-state boolean library for Swift, inspired in Boost.Tribool
Swift
3
star
37

CortitoService

A Mac OS X Service for shortening URLs with cortito
Objective-C
3
star
38

omxplayerphp

Driving omxplayer through PHP on a Raspberry Pi
PHP
3
star
39

akosma.github.com

My personal Github page
3
star
40

FakePhoneGap

Simple implementation of PhoneGap for teaching purposes
Objective-C
3
star
41

RooiFonts

Simple font manager for iOS
Objective-C
3
star
42

SwissAlert

An iPhone application to have the most important Swiss emergency phones at hand
JavaScript
2
star
43

TeachingEditor

JavaScript-based web editor that can be shared with students learning about mobile web apps
JavaScript
2
star
44

omxplayernode

Node.js + Express + socket.io interface for omxplayer on a Raspberry Pi.
JavaScript
2
star
45

akosma

My GitHub profile
2
star
46

iBeacon-Presentation

This presentation is about iBeacon - a new technology based on Bluetooth - for both iOS and Android smartphones and tablets.
Objective-C
2
star
47

Notitas

Simple post-it application for iOS
Objective-C
2
star
48

dvdrental

A fictional movie rental system written in C++, built as an assignment during my master's degree.
C++
1
star
49

Accessible

A demo app covering some iOS 10 Accessibility features, shown in the Mobile Developers Summit Bangalore 2016
Swift
1
star
50

digital2.0

Objective-C
1
star
51

MinimalisticSwiftBrowser

Minimalistic Browser application for OS X built with Swift. Built on the shoulder of giants.
Swift
1
star
52

DeviceDNA

Application used to send UDID via e-mail
Objective-C
1
star
53

Markdown-Presentation-Template

Template for creating presentations using Markdown
JavaScript
1
star
54

actsasmanifesto

Ruby on Rails plugin to change the world
Ruby
1
star
55

delicious_wp

A Ruby script that creates a WordPress entry with last week's posts on del.icio.us
Ruby
1
star
56

Slim-Framework-Dash-Docset

Dash Docset for the Slim Framework Documentation
Shell
1
star
57

iOS7-Presentation

A short summary of new APIs and features available for app developers in iOS 7. Shown in the GOTO Nights in Eindhoven and Amsterdam (November 20th and 21st 2013) and Zurich (December 18th 2013)
Objective-C
1
star
58

SmartPointerTest

A "smart pointer" implementation in Objective-C++
C
1
star
59

nodetutorial

Code written while reading the nodebeginner.org tutorial
JavaScript
1
star