lib/metanorma/generic/converter.rb in metanorma-generic-2.2.2 vs lib/metanorma/generic/converter.rb in metanorma-generic-2.2.3
- old
+ new
@@ -31,17 +31,16 @@
def docidentifier_cleanup(xmldoc)
template = configuration.docid_template ||
"{{ organization_name_short }} {{ docnumeric }}"
docid = xmldoc.at("//bibdata/docidentifier")
id = boilerplate_isodoc(xmldoc).populate_template(template, nil)
- id.empty? and docid.remove or docid.children = id
+ (id.empty? and docid.remove) or docid.children = id
end
def doctype(node)
d = super
- configuration.doctypes or return d == "article" ?
- (configuration.default_doctype || "standard") : d
+ configuration.doctypes or return d == "article" ? (configuration.default_doctype || "standard") : d
type = configuration.default_doctype ||
configuration.doctypes.keys.dig(0) || "standard"
unless configuration.doctypes.keys.include? d
@log.add("Document Attributes", nil,
"#{d} is not a legal document type: reverting to '#{type}'")
@@ -54,17 +53,17 @@
Metanorma::Generic.configuration
.set_default_values_from_yaml_file(path_to_config_file)
end
def sectiontype_streamline(ret)
- if configuration&.termsdefs_titles&.map(&:downcase)&.include? ret
+ if configuration.termsdefs_titles&.map(&:downcase)&.include? ret
"terms and definitions"
- elsif configuration&.symbols_titles&.map(&:downcase)&.include? ret
+ elsif configuration.symbols_titles&.map(&:downcase)&.include? ret
"symbols and abbreviated terms"
- elsif configuration&.normref_titles&.map(&:downcase)&.include? ret
+ elsif configuration.normref_titles&.map(&:downcase)&.include? ret
"normative references"
- elsif configuration&.bibliography_titles&.map(&:downcase)&.include? ret
+ elsif configuration.bibliography_titles&.map(&:downcase)&.include? ret
"bibliography"
else
super
end
end
@@ -101,10 +100,10 @@
stage_validate(doc)
committee_validate(doc)
end
def stage_validate(xmldoc)
- stages = configuration&.stage_abbreviations&.keys || return
+ stages = configuration.stage_abbreviations&.keys || return
stages.empty? and return
stage = xmldoc&.at("//bibdata/status/stage")&.text
stages.include? stage or
@log.add("Document Attributes", nil,
"#{stage} is not a recognised status")