Skip to content

Instantly share code, notes, and snippets.

@geraldb
geraldb / patchfigs.rb
Created May 23, 2013 17:04
patchfigs.rb - pandoc progit perl oneliner converted to ruby
#
# see http://johnmacfarlane.net/pandoc/epub.html
#
# perl -i -0pe 's/^Insert\s*(.*)\.png\s*\n([^\n]*)$/!\[\2](..\/figures\/\1-tn.png)/mg' */*.markdown
#
# converted to "verbose" ruby
# encoding: UTF-8
Dir['*/*.markdown'].each do |filename|