Sha256: 2be51973670d1640dc162242cd37d6f4a74bf176ef7775f5ee8f116646d7dbc6
Contents?: true
Size: 1.8 KB
Versions: 1
Compression:
Stored size: 1.8 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.previous_element || next c.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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
metanorma-mpfa-0.4.0 | lib/asciidoctor/mpfa/section.rb |