lib/utils/image.rb in metanorma-utils-1.5.4 vs lib/utils/image.rb in metanorma-utils-1.5.5
- old
+ new
@@ -42,10 +42,11 @@
s.replace(s.at(n.ns("./figure")))
end
end
def svgmap_rewrite0(svgmap, namespace, localdirectory, idx)
- if (i = svgmap.at(namespace.ns(".//image"))) && (src = i["src"])
+ if (i = svgmap.at(namespace.ns(".//image"))) &&
+ (src = i["src"]) && !src.empty?
path = svgmap_rewrite0_path(src, localdirectory)
File.file?(path) or return false
svg = Nokogiri::XML(File.read(path, encoding: "utf-8"))
i.replace(svgmap_rewrite1(svgmap, svg.root, namespace, idx))
/^data:/.match(src) and i["src"] = datauri(path)