]> pere.pagekite.me Git - text-madewithcc.git/commitdiff
Restructure to use DocBook XML as po4a input.
authorPetter Reinholdtsen <pere@hungry.com>
Wed, 31 Jan 2018 18:39:20 +0000 (18:39 +0000)
committerPetter Reinholdtsen <pere@hungry.com>
Thu, 22 Feb 2018 18:12:08 +0000 (18:12 +0000)
Makefile
fixup.rb

index b0a37a408758b14f6b12d7ab6dd7c575f33071da..6008c18b2fb44cdf34976ef0f214036d2aa039c2 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -10,11 +10,9 @@ SOURCE=MadewithCreativeCommonsmostup-to-dateversion
 # increase every time the generated Markdown is modified.
 VERSION=20170609-2
 
 # increase every time the generated Markdown is modified.
 VERSION=20170609-2
 
-TITLE="Hecho con Creative Commons"
 TEXLANG=spanish
 TEXLANGCODE=es
 
 TEXLANG=spanish
 TEXLANGCODE=es
 
-#TITLE="Laget med Creative Commons"
 #TEXLANG=norsk
 #TEXLANGCODE=nb
 
 #TEXLANG=norsk
 #TEXLANGCODE=nb
 
@@ -24,9 +22,7 @@ PANDOC_OPTS = \
   --standalone \
   --top-level-division=part \
   -t docbook \
   --standalone \
   --top-level-division=part \
   -t docbook \
-  -f markdown+inline_notes+ascii_identifiers \
-  --variable 'author:Paul Stacey' --variable 'author:Sarah Hinchliff Pearson' \
-  --variable 'title:$(TITLE)'
+  -f markdown+inline_notes+ascii_identifiers
 
 LANGS := $(shell ls po/*/mwcc.po|cut -d/ -f2)
 
 
 LANGS := $(shell ls po/*/mwcc.po|cut -d/ -f2)
 
@@ -53,9 +49,9 @@ $(SOURCE).md: $(SOURCE).odt fixup.rb
        rm $$TEMP
 
 pot: po/mwcc.pot po/*/mwcc.po
        rm $$TEMP
 
 pot: po/mwcc.pot po/*/mwcc.po
-po/mwcc.pot: $(SOURCE).md
+po/mwcc.pot: $(SOURCE).xml
        TEMP=`tempfile -p mwcc` && \
        TEMP=`tempfile -p mwcc` && \
-       po4a-gettextize -f text -m $(SOURCE).md -p $$TEMP -M utf-8 --package-name 'Made with Creative Commons' --package-version $(VERSION) && \
+       po4a-gettextize -f docbook -m $(SOURCE).xml -p $$TEMP -M utf-8 --package-name 'Made with Creative Commons' --package-version $(VERSION) && \
        echo '# MADE WITH CREATIVE COMMONS' > $@ && \
        echo '# Copyright (C) 2017 by Creative Commons.' >> $@ && \
        echo '# This file is published under a Creative Commons Attribution-ShareAlike license (CC BY-SA), version 4.0' >> $@ && \
        echo '# MADE WITH CREATIVE COMMONS' > $@ && \
        echo '# Copyright (C) 2017 by Creative Commons.' >> $@ && \
        echo '# This file is published under a Creative Commons Attribution-ShareAlike license (CC BY-SA), version 4.0' >> $@ && \
@@ -67,15 +63,15 @@ po/*/mwcc.po: po/mwcc.pot
        msgmerge --previous $@ po/mwcc.pot -U
        touch $@
 
        msgmerge --previous $@ po/mwcc.pot -U
        touch $@
 
-$(SOURCE).es.md: $(SOURCE).md po/es/mwcc.po
-       po4a-translate -f text -m $(SOURCE).md -p po/es/mwcc.po -l $@ -l $@ -L utf-8 -M utf-8 -k 0
+$(SOURCE).es.xml: $(SOURCE).xml po/es/mwcc.po
+       po4a-translate -f docbook -m $(SOURCE).xml -p po/es/mwcc.po -l $@ -l $@ -L utf-8 -M utf-8 -k 0
 
 
-$(SOURCE).nb.md: $(SOURCE).md po/nb/mwcc.po
-       po4a-translate -f text -m $(SOURCE).md -p po/nb/mwcc.po -l $@ -l $@ -L utf-8 -M utf-8 -k 0
+$(SOURCE).nb.xml: $(SOURCE).xml po/nb/mwcc.po
+       po4a-translate -f docbook -m $(SOURCE).xml -p po/nb/mwcc.po -l $@ -l $@ -L utf-8 -M utf-8 -k 0
 
 
-%.xml: %.md
+$(SOURCE).xml: $(SOURCE).md fixup-docbook.rb
        TEMP=`tempfile -p mwcc` && \
        TEMP=`tempfile -p mwcc` && \
-         pandoc -s -o $$TEMP $(PANDOC_OPTS) $^ && \
+         pandoc -s -o $$TEMP $(PANDOC_OPTS) $(SOURCE).md && \
          ruby fixup-docbook.rb $$TEMP $@ && \
          rm $$TEMP
 
          ruby fixup-docbook.rb $$TEMP $@ && \
          rm $$TEMP
 
@@ -101,7 +97,8 @@ epub: $(SOURCE).epub
                s/\\author\{and\}/\\author{Paul Stacey \\and Sarah Hinchliff Pearson}/; \
                s/\\DBKinditem\{\\writtenby\}\{and\}/\\DBKinditem{\writtenby}{Paul Stacey and Sarah Hinchliff Pearson}/; \
                s/\\listoffigures//; \
                s/\\author\{and\}/\\author{Paul Stacey \\and Sarah Hinchliff Pearson}/; \
                s/\\DBKinditem\{\\writtenby\}\{and\}/\\DBKinditem{\writtenby}{Paul Stacey and Sarah Hinchliff Pearson}/; \
                s/\\listoffigures//; \
-               s/\\part\{(Foreword|Prefacio|Introduction|Introducción)\}/\\chapter*{$$1} \\addcontentsline{toc}{chapter}{$$1}/; \
+               s/\\chapter\{(Colophon|Dedication)\}/\\chapter*{}/; \
+               s/\\chapter\{(Foreword|Prefacio|Introduction|Introducción)\}/\\chapter*{$$1} \\addcontentsline{toc}{chapter}{$$1}/; \
                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}/;' $@
                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}/;' $@
index cd025c15f39a04cf574214da6599b48b0b31bd2b..8e8f670a20575cce829c5cba2a57a9fc07e612c6 100644 (file)
--- a/fixup.rb
+++ b/fixup.rb
@@ -181,6 +181,12 @@ end
 data.delete("# Part 1")
 data.delete("# Part 2")
 
 data.delete("# Part 1")
 data.delete("# Part 2")
 
+log 0, 'add heading to colophon page'
+data.insert(data.index('Made With Creative Commons'), '## Colophon {-}')
+
+log 0, 'add dedication as separeate chapter'
+data.insert(data.index('“I don’t know a whole lot about nonfiction journalism. . .'), '## Dedication {-}')
+
 # Join erroneously split paragraphs: Write the contents of the line
 # _preceding_ the unneeded break, the break will be removed.
 #
 # Join erroneously split paragraphs: Write the contents of the line
 # _preceding_ the unneeded break, the break will be removed.
 #