#coding: utf-8

f = ARGV[0].dup
content = File.read(f)
content.gsub!(/```(.+?)```/m) {">《引用の始まり》\n\n#{$1.gsub(/^/,'> ')}\n\n>《引用の終わり》"}


File.open("tmp.txt", "w") do |f|
f.puts(content)
end

`pandoc -o #{f.sub(/\.md$/, '')}.pdf \
-N -V documentclass=ltjarticle --latex-engine=lualatex \
-f markdown+ignore_line_breaks+footnotes+definition_lists \
-V titlepage=true -V toc-own-page=true \
--table-of-contents --toc-depth=4 --highlight-style tango \
-V geometry="left=3cm,right=2cm,top=3.5cm,bottom=2.7cm" \
./tmp.txt`

puts content
|