Sha256: 10d9ee607e72ca33e6df275454be4cf3bf5236eb537468a248994d9d92ad02d0
Contents?: true
Size: 1.94 KB
Versions: 29
Compression:
Stored size: 1.94 KB
Contents
module Asciidoctor module MPFA # A {Converter} implementation that generates MPFD output, and a document # schema encapsulation of the document for validation # class Converter < Standoc::Converter def sections_cleanup(x) super x.xpath("//*[@inline-header]").each do |h| h.delete("inline-header") end x.xpath("//*[@guidance]").each do |h| #c = h.at("./preceding-sibling::clause[last()]") || next c = h.xpath("./preceding-sibling::clause") c.empty? and next #c.add_child h.remove c.last.add_child h.remove end end def sectiontype_streamline(ret) case ret when "glossary" then "terms and definitions" else super end end def term_def_title(_toplevel, node) return node.title end def move_sections_into_preface(x, preface) foreword = x.at("//foreword") preface.add_child foreword.remove if foreword introduction = x.at("//introduction") preface.add_child introduction.remove if introduction terms = x.at("//sections/clause[descendant::terms]") || x.at("//terms") preface.add_child terms.remove if terms move_clauses_into_preface(x, preface) acknowledgements = x.at("//acknowledgements") preface.add_child acknowledgements.remove if acknowledgements end def make_preface(x, s) if x.at("//foreword | //introduction | //terms | //acknowledgements |"\ "//abstract[not(ancestor::bibitem)] | //clause[@preface]") preface = s.add_previous_sibling("<preface/>").first move_sections_into_preface(x, preface) make_abstract(x, s) end end def clause_parse(attrs, xml, node) attrs[:guidance] = true if node.role == "guidance" attrs[:container] = true if node.role == "container" super end end end end
Version data entries
29 entries across 29 versions & 1 rubygems