From 31e4d134c948675c99430b71950a23cd9b4c9189 Mon Sep 17 00:00:00 2001 From: Petter Reinholdtsen Date: Mon, 9 Dec 2019 16:52:01 +0100 Subject: [PATCH] Transform source docbook to use tags as figure references. This invalidates the translations, but ensure docbook control the look of references. --- fixup-docbook.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fixup-docbook.rb b/fixup-docbook.rb index a050496..7c52713 100755 --- a/fixup-docbook.rb +++ b/fixup-docbook.rb @@ -256,6 +256,15 @@ XML end end +log 0, 'replace "Fig. \#." with docbook figure xref' +xml.css("para").each do |para| + xml_text = para.to_xml(:skip_instruct => true).to_s + xml_text.gsub!(/Fig\.\s+(\d)\.?/, + 'Fig. ') + para.after(xml_text) + para.remove +end + log 0, 'Writing processed file' # Unable to figure out API way to replace DOCTYPE data = xml.to_xml().gsub!(/DOCTYPE article/, 'DOCTYPE book') -- 2.47.2