sitepress-core/lib/sitepress/path.rb
# Given a filename, this will work out the extensions, formats, and node_name.
Given a filename, this will work out the extensions, formats, and node_name.
Given a filename this will work out the extensions formats and node_name .
def parse_basename
        base = basename
        filename, extname = split_filename(base)
        if filename == ROOT_PATH and extname.nil?
          @node_name = ROOT_NODE_NAME
        elsif extname
          extname = extname.to_sym
          if @handler_extensions.include? extname
            @handler = extname
            base = filename
          end
          @node_name, format = split_filename(base)
          @format = format
        else
          @node_name = filename
        end
      end
def parse_basename base = basename filename , extname = split_filename ( base ) if filename == ROOT_PATH and extname . nil? @node_name = ROOT_NODE_NAME elsif extname extname = extname . to_sym if @handler_extensions . include? extname @handler = extname base = filename end @node_name , format = split_filename ( base ) @format = format else @node_name = filename end end
Given a filename, this will work out the extensions, formats, and node_name.
Given a filename this will work out the extensions formats and node_name .
# This is a root path, so we have to treat it a little differently # so that the node mapper and node names work properly. # We have an extension! Let's figure out if its a handler or not. # Yup, its a handler. Set those variables accordingly. # Now let's get the format (e.g. :html, :xml, :json) for the path and # the key, which is just the basename without the format extension.