]> pere.pagekite.me Git - text-madewithcc.git/commitdiff
Improve formatting of quote in preface.
authorPetter Reinholdtsen <pere@hungry.com>
Wed, 31 Jan 2018 19:43:09 +0000 (19:43 +0000)
committerPetter Reinholdtsen <pere@hungry.com>
Wed, 31 Jan 2018 19:44:03 +0000 (19:44 +0000)
fixup.rb

index d15b2438d4ebe4cccfb328e26ee47cc447912586..543a66a86fbdc67c76ee73147b10e148c4720947 100644 (file)
--- a/fixup.rb
+++ b/fixup.rb
@@ -215,5 +215,24 @@ log 0, 'Join erroneously split paragraphs'
   end
 end
 
+log 0, 'Mark quote in dedication as quote with attribute in markdown'
+start = "“I don’t know a whole lot about nonfiction journalism. . ."
+stop = "- David Foster Wallace"
+quote=false
+data.each_with_index do |lin, idx|
+  if lin == stop
+    lin.sub!(/^- /, "> &mdash; ")
+    lin.sub!("David Foster Wallace", "<cite>David Foster Wallace</cite>")
+    quote=false
+    break
+  end
+  if lin == start
+    quote=true
+  end
+  if quote
+    lin.sub!(/^/, "> ")
+  end
+end
+
 log 0, 'Writing processed file'
 File.open(dstfile, 'w') {|f| f.puts data.join("\n")}