Module: Metanorma::Collection::Config::Converters

Included in:
Config, Manifest
Defined in:
lib/metanorma/collection/config/converters.rb

Instance Method Summary collapse

Instance Method Details

#bibdata_from_xml(model, node) ⇒ Object



16
17
18
# File 'lib/metanorma/collection/config/converters.rb', line 16

def bibdata_from_xml(model, node)
  model.bibdata = Relaton::Cli.parse_xml(node.content)
end

#bibdata_from_yaml(model, value) ⇒ Object



7
8
9
10
# File 'lib/metanorma/collection/config/converters.rb', line 7

def bibdata_from_yaml(model, value)
  value and !value.empty? or return
  model.bibdata = Relaton::Cli::YAMLConvertor.convert_single_file(value)
end

#bibdata_to_xml(model, parent, doc) ⇒ Object



20
21
22
23
24
# File 'lib/metanorma/collection/config/converters.rb', line 20

def bibdata_to_xml(model, parent, doc)
  b = model.bibdata or return
  elem = b.to_xml(bibdata: true, date_format: :full)
  doc.add_element(parent, elem)
end

#bibdata_to_yaml(model, doc) ⇒ Object



12
13
14
# File 'lib/metanorma/collection/config/converters.rb', line 12

def bibdata_to_yaml(model, doc)
  doc["bibdata"] = model.bibdata&.to_hash
end

#nop_to_yaml(model, doc) ⇒ Object



26
# File 'lib/metanorma/collection/config/converters.rb', line 26

def nop_to_yaml(model, doc); end