Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Got book compiling with pandoc 2.x

  • Loading branch information...
justin committed Dec 11, 2017
1 parent ae1f920 commit 512484417b297aaac8fbea6f857ce85e11ab3269
Showing with 9 additions and 6 deletions.
  1. +5 −0 Brewfile
  2. +4 −6 generate.rb
@@ -0,0 +1,5 @@
tap "caskroom/cask"

brew "pandoc"
brew "ruby"
cask "mactex"
@@ -15,7 +15,7 @@

format = ARGV[0] || 'pdf'
directory = File.expand_path(File.dirname(__FILE__))
files = Dir[File.join(directory, 'Chapter*', '*.md')]
files = Dir[File.join(directory, 'Chapter*', '*.md')].sort
files.each do |file|
content = File.open(file, 'r') { |f| f.read }
content.gsub! /\n\r/, "\n"
@@ -26,8 +26,6 @@
cover_path = File.join(directory, "Cover", "Cover-Art.jpg")
style_path = File.join(directory, "style.css")

puts style_path

metadata = {
'title' => 'Achieving Zen with Auto Layout',
'author' => 'Justin Williams',
@@ -43,11 +41,11 @@
FileUtils.mkdir_p(File.dirname(destination))
end

output = %Q(pandoc -S -s --smart -o "#{destination}" )
output = %Q(pandoc -s -f markdown+smart -o "#{destination}" )
output << %Q(--epub-metadata="#{File.basename(meta_path)}" ) if format == 'epub'
output << %Q(--epub-cover-image="#{cover_path}" ) if format == 'epub'
output << %Q(--epub-stylesheet="#{style_path}" ) if format == 'epub'
output << %Q(--latex-engine=xelatex ) if format == 'pdf'
output << %Q(--css="#{style_path}" ) if format == 'epub'
output << %Q(--pdf-engine=xelatex ) if format == 'pdf'
output << files.map { |f| %Q("#{f}") }.join(' ')


0 comments on commit 5124844

Please sign in to comment.
You can’t perform that action at this time.