From: Petter Reinholdtsen Date: Wed, 31 Jan 2018 18:39:20 +0000 (+0000) Subject: Restructure to use DocBook XML as po4a input. X-Git-Tag: es-printed~525 X-Git-Url: https://pere.pagekite.me/gitweb/text-madewithcc.git/commitdiff_plain/72a5cd26ba8c53910f3cbd1df4184d193139b4d6?ds=sidebyside Restructure to use DocBook XML as po4a input. --- diff --git a/Makefile b/Makefile index b0a37a4..6008c18 100644 --- a/Makefile +++ b/Makefile @@ -10,11 +10,9 @@ SOURCE=MadewithCreativeCommonsmostup-to-dateversion # increase every time the generated Markdown is modified. VERSION=20170609-2 -TITLE="Hecho con Creative Commons" TEXLANG=spanish TEXLANGCODE=es -#TITLE="Laget med Creative Commons" #TEXLANG=norsk #TEXLANGCODE=nb @@ -24,9 +22,7 @@ PANDOC_OPTS = \ --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) @@ -53,9 +49,9 @@ $(SOURCE).md: $(SOURCE).odt fixup.rb rm $$TEMP pot: po/mwcc.pot po/*/mwcc.po -po/mwcc.pot: $(SOURCE).md +po/mwcc.pot: $(SOURCE).xml 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' >> $@ && \ @@ -67,15 +63,15 @@ po/*/mwcc.po: po/mwcc.pot 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` && \ - pandoc -s -o $$TEMP $(PANDOC_OPTS) $^ && \ + pandoc -s -o $$TEMP $(PANDOC_OPTS) $(SOURCE).md && \ 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/\\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}/;' $@ diff --git a/fixup.rb b/fixup.rb index cd025c1..8e8f670 100644 --- a/fixup.rb +++ b/fixup.rb @@ -181,6 +181,12 @@ end 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. #