Class: Metanorma::Iho::Converter
- Inherits:
-
Generic::Converter
- Object
- Generic::Converter
- Metanorma::Iho::Converter
- Defined in:
- lib/metanorma/iho/converter.rb
Constant Summary collapse
- XML_ROOT_TAG =
"iho-standard".freeze
- XML_NAMESPACE =
"https://www.metanorma.org/ns/iho".freeze
- SERIESNAME =
{ B: "Bathymetric", C: "Capacity Building", M: "Miscellaneous", P: "Periodic", S: "Standards and Specifications", }.freeze
Instance Method Summary collapse
- #configuration ⇒ Object
- #doc_converter(node) ⇒ Object
- #html_converter(node) ⇒ Object
- #metadata_commentperiod(node, xml) ⇒ Object
- #metadata_committee(node, xml) ⇒ Object
- #metadata_committee1(node, xml) ⇒ Object
- #metadata_ext(node, ext) ⇒ Object
- #metadata_series(node, xml) ⇒ Object
- #metadata_version(node, xml) ⇒ Object
- #pdf_converter(node) ⇒ Object
- #presentation_xml_converter(node) ⇒ Object
- #support_appendix?(_node) ⇒ Boolean
Instance Method Details
#configuration ⇒ Object
88 89 90 |
# File 'lib/metanorma/iho/converter.rb', line 88 def configuration Metanorma::Iho.configuration end |
#doc_converter(node) ⇒ Object
108 109 110 |
# File 'lib/metanorma/iho/converter.rb', line 108 def doc_converter(node) IsoDoc::Iho::WordConvert.new(doc_extract_attributes(node)) end |
#html_converter(node) ⇒ Object
98 99 100 |
# File 'lib/metanorma/iho/converter.rb', line 98 def html_converter(node) IsoDoc::Iho::HtmlConvert.new(html_extract_attributes(node)) end |
#metadata_commentperiod(node, xml) ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/metanorma/iho/converter.rb', line 37 def (node, xml) from = node.attr("comment-from") or return to = node.attr("comment-to") xml.commentperiod do |c| c.from from c.to to if to end end |
#metadata_committee(node, xml) ⇒ Object
46 47 48 49 50 51 52 53 |
# File 'lib/metanorma/iho/converter.rb', line 46 def (node, xml) unless node.attr("workgroup") @log.add("AsciiDoc Input", nil, "Missing workgroup attribute for document") return end (node, xml) end |
#metadata_committee1(node, xml) ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/metanorma/iho/converter.rb', line 55 def (node, xml) xml.editorialgroup do |a| a.committee do |n| n.abbreviation node.attr("committee").upcase end a.workgroup do |n| n.abbreviation node.attr("workgroup").upcase end end i = 2 while node.attr("workgroup_#{i}") xml.editorialgroup do |a| a.committee do |n| n.abbreviation node.attr("committee_#{i}").upcase end a.workgroup do |n| n.abbreviation node.attr("workgroup_#{i}").upcase end end i += 1 end end |
#metadata_ext(node, ext) ⇒ Object
32 33 34 35 |
# File 'lib/metanorma/iho/converter.rb', line 32 def (node, ext) super (node, ext) end |
#metadata_series(node, xml) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/metanorma/iho/converter.rb', line 24 def (node, xml) series = node.attr("series") or return xml.series type: "main" do |s| s.title SERIESNAME[series.to_sym] || "N/A" s.abbreviation series end end |
#metadata_version(node, xml) ⇒ Object
78 79 80 81 82 83 84 85 86 |
# File 'lib/metanorma/iho/converter.rb', line 78 def (node, xml) if node.attr("edition-major") ed = node.attr("edition-major") e1 = node.attr("edition-minor") and ed += ".#{e1}" (e2 = node.attr("edition-patch")) && e1 and ed += ".#{e2}" node.set_attribute("edition", ed) end super end |
#pdf_converter(node) ⇒ Object
102 103 104 105 106 |
# File 'lib/metanorma/iho/converter.rb', line 102 def pdf_converter(node) return nil if node.attr("no-pdf") IsoDoc::Iho::PdfConvert.new(pdf_extract_attributes(node)) end |
#presentation_xml_converter(node) ⇒ Object
92 93 94 95 96 |
# File 'lib/metanorma/iho/converter.rb', line 92 def presentation_xml_converter(node) IsoDoc::Iho::PresentationXMLConvert .new(html_extract_attributes(node) .merge(output_formats: ::Metanorma::Iho::Processor.new.output_formats)) end |
#support_appendix?(_node) ⇒ Boolean
12 13 14 |
# File 'lib/metanorma/iho/converter.rb', line 12 def support_appendix?(_node) true end |