Class: Wikilink::Converter::Namespace::Default
- Inherits:
-
Wikilink::Converter::Namespace
- Object
- Wikilink::Converter::Namespace
- Wikilink::Converter::Namespace::Default
- Defined in:
- lib/wikilink/converter/namespace.rb
Constant Summary
Constants inherited from Wikilink::Converter::Namespace
Instance Attribute Summary
Attributes inherited from Wikilink::Converter::Namespace
Instance Method Summary collapse
Methods inherited from Wikilink::Converter::Namespace
Methods included from HTMLAttributes
Methods included from LinkHelper
Constructor Details
This class inherits a constructor from Wikilink::Converter::Namespace
Instance Method Details
permalink #run(run_options) ⇒ Object
[View source]
31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/wikilink/converter/namespace.rb', line 31 def run() return super if @block path = [:path].to_s path, fragment = path.split('#', 2) path, query = path.split('?', 2) fragment = '#' + fragment if fragment query = '?' + query if query url = to_url(path, fragment, query) link_to([:name], url, :class => html_class([:class])) end |
permalink #to_url(path, fragment, query) ⇒ Object
[View source]
46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/wikilink/converter/namespace.rb', line 46 def to_url(path, fragment, query) if path.nil? || path.empty? [query, fragment].join else if [:prefix] prefix = URI.parse(URI.escape([:prefix])) prefix.path = File.(URI.escape(path), prefix.path) path = prefix.to_s end [path, [:suffix], query, fragment].join end end |