Sha256: eb9a7799bc33390e9b8b522d0fb47ab970cf19d960b33c725897a11c99a9053c

Contents?: true

Size: 602 Bytes

Versions: 16

Compression:

Stored size: 602 Bytes

Contents

module Sitepress
  module Extensions
    # Removes the file extension from the file so that /hi/there/fun.html can be
    # resolved via /hi/there/fun.
    class RailsRequestPaths
      def process_resources(node)
        node.flatten.each do |r|
          asset = r.asset
          request_path = r.request_path
          r.node.remove
          node.add path: self.class.format_path(request_path), asset: asset
        end
      end

      def self.format_path(request_path)
        File.join(File.dirname(File.join("/", request_path)), File.basename(request_path, ".*"))
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
sitepress-rails-1.0.1 lib/sitepress/extensions/rails_request_paths.rb
sitepress-rails-1.0.0 lib/sitepress/extensions/rails_request_paths.rb
sitepress-rails-0.1.29 lib/sitepress/extensions/rails_request_paths.rb
sitepress-rails-0.1.28 lib/sitepress/extensions/rails_request_paths.rb
sitepress-rails-0.1.27 lib/sitepress/extensions/rails_request_paths.rb
sitepress-rails-0.1.26 lib/sitepress/extensions/rails_request_paths.rb
sitepress-rails-0.1.25 lib/sitepress/extensions/rails_request_paths.rb
sitepress-rails-0.1.24 lib/sitepress/extensions/rails_request_paths.rb
sitepress-rails-0.1.23 lib/sitepress/extensions/rails_request_paths.rb
sitepress-rails-0.1.22 lib/sitepress/extensions/rails_request_paths.rb
sitepress-rails-0.1.21 lib/sitepress/extensions/rails_request_paths.rb
sitepress-rails-0.1.20 lib/sitepress/extensions/rails_request_paths.rb
sitepress-rails-0.1.19 lib/sitepress/extensions/rails_request_paths.rb
sitepress-rails-0.1.18 lib/sitepress/extensions/rails_request_paths.rb
sitepress-rails-0.1.17 lib/sitepress/extensions/rails_request_paths.rb
sitepress-rails-0.1.16 lib/sitepress/extensions/rails_request_paths.rb