In Files

  • rdoc/markup/preprocess.rb

Parent

Methods

Files

Class/Module Index [+]

Quicksearch

RDoc::Markup::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/preprocess.rb, line 10
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 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
            

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.

blog comments powered by Disqus