lib/metanorma/compile/extract.rb in metanorma-2.0.6 vs lib/metanorma/compile/extract.rb in metanorma-2.0.7

- old
+ new

@@ -1,10 +1,9 @@ module Metanorma class Compile def relaton_export(isodoc, options) - return unless options[:relaton] - + options[:relaton] or return xml = Nokogiri::XML(isodoc, &:huge) bibdata = xml.at("//bibdata") || xml.at("//xmlns:bibdata") # docid = bibdata&.at("./xmlns:docidentifier")&.text || options[:filename] # outname = docid.sub(/^\s+/, "").sub(/\s+$/, "").gsub(/\s+/, "-") + ".xml" File.open(options[:relaton], "w:UTF-8") { |f| f.write bibdata.to_xml } @@ -16,11 +15,10 @@ xml.xpath(".//br | .//xmlns:br").each { |x| x.replace("\n") } HTMLEntities.new.decode(xml.children.to_xml) end def extract(isodoc, dirname, extract_types) - return unless dirname - + dirname or return extract_types.nil? || extract_types.empty? and extract_types = %i[sourcecode image requirement] FileUtils.rm_rf dirname FileUtils.mkdir_p dirname xml = Nokogiri::XML(isodoc, &:huge)