Sha256: 8a11de355206862b42824b824e23c1a7808ffa71e718977543fe8a80b47937fe

Contents?: true

Size: 429 Bytes

Versions: 1

Compression:

Stored size: 429 Bytes

Contents

module Humpyard
  module UriParser
    class PagesUriParser
      def self.substitute content, options = {}
        content.gsub(/humpyard:\/\/page\/([0-9]*)/) do |uri| 
          begin
            "#{options[:prefix]}#{Page.find($1).human_url}#{options[:postfix]}"          
          rescue
            "#{options[:prefix]}#{Page.root_page.human_url}#{options[:postfix]}"  
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
humpyard-0.0.1 lib/humpyard/uri_parser/pages_uri_parser.rb