X-Git-Url: https://pere.pagekite.me/gitweb/text-madewithcc.git/blobdiff_plain/09716550cdf80f9c5f33d8390a1af64192a43af4..2f83c25baf4c06e3925ecf90f9364f340eb720ea:/fixup-docbook.rb diff --git a/fixup-docbook.rb b/fixup-docbook.rb index 329d599..7c52713 100755 --- a/fixup-docbook.rb +++ b/fixup-docbook.rb @@ -53,8 +53,8 @@ partreplace(xml, 'colophon', 'colophon') partreplace(xml, 'dedication', 'dedication') partreplace(xml, 'foreword', 'preface') partreplace(xml, 'introduction', 'preface') -partreplace(xml, 'bibliography', 'chapter') -partreplace(xml, 'acknowledgments', 'chapter') +partreplace(xml, 'bibliography', 'appendix') +partreplace(xml, 'acknowledgments', 'appendix') log 0, 'place part introduction into ' s = xml.xpath("//part/title[text()='The Case Studies']")[0] @@ -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')