lib/isodoc/function/to_word_html.rb in isodoc-0.9.6 vs lib/isodoc/function/to_word_html.rb in isodoc-0.9.7
- old
+ new
@@ -21,15 +21,17 @@
unless debug
Dir.mkdir(dir) unless File.exists?(dir)
FileUtils.rm_rf "#{dir}/*"
end
@filename = filename
+ @localdir = %r{/}.match(filename) ? filename.sub(%r{/[^/]+$}, "/") : "./"
[filename, dir]
end
+ # tmp image dir is same directory as @filename
def tmpimagedir
- @filename + @tmpimagedir
+ @filename.sub(%r{^.*/([^/]+)$}, "\\1") + @tmpimagedir
end
# isodoc.css overrides any CSS injected by Html2Doc, which
# is inserted before this CSS.
@@ -37,10 +39,10 @@
html.head do |head|
#head.title { |t| t << filename }
if @standardstylesheet
head.style do |style|
stylesheet = File.read(@standardstylesheet, encoding: "utf-8").
- gsub("FILENAME", filename)
+ gsub("FILENAME", File.basename(filename))
style.comment "\n#{stylesheet}\n"
end
end
end
end