lib/asciidoctor/itu/converter.rb in metanorma-itu-1.2.16 vs lib/asciidoctor/itu/converter.rb in metanorma-itu-1.3.0
- old
+ new
@@ -1,12 +1,11 @@
require "asciidoctor"
require "asciidoctor/standoc/converter"
require "fileutils"
-require_relative "./front.rb"
-require_relative "./validate.rb"
-require_relative "./cleanup.rb"
-require_relative "./macros.rb"
+require_relative "./front"
+require_relative "./validate"
+require_relative "./cleanup"
module Asciidoctor
module ITU
# A {Converter} implementation that generates RSD output, and a document
# schema encapsulation of the document for validation
@@ -15,16 +14,11 @@
XML_ROOT_TAG = "itu-standard".freeze
XML_NAMESPACE = "https://www.metanorma.org/ns/itu".freeze
register_for "itu"
- Asciidoctor::Extensions.register do
- inline_macro AddMacro
- inline_macro DelMacro
- end
-
- def title_validate(root)
+ def title_validate(_root)
nil
end
def init(node)
super
@@ -92,10 +86,11 @@
hdr = sectiontype_streamline(node&.attr("heading")&.downcase)
return nil if ret == "terms and definitions" &&
hdr != "terms and definitions" && node.level > 1
return nil if ret == "symbols and abbreviated terms" &&
hdr != "symbols and abbreviated terms" && node.level > 1
+
ret
end
def term_def_subclause_parse(attrs, xml, node)
case clausetype = sectiontype1(node)
@@ -108,32 +103,35 @@
end
end
def metadata_keywords(node, xml)
return unless node.attr("keywords")
+
node.attr("keywords").split(/,[ ]*/).sort.each_with_index do |kw, i|
xml.keyword (i == 0 ? kw.capitalize : kw)
end
end
def clause_parse(attrs, xml, node)
node.option?("unnumbered") and attrs[:unnumbered] = true
- case clausetype = sectiontype1(node)
+ case sectiontype1(node)
when "conventions" then attrs = attrs.merge(type: "conventions")
- when "history"
+ when "history"
attrs[:preface] and attrs = attrs.merge(type: "history")
- when "source"
+ when "source"
attrs[:preface] and attrs = attrs.merge(type: "source")
end
super
end
def html_extract_attributes(node)
- super.merge(hierarchical_assets: node.attr("hierarchical-object-numbering"))
+ super.merge(hierarchical_assets:
+ node.attr("hierarchical-object-numbering"))
end
def doc_extract_attributes(node)
- super.merge(hierarchical_assets: node.attr("hierarchical-object-numbering"))
+ super.merge(hierarchical_assets:
+ node.attr("hierarchical-object-numbering"))
end
def presentation_xml_converter(node)
IsoDoc::ITU::PresentationXMLConvert.new(html_extract_attributes(node))
end