lib/metanorma/collection_manifest.rb in metanorma-1.3.2 vs lib/metanorma/collection_manifest.rb in metanorma-1.3.3
- old
+ new
@@ -42,11 +42,11 @@
# @param mnf [Nokogiri::XML::Element]
# @return [Hash{String=>String}]
def parse_docref(mnf)
mnf.xpath("xmlns:docref").map do |dr|
h = { "identifier" => dr.at("identifier").text }
- h["fileref"] = dr[:fileref] if dr[:fileref]
+ dr[:fileref] and h["fileref"] = dr[:fileref]
h["attachment"] = dr[:attachment] if dr[:attachment]
h
end
end
end
@@ -100,10 +100,10 @@
# @param builder [Nokogiri::XML::Builder]
def docref_to_xml(builder)
@docref.each do |dr|
drf = builder.docref { |b| b.identifier dr["identifier"] }
- drf[:fileref] = dr["fileref"]
+ drf[:fileref] = Util::source2dest_filename(dr["fileref"])
drf[:attachment] = dr["attachment"] if dr["attachment"]
if collection.directives.include?("documents-inline")
id = collection.documents.find_index { |k, _| k == dr["identifier"] }
drf[:id] = format("doc%<index>09d", index: id)
end