1085168bbf
Sync with the latest html5lib. Having the Maruku unit tests on-hand may be useful for debugging; so let's include them.
31 lines
No EOL
681 B
Ruby
31 lines
No EOL
681 B
Ruby
#!/usr/bin/env ruby
|
|
|
|
require 'maruku'
|
|
|
|
if File.basename($0) =~ /^marutex/
|
|
# Convert each file
|
|
ARGV.each do |f|
|
|
puts "Opening #{f}"
|
|
|
|
# read file content
|
|
input = File.open(f,'r').read
|
|
|
|
# create Maruku
|
|
doc = Maruku.new(input)
|
|
# convert to a complete html document
|
|
latex = doc.to_latex_document
|
|
|
|
# write to file
|
|
dir = File.dirname(f)
|
|
job = File.join(dir, File.basename(f, File.extname(f)))
|
|
filename = job + ".tex"
|
|
|
|
File.open(filename,'w') do |f| f.puts latex end
|
|
|
|
# run twice for cross references
|
|
system "pdflatex '#{job}' '-output-directory=#{dir}' "
|
|
system "pdflatex '#{job}' '-output-directory=#{dir}' "
|
|
|
|
# system "open #{job}.pdf"
|
|
end
|
|
end |