Extended maintenance of Ruby versions 1.8.7 and 1.9.2 ended on July 31, 2014. Read more

In Files

  • rdoc/markup/simple_markup/preprocess.rb

Parent

Methods

Files

Class/Module Index [+]

Quicksearch

SM::PreProcess

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

: include : filename

Public Class Methods

new(input_file_name, include_path) click to toggle source
 
               # File rdoc/markup/simple_markup/preprocess.rb, line 11
def initialize(input_file_name, include_path)
  @input_file_name = input_file_name
  @include_path = include_path
end
            

Public Instance Methods

handle(text) click to toggle source

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

 
               # File rdoc/markup/simple_markup/preprocess.rb, line 20
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