Skip to content

Instantly share code, notes, and snippets.

@warmwaffles
Created September 17, 2015 05:09
Show Gist options
  • Save warmwaffles/6af579c7b5622e2cd5b6 to your computer and use it in GitHub Desktop.
Save warmwaffles/6af579c7b5622e2cd5b6 to your computer and use it in GitHub Desktop.
.
├── assets
├── build
│   ├── book.epub
│   ├── book.epub3
│   └── book.html
├── Rakefile
├── scratch
├── src
│   ├── backmatter
│   │   └── appendix.md
│   └── chapters
│   └── 01-chapter-1.md
└── templates (git submodule https://github.com/jgm/pandoc-templates)
├── default.asciidoc
├── default.beamer
├── default.commonmark
├── default.context
├── default.docbook
├── default.dokuwiki
├── default.dzslides
├── default.epub
├── default.epub3
├── default.haddock
├── default.html
├── default.html5
├── default.icml
├── default.latex
├── default.man
├── default.markdown
├── default.mediawiki
├── default.opendocument
├── default.opml
├── default.org
├── default.plain
├── default.revealjs
├── default.rst
├── default.rtf
├── default.s5
├── default.slideous
├── default.slidy
├── default.texinfo
├── default.textile
└── README.markdown
7 directories, 36 files
require 'rake'
require 'rake/clean'
CHAPTERS = Rake::FileList.new('src/chapters/**/*.md')
BACKMATTER = Rake::FileList.new('src/backmatter/**/*.md')
directory('build/')
CLOBBER.include('build/')
file 'build/book.html' => ['build/'] do |t|
sh "pandoc --template templates/default.html -t html -o build/book.html #{CHAPTERS} #{BACKMATTER}"
end
CLEAN.include('build/book.html')
file 'build/book.epub' => ['build/'] do |t|
sh "pandoc --template templates/default.epub -t epub -o build/book.epub #{CHAPTERS} #{BACKMATTER}"
end
CLEAN.include('build/book.epub')
file 'build/book.epub3' => ['build/'] do |t|
sh "pandoc --template templates/default.epub3 -t epub3 -o build/book.epub3 #{CHAPTERS} #{BACKMATTER}"
end
CLEAN.include('build/book.epub3')
desc 'Builds all of the books'
task :books => ['build/book.html', 'build/book.epub', 'build/book.epub3']
task :default => :books
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment