Class: Asciidoctor::Ribose::Converter
- Inherits:
-
Generic::Converter
- Object
- Generic::Converter
- Asciidoctor::Ribose::Converter
- Defined in:
- lib/asciidoctor/ribose/converter.rb
Overview
A Converter implementation that generates RSD output, and a document schema encapsulation of the document for validation
Constant Summary collapse
- XML_ROOT_TAG =
'rsd-standard'.freeze
- XML_NAMESPACE =
'https://www.metanorma.org/ns/rsd'.freeze
Instance Method Summary collapse
- #clause_parse(attrs, xml, node) ⇒ Object
- #configuration ⇒ Object
- #doc_converter(node) ⇒ Object
- #executivesummary_parse(attrs, xml, node) ⇒ Object
- #html_converter(node) ⇒ Object
- #make_preface(x, s) ⇒ Object
- #pdf_converter(node) ⇒ Object
- #presentation_xml_converter(node) ⇒ Object
- #sectiontype(node, level = true) ⇒ Object
Instance Method Details
#clause_parse(attrs, xml, node) ⇒ Object
39 40 41 42 43 |
# File 'lib/asciidoctor/ribose/converter.rb', line 39 def clause_parse(attrs, xml, node) sectiontype1(node) == "executive summary" and return executivesummary_parse(attrs, xml, node) super end |
#configuration ⇒ Object
53 54 55 |
# File 'lib/asciidoctor/ribose/converter.rb', line 53 def configuration Metanorma::Ribose.configuration end |
#doc_converter(node) ⇒ Object
70 71 72 |
# File 'lib/asciidoctor/ribose/converter.rb', line 70 def doc_converter(node) IsoDoc::Ribose::WordConvert.new(doc_extract_attributes(node)) end |
#executivesummary_parse(attrs, xml, node) ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/asciidoctor/ribose/converter.rb', line 45 def executivesummary_parse(attrs, xml, node) xml.executivesummary **attr_code(attrs) do |xml_section| xml_section.title { |t| t << node.title || "Executive Summary" } content = node.content xml_section << content end end |
#html_converter(node) ⇒ Object
61 62 63 |
# File 'lib/asciidoctor/ribose/converter.rb', line 61 def html_converter(node) IsoDoc::Ribose::HtmlConvert.new(html_extract_attributes(node)) end |
#make_preface(x, s) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/asciidoctor/ribose/converter.rb', line 26 def make_preface(x, s) if x.at("//foreword | //introduction | //acknowledgements | "\ "//clause[@preface] | //executivesummary") preface = s.add_previous_sibling("<preface/>").first f = x.at("//foreword") and preface.add_child f.remove f = x.at("//executivesummary") and preface.add_child f.remove f = x.at("//introduction") and preface.add_child f.remove move_clauses_into_preface(x, preface) f = x.at("//acknowledgements") and preface.add_child f.remove end make_abstract(x, s) end |
#pdf_converter(node) ⇒ Object
65 66 67 68 |
# File 'lib/asciidoctor/ribose/converter.rb', line 65 def pdf_converter(node) return nil if node.attr("no-pdf") IsoDoc::Ribose::PdfConvert.new(html_extract_attributes(node)) end |
#presentation_xml_converter(node) ⇒ Object
57 58 59 |
# File 'lib/asciidoctor/ribose/converter.rb', line 57 def presentation_xml_converter(node) IsoDoc::Ribose::PresentationXMLConvert.new(html_extract_attributes(node)) end |
#sectiontype(node, level = true) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/asciidoctor/ribose/converter.rb', line 15 def sectiontype(node, level = true) ret = sectiontype1(node) ret1 = sectiontype_streamline(ret) return ret1 if "symbols and abbreviated terms" == ret1 return ret1 if "executive summary" == ret1 return nil unless !level || node.level == 1 return nil if @seen_headers.include? ret @seen_headers << ret ret1 end |