]> pere.pagekite.me Git - text-madewithcc.git/commitdiff
Add code to move user term info into <bookinfo><legalnotice>.
authorPetter Reinholdtsen <pere@hungry.com>
Sun, 4 Feb 2018 20:04:40 +0000 (21:04 +0100)
committerPetter Reinholdtsen <pere@hungry.com>
Thu, 22 Feb 2018 18:12:09 +0000 (18:12 +0000)
fixup-docbook.rb

index 9accbb3df8fd77c9151af57daca06d6e70f6b208..1fe55d0de9ee6c3b00353dc12c89729ae4d26d63 100755 (executable)
@@ -69,6 +69,17 @@ end
 log 0, 'remove title from dedication'
 xml.css('dedication title')[0].content = ""
 
 log 0, 'remove title from dedication'
 xml.css('dedication title')[0].content = ""
 
+log 0, 'move legal notice to bookinfo'
+xml.css('book bookinfo')[0].first_element_child.before('<legalnotice>')
+ln = xml.css('book bookinfo legalnotice')[0]
+xml.css('para').each do |para|
+  if para.content =~ /This book is published under a/
+    log 0, 'found legal'
+    para.parent = ln
+    break
+  end
+end
+
 log 0, 'Writing processed file'
 # Unable to figure out API way to replace DOCTYPE
 data = xml.to_xml().gsub!(/DOCTYPE article/, 'DOCTYPE book')
 log 0, 'Writing processed file'
 # Unable to figure out API way to replace DOCTYPE
 data = xml.to_xml().gsub!(/DOCTYPE article/, 'DOCTYPE book')