end
end
+log 0, 'Including the Spanish version introduction'
+if intro = File.open('extra/es/intro_es.xml', 'r').read rescue nil
+ xml.search('preface').last.after( intro )
+else
+ log 0, ' -!- Introduction text not found or empty'
+end
+
log 0, 'replace images with translated versions'
xml.search('imagedata').each do |img|
# Included images are in the 'Pictures' directory. Translated images
end
end
+log 0, 'Final editorial requests: Attributions on top, as in other chapters, also for prefaces'
+xml.search('preface').each do |pref|
+ title = pref.search('title').first
+ attrib = pref.search('blockquote').last
+ attrib_text = attrib.inner_text.gsub(/\s+/,' ')
+
+ # Some formatting issues we need to modify
+ attrib_text.gsub!(/Paul y Sarah/, 'Paul <?latex \textup{>y<?latex } > Sarah')
+ attrib_text.gsub!(/Merkley (CEO.*)/, 'Merkley <citetitle>\1</citetitle>')
+ attrib_text.gsub!(/Wolf (Ins.*)/, 'Wolf <citetitle>\1</citetitle>')
+
+ attrib.remove
+ title.after('<blockquote><attribution>%s</attribution></blockquote>' % attrib_text)
+ log 1, 'Moved: %s' % attrib_text
+end
+
+log 0, 'Replace colophon + legalinfo by the information assembled by our publisher'
+if legal = File.open('extra/es/legal_info.xml', 'r').read rescue nil
+ xml.search('colophon').first.inner_html = legal
+end
+
+
log 0, 'Writing processed file'
# Unable to figure out API way to replace DOCTYPE
data = xml.to_xml()