X-Git-Url: https://pere.pagekite.me/gitweb/text-madewithcc.git/blobdiff_plain/9e01e4518fe2e2840b7d90db1c21aa131dd306d5..5c578e06033e7d0ad896eb912dafa2d299c3648b:/fixup.rb?ds=sidebyside diff --git a/fixup.rb b/fixup.rb index 41e317d..211bd26 100644 --- a/fixup.rb +++ b/fixup.rb @@ -271,5 +271,29 @@ data.each_with_index do |lin, idx| end end +log 0, 'Turn indented block after use cases into block quotes' +inscope=false +quote=false +data.each_with_index do |lin, idx| + if quote + lin.sub!(/^/, "> ") + end + if lin =~ /^> Profile written by/ + quote=false + end + # To this heading + if lin =~ /^## Bibliography/ + inscope=false + end + # From this heading + if lin =~ /^## Arduino/ + inscope=true + end + if inscope and lin =~ /^## / + quote=true + next + end +end + log 0, 'Writing processed file' File.open(dstfile, 'w') {|f| f.puts data.join("\n")}