Created
August 3, 2011 23:22
-
-
Save tdreyno/1124121 to your computer and use it in GitHub Desktop.
Latex 2 PDF Middleman
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Find all markdown files | |
path = File.join(File.dirname(__FILE__), "source", "**/*.html.markdown") | |
# Also generate .latex files along side | |
Dir[path].each do |markdown_file| | |
http_path = markdown_file.split("source").last.gsub(".html.markdown", "") | |
page "#{http_path}.latex", :proxy => "#{http_path}.html", :latex => true, :layout => false | |
end | |
require "fileutils" | |
Middleman::Builder.after_run do | |
# Find all latex files | |
path = File.join(File.dirname(__FILE__), "build", "**/*.latex") | |
Dir[path].each do |latex_file| | |
`pandoc #{latex_file} -o #{latex_file.gsub(".latex", ".pdf")}` | |
FileUtils.rm(latext_file) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment