Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDF/eBook export automation #2

Open
fdicarlo opened this issue Jul 7, 2020 · 0 comments
Open

PDF/eBook export automation #2

fdicarlo opened this issue Jul 7, 2020 · 0 comments
Assignees
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@fdicarlo
Copy link
Owner

fdicarlo commented Jul 7, 2020

Based on https://github.com/fdicarlo/RHCSA_cs a possible improvement (connected to #1 is to automate the export of the chapters through Ruby/Python script in a PDF or ePub/mobi format for a consumption with eBook reader.

A script could be:

bookname = "Unofficial AZ-900 Study Guide"

chapters = Array.new
Dir["./chapters/*"].entries.each { |n| chapters.push(n) if File.file?(n) && n.include?("draft") }
chapters.sort!

chap = chapters.join(' ')

puts "Building EPUB - /compile/#{bookname}.epub..."
`pandoc -S --epub-metadata=metadata.xml -o compile/#{bookname}.epub title.txt #{chap} --toc --smart --epub-stylesheet=./templates/epub.css 
# --epub-cover-image=./Cover_demo.png`
puts "...done!"
puts "Building MOBI - /compile/#{bookname}.mobi..."
`kindlegen compile/#{bookname}.epub`
puts "...done!"
puts "Building PDF  - /compile/#{bookname}-A4.pdf..."
`pandoc -S --epub-metadata=metadata.xml -o compile/#{bookname}-A4.pdf title.txt #{chap} --toc --smart --epub-stylesheet=./templates/epub.css --epub-cover-image=./Cover_demo.png`
puts "...done!"
puts "Building PDF  - /compile/#{bookname}-A5.pdf..."
`pandoc -S --epub-metadata=metadata.xml --template=./templates/a5.tex -o compile/#{bookname}-A5.pdf title.txt #{chap} --toc --smart --epub-stylesheet=./templates/epub.css --epub-cover-image=./Cover_demo.png`
puts "...done!" 
@fdicarlo fdicarlo added documentation Improvements or additions to documentation enhancement New feature or request labels Jul 7, 2020
@fdicarlo fdicarlo self-assigned this Jul 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant