Class: Metanorma::Ribose::Converter
- Inherits:
-
Generic::Converter
- Object
- Generic::Converter
- Metanorma::Ribose::Converter
- Defined in:
- lib/metanorma/ribose/converter.rb
Overview
A Converter implementation that generates RSD output, and a document schema encapsulation of the document for validation
Instance Method Summary collapse
- #configuration ⇒ Object
- #doc_converter(node) ⇒ Object
- #html_converter(node) ⇒ Object
- #make_preface(xml, sect) ⇒ Object
- #pdf_converter(node) ⇒ Object
- #presentation_xml_converter(node) ⇒ Object
- #sectiontype(node, level = true) ⇒ Object
Instance Method Details
permalink #configuration ⇒ Object
[View source]
37 38 39 |
# File 'lib/metanorma/ribose/converter.rb', line 37 def configuration Metanorma::Ribose.configuration end |
permalink #doc_converter(node) ⇒ Object
[View source]
57 58 59 |
# File 'lib/metanorma/ribose/converter.rb', line 57 def doc_converter(node) IsoDoc::Ribose::WordConvert.new(doc_extract_attributes(node)) end |
permalink #html_converter(node) ⇒ Object
[View source]
47 48 49 |
# File 'lib/metanorma/ribose/converter.rb', line 47 def html_converter(node) IsoDoc::Ribose::HtmlConvert.new(html_extract_attributes(node)) end |
permalink #make_preface(xml, sect) ⇒ Object
[View source]
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/metanorma/ribose/converter.rb', line 24 def make_preface(xml, sect) if xml.at("//foreword | //introduction | //acknowledgements | "\ "//clause[@preface] | //executivesummary") preface = sect.add_previous_sibling("<preface/>").first f = xml.at("//foreword") and preface.add_child f.remove f = xml.at("//executivesummary") and preface.add_child f.remove f = xml.at("//introduction") and preface.add_child f.remove move_clauses_into_preface(xml, preface) f = xml.at("//acknowledgements") and preface.add_child f.remove end make_abstract(xml, sect) end |
permalink #pdf_converter(node) ⇒ Object
[View source]
51 52 53 54 55 |
# File 'lib/metanorma/ribose/converter.rb', line 51 def pdf_converter(node) return nil if node.attr("no-pdf") IsoDoc::Ribose::PdfConvert.new(pdf_extract_attributes(node)) end |
permalink #presentation_xml_converter(node) ⇒ Object
[View source]
41 42 43 44 45 |
# File 'lib/metanorma/ribose/converter.rb', line 41 def presentation_xml_converter(node) IsoDoc::Ribose::PresentationXMLConvert .new(html_extract_attributes(node) .merge(output_formats: ::Metanorma::Ribose::Processor.new.output_formats)) end |
permalink #sectiontype(node, level = true) ⇒ Object
[View source]
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/metanorma/ribose/converter.rb', line 12 def sectiontype(node, level = true) ret = sectiontype1(node) ret1 = sectiontype_streamline(ret) return ret1 if ret1 == "symbols and abbreviated terms" return ret1 if ret1 == "executive summary" return nil unless !level || node.level == 1 return nil if @seen_headers.include? ret @seen_headers << ret ret1 end |