class Humpyard::UriParser::PagesUriParser

Public Class Methods

substitute(content, options = {}) click to toggle source
   # File lib/humpyard/uri_parser/pages_uri_parser.rb
 4 def self.substitute content, options = {}
 5   content.gsub(/humpyard:\/\/page\/([0-9]*)/) do |uri| 
 6     begin
 7       "#{options[:prefix]}#{Page.find($1).human_url}#{options[:postfix]}"          
 8     rescue
 9       "#{options[:prefix]}#{Page.root_page.human_url}#{options[:postfix]}"  
10     end
11   end
12 end