lib/wikilink/converter/namespace.rb in wikilink-converter-0.2.3 vs lib/wikilink/converter/namespace.rb in wikilink-converter-0.2.4
- old
+ new
@@ -1,6 +1,7 @@
require 'wikilink/converter/utils'
+require 'uri'
module Wikilink
class Converter
# Namespace converter
class Namespace
@@ -44,10 +45,15 @@
def to_url(path, fragment, query)
if path.nil? || path.empty?
[query, fragment].join
else
- [options[:prefix], path, options[:suffix], query, fragment].join
+ if options[:prefix]
+ prefix = URI.parse(URI.escape(options[:prefix]))
+ prefix.path = File.expand_path(URI.escape(path), prefix.path)
+ path = prefix.to_s
+ end
+ [path, options[:suffix], query, fragment].join
end
end
end
end
end