lib/citeproc/assets.rb in citeproc-0.0.8 vs lib/citeproc/assets.rb in citeproc-0.0.9

- old
+ new

@@ -37,12 +37,11 @@ end end self rescue => e - puts e.backtrace.join("\n") - raise ArgumentError, "failed to open asset #{input.inspect}: #{e.message}" + raise ArgumentError, "failed to open asset #@location (#{input.inspect}): #{e.message}" end def name File.basename(location, self.class.extension).sub(Regexp.new("^#{self.class.prefix}"), '') end @@ -64,11 +63,19 @@ def extend_path(input) File.join(root.to_s, extend_name(input)) end def extend_name(input) - name = File.extname(input).empty? ? [input, extension].compact.join : input.to_s.dup - name = name.start_with?(prefix.to_s) ? name : [prefix, name].join + if File.extname(input) != extension + name = [input, extension].compact.join + else + name = input.to_s.dup + end + + unless name.start_with?(prefix.to_s) + name = [prefix, name].join + end + name end end