Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module AbsoluteUrlHelper
- def abs_url( input, dir )
- return input unless SITE.base
- return SITE.base + input if input[0,1] == '/'
- rgxp = %r/(src|href)="([^"]*)"/
- input.gsub!(rgxp) do
- path = $2
- path = URI.join(SITE.base, "/#{dir}/" ,path)
- %Q(#{$1}="#{path}")
- end
- return input
- end
- end
- Webby::Helpers.register(AbsoluteUrlHelper)
Add Comment
Please, Sign In to add comment