Created
November 27, 2013 16:50
-
-
Save rbq/7679076 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RDoc::Markup::Formatter | |
def parse_url url | |
case url | |
when /^rdoc-label:([^:]*)(?::(.*))?/ then | |
scheme = 'link' | |
path = "##{$1}" | |
id = " id=\"#{$2}\"" if $2 | |
when /([A-Za-z]+):(.*)/ then | |
scheme = $1.downcase | |
path = $2 | |
when /^#/ then | |
else | |
scheme = 'http' | |
path = url | |
url = url | |
end | |
if scheme == 'link' then | |
url = if path[0, 1] == '#' then # is this meaningful? | |
path | |
else | |
self.class.gen_relative_url @from_path, path | |
end | |
end | |
[scheme, url, id] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment