Skip to content

Instantly share code, notes, and snippets.

@rbq
Created Nov 27, 2013
Embed
What would you like to do?
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