Class SM::PreProcess
In: markup/simple_markup/preprocess.rb
Parent: Object

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

: include : filename

Methods

handle   new  

Public Class methods

[Source]

    # File markup/simple_markup/preprocess.rb, line 11
11:     def initialize(input_file_name, include_path)
12:       @input_file_name = input_file_name
13:       @include_path = include_path
14:     end

Public Instance methods

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

[Source]

    # File markup/simple_markup/preprocess.rb, line 20
20:     def handle(text)
21:       text.gsub!(/^([ \t#]*):(\w+):\s*(.+)?\n/) do 
22:         prefix    = $1
23:         directive = $2.downcase
24:         param     = $3
25: 
26:         case directive
27:         when "include"
28:           filename = param.split[0]
29:           include_file(filename, prefix)
30: 
31:         else
32:           yield(directive, param)
33:         end
34:       end
35:     end

[Validate]