]> pere.pagekite.me Git - text-madewithcc.git/blobdiff - fixup.rb
Rewrite how use case metadata is indented.
[text-madewithcc.git] / fixup.rb
index 41e317d27e0f8c7b49e24875302b5407cdac1f16..211bd26b558e89a4084b99251ee44b947aee933c 100644 (file)
--- a/fixup.rb
+++ b/fixup.rb
@@ -271,5 +271,29 @@ data.each_with_index do |lin, idx|
   end
 end
 
   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")}
 log 0, 'Writing processed file'
 File.open(dstfile, 'w') {|f| f.puts data.join("\n")}