Class: Metanorma::Ribose::Converter
- Inherits:
-
Generic::Converter
- Object
- Generic::Converter
- Metanorma::Ribose::Converter
- Defined in:
- lib/metanorma/ribose/log.rb,
lib/metanorma/ribose/converter.rb
Constant Summary collapse
- RIBOSE_LOG_MESSAGES =
{ # rubocop:disable Naming/VariableNumber # No gem-specific log messages currently defined }.freeze
Instance Method Summary collapse
- #configuration ⇒ Object
- #doc_converter(node) ⇒ Object
- #html_converter(node) ⇒ Object
-
#log_messages ⇒ Object
rubocop:enable Naming/VariableNumber.
- #make_preface(xml, sect) ⇒ Object
- #pdf_converter(node) ⇒ Object
- #presentation_xml_converter(node) ⇒ Object
- #sectiontype(node, level = true) ⇒ Object
Instance Method Details
#configuration ⇒ Object
34 35 36 |
# File 'lib/metanorma/ribose/converter.rb', line 34 def configuration Metanorma::Ribose.configuration end |
#doc_converter(node) ⇒ Object
53 54 55 |
# File 'lib/metanorma/ribose/converter.rb', line 53 def doc_converter(node) IsoDoc::Ribose::WordConvert.new(doc_extract_attributes(node)) end |
#html_converter(node) ⇒ Object
44 45 46 |
# File 'lib/metanorma/ribose/converter.rb', line 44 def html_converter(node) IsoDoc::Ribose::HtmlConvert.new(html_extract_attributes(node)) end |
#log_messages ⇒ Object
rubocop:enable Naming/VariableNumber
10 11 12 |
# File 'lib/metanorma/ribose/log.rb', line 10 def super.merge(RIBOSE_LOG_MESSAGES) end |
#make_preface(xml, sect) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/metanorma/ribose/converter.rb', line 21 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 |
#pdf_converter(node) ⇒ Object
48 49 50 51 |
# File 'lib/metanorma/ribose/converter.rb', line 48 def pdf_converter(node) node.attr("no-pdf") and return nil IsoDoc::Ribose::PdfConvert.new(pdf_extract_attributes(node)) end |
#presentation_xml_converter(node) ⇒ Object
38 39 40 41 42 |
# File 'lib/metanorma/ribose/converter.rb', line 38 def presentation_xml_converter(node) IsoDoc::Ribose::PresentationXMLConvert .new(html_extract_attributes(node) .merge(output_formats: ::Metanorma::Ribose::Processor.new.output_formats)) end |
#sectiontype(node, level = true) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/metanorma/ribose/converter.rb', line 9 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 |