Handle common directives that can occur in a block of text:
: include : filename
Look for common options in a chunk of text. Options that we don't handle are yielded to the caller.
# File rdoc/markup/preprocess.rb, line 19 def handle(text) text.gsub!(/^([ \t]*#?[ \t]*):(\w+):([ \t]*)(.+)?\n/) do next $& if $3.empty? and $4 and $4[0, 1] == ':' prefix = $1 directive = $2.downcase param = $4 case directive when 'include' then filename = param.split[0] include_file filename, prefix else result = yield directive, param result = "#{prefix}:#{directive}: #{param}\n" unless result result end end end