From: Petter Reinholdtsen Date: Wed, 31 Jan 2018 19:58:15 +0000 (+0000) Subject: Rewrite how use case metadata is indented. X-Git-Tag: es-printed~522 X-Git-Url: https://pere.pagekite.me/gitweb/text-madewithcc.git/commitdiff_plain/5c578e06033e7d0ad896eb912dafa2d299c3648b Rewrite how use case metadata is indented. --- diff --git a/Makefile b/Makefile index 6008c18..035b257 100644 --- 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 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")}