Method: IsoDoc::WordFunction::Postprocess#word_floating_titles
- Defined in:
- lib/isodoc/word_function/postprocess.rb
#word_floating_titles(docxml) ⇒ Object
move p.h1 (floating title) after any page, section breaks
179 180 181 182 183 184 185 186 187 188 189 190 191 |
# File 'lib/isodoc/word_function/postprocess.rb', line 179 def word_floating_titles(docxml) docxml.xpath("//p[@class = 'section-break' or @class = 'page-break']") .each do |b| out = b.xpath("./preceding-sibling::*").reverse .each_with_object([]) do |p, m| (p.name == "p" && p["class"] == "h1") or break m m << p end b.delete("class") out.empty? and next out[-1].previous = b.remove end end |