# lib_add_head_tail_html.rb # add header and tail to body (html) def add_head_tail_html html_file sample_md = <<~'EOS' --- title: 'Gtk4 tutorial for beginners' --- # sample header Main contents begin here. ~~~{.C .numberLines} int main(int argc, char **argv) { } ~~~ |English|Japanese| |:-----:|:------:| |potato|jagaimo| |carrot|ninjin| |onion|tamanegi| EOS File.write "sample.md", sample_md stat = system("pandoc", "-s", "-o", "sample.html", "sample.md") File.delete("sample.md") raise ("add_head_tail_html: pandoc retuns error status #{$?}.\n") unless stat == true sample_html = File.read("sample.html") File.delete("sample.html") sample_html.gsub!(//,'') head = sample_html.partition(/<\/head>/)[0] raise "No