$14 GRAYBYTE WORDPRESS FILE MANAGER $60

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 172.67.217.254 | ADMIN IP 216.73.216.23
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/alt/ruby18/lib64/ruby/1.8/rdoc/markup/simple_markup/

HOME
Current File : /opt/alt/ruby18/lib64/ruby/1.8/rdoc/markup/simple_markup//preprocess.rb
module SM

  ## 
  # Handle common directives that can occur in a block of text:
  #
  # : include : filename
  #

  class PreProcess

    def initialize(input_file_name, include_path)
      @input_file_name = input_file_name
      @include_path = include_path
    end

    # Look for common options in a chunk of text. Options that
    # we don't handle are passed back to our caller
    # as |directive, param| 

    def handle(text)
      text.gsub!(/^([ \t#]*):(\w+):\s*(.+)?\n/) do 
        prefix    = $1
        directive = $2.downcase
        param     = $3

        case directive
        when "include"
          filename = param.split[0]
          include_file(filename, prefix)

        else
          yield(directive, param)
        end
      end
    end

    #######
    private
    #######

    # Include a file, indenting it correctly

    def include_file(name, indent)
      if (full_name = find_include_file(name))
        content = File.open(full_name) {|f| f.read}
        # strip leading '#'s, but only if all lines start with them
        if content =~ /^[^#]/
          content.gsub(/^/, indent)
        else
          content.gsub(/^#?/, indent)
        end
      else
        $stderr.puts "Couldn't find file to include: '#{name}'"
        ''
      end
    end

    # Look for the given file in the directory containing the current
    # file, and then in each of the directories specified in the
    # RDOC_INCLUDE path

    def find_include_file(name)
      to_search = [ File.dirname(@input_file_name) ].concat @include_path
      to_search.each do |dir|
        full_name = File.join(dir, name)
        stat = File.stat(full_name) rescue next
        return full_name if stat.readable?
      end
      nil
    end

  end
end


Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
3 Mar 2024 10.48 PM
root / linksafe
0755
fragments.rb
7.245 KB
12 Feb 2007 11.01 PM
root / linksafe
0644
inline.rb
8.5 KB
12 Feb 2007 11.01 PM
root / linksafe
0644
lines.rb
2.993 KB
12 Feb 2007 11.01 PM
root / linksafe
0644
preprocess.rb
1.714 KB
12 Feb 2007 11.01 PM
root / linksafe
0644
to_flow.rb
4.373 KB
12 Feb 2007 11.01 PM
root / linksafe
0644
to_html.rb
7.044 KB
12 Feb 2007 11.01 PM
root / linksafe
0644
to_latex.rb
8.275 KB
12 Feb 2007 11.01 PM
root / linksafe
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF