Class: RDocF95::Markup::PreProcess
- Inherits:
-
Object
- Object
- RDocF95::Markup::PreProcess
- Defined in:
- lib/rdoc-f95/markup/preprocess.rb
Overview
Handle common directives that can occur in a block of text:
: include : filename
Instance Method Summary collapse
-
#handle(text) ⇒ Object
Look for common options in a chunk of text.
-
#initialize(input_file_name, include_path) ⇒ PreProcess
constructor
A new instance of PreProcess.
Constructor Details
#initialize(input_file_name, include_path) ⇒ PreProcess
Returns a new instance of PreProcess.
10 11 12 13 |
# File 'lib/rdoc-f95/markup/preprocess.rb', line 10 def initialize(input_file_name, include_path) @input_file_name = input_file_name @include_path = include_path end |
Instance Method Details
#handle(text) ⇒ Object
Look for common options in a chunk of text. Options that we don’t handle are passed back to our caller as |directive, param|
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rdoc-f95/markup/preprocess.rb', line 19 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 |