%.tex: %.xml
dblatex $(DBLATEX_OPTS) $^
perl -p -i -e 's/ / /g; \
- s/\\chapter\{(Colophon|Dedication)\}/\\chapter*{}/; \
- s/\\section\{(Notes|Notas)\}/\\section*{$$1}/; \
- s/(Web links?|Vínculos Web)/\\section*{$$1}/;' $@
+ s/\\chapter\{(Colophon|Dedication)\}/\\chapter*{}/;' $@
XMLLINTOPTS = --nonet --noout --xinclude --postvalid
lint: $(SOURCE).xml
end
end
+
+log 0, 'remove empty notes/web links sections'
+[
+ 'Notes',
+ 'Web links',
+ 'Web link',
+].each do |title|
+ xml.xpath("//title[text()='%s']" % title).each do |node|
+ p = node.parent
+ node.remove
+ if p.content =~ /^\s*$/
+ p.remove
+ else
+ raise RuntimeError, 'Non-empty «%s» found' % title
+ end
+ end
+end
+
log 0, 'remove title from dedication'
xml.css('dedication title')[0].content = ""