instiki/vendor/plugins/maruku/bin/marutex
Jacques Distler 1085168bbf Update to latest HTML5lib, Add Maruku testdir
Sync with the latest html5lib.
Having the Maruku unit tests on-hand may be useful for debugging; so let's include them.
2008-01-08 00:01:35 -06:00

31 lines
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