]> pere.pagekite.me Git - text-madewithcc.git/commitdiff
Rewrite how use case metadata is indented.
authorPetter Reinholdtsen <pere@hungry.com>
Wed, 31 Jan 2018 19:58:15 +0000 (19:58 +0000)
committerPetter Reinholdtsen <pere@hungry.com>
Thu, 22 Feb 2018 18:12:08 +0000 (18:12 +0000)
Makefile
fixup.rb

index 6008c18b2fb44cdf34976ef0f214036d2aa039c2..035b25752d7dc7d556ed659924277217d987eb14 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -102,10 +102,6 @@ epub: $(SOURCE).epub
                s/\\section\{(Notes|Notas)\}/\\section*{$$1}/; \
                s/(Web links?|Vínculos Web)/\\section*{$$1}/; \
                s/^\s*(Revenue model|Interview date|Interviewees?|(Modelo de ingresos|Fecha de la entrevista|Entrevistad(?:o|a|os|as)))/\\textbf{$$1}/;' $@
-       perl -p -i -e '$$work=1 if /chapter.Arduino/; $$work=0 if /chapter.(Bibliography|Bibliografía)/; \
-               next unless $$work; \
-               s/(\\label\{[-\.\wáéíóúñ]+\}\\hyperlabel\{[-\.\wáéíóúñ]+\}%)/$$1\n\\begin{quote}/i; \
-               s/(Profile written by.+|Perfil escrito por.+|Profilen skrevet av.+)/$$1\n\\end{quote}/' $@
 
 XMLLINTOPTS = --nonet --noout  --xinclude --postvalid
 lint: $(SOURCE).xml
index 41e317d27e0f8c7b49e24875302b5407cdac1f16..211bd26b558e89a4084b99251ee44b947aee933c 100644 (file)
--- 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")}