X-Git-Url: https://pere.pagekite.me/gitweb/text-madewithcc.git/blobdiff_plain/b60ae2dffcb9dda4b7710acbf51ee66a4f5ab93d..c5bf0c01c996fbee49b8890f7bf9845a08dd5be0:/fixup-docbook-translated.rb diff --git a/fixup-docbook-translated.rb b/fixup-docbook-translated.rb index 57958d4..696c0dd 100644 --- a/fixup-docbook-translated.rb +++ b/fixup-docbook-translated.rb @@ -21,6 +21,13 @@ def log(level,what) 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 @@ -36,6 +43,28 @@ xml.search('imagedata').each do |img| 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 y Sarah') + attrib_text.gsub!(/Merkley (CEO.*)/, 'Merkley \1') + attrib_text.gsub!(/Wolf (Ins.*)/, 'Wolf \1') + + attrib.remove + title.after('
%s
' % 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()