Sha256: 14a26e0a38e69347ee01acfdc091636077bc4f9ea7f737e813629d725ce9783f

Contents?: true

Size: 871 Bytes

Versions: 10

Compression:

Stored size: 871 Bytes

Contents

require 'rdoc/parser'

##
# Parse a non-source file. We basically take the whole thing as one big
# comment. If the first character in the file is '#', we strip leading pound
# signs.

class RDoc::Parser::Simple < RDoc::Parser

  parse_files_matching(//)

  ##
  # Prepare to parse a plain file

  def initialize(top_level, file_name, content, options, stats)
    super

    preprocess = RDoc::Markup::PreProcess.new @file_name, @options.rdoc_include

    preprocess.handle @content do |directive, param|
      warn "Unrecognized directive '#{directive}' in #{@file_name}"
    end
  end

  ##
  # Extract the file contents and attach them to the toplevel as a comment

  def scan
    @top_level.comment = remove_private_comments(@content)
    @top_level
  end

  def remove_private_comments(comment)
    comment.gsub(/^--\n.*?^\+\+/m, '').sub(/^--\n.*/m, '')
  end

end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
shoesgem-0.1514.0 shoes/ruby/lib/rdoc/parser/simple.rb
shoesgem-0.1480.0 shoes/ruby/lib/rdoc/parser/simple.rb
shoesgem-0.1469.0 shoes/ruby/lib/rdoc/parser/simple.rb
shoesgem-0.1430.0 shoes/ruby/lib/rdoc/parser/simple.rb
shoesgem-0.1429.0 shoes/ruby/lib/rdoc/parser/simple.rb
shoesgem-0.1428.0 shoes/ruby/lib/rdoc/parser/simple.rb
shoesgem-0.1426.0 shoes/ruby/lib/rdoc/parser/simple.rb
shoesgem-0.1424.0 shoes/ruby/lib/rdoc/parser/simple.rb
rdoc-2.2.0 lib/rdoc/parser/simple.rb
rdoc-2.2.1 lib/rdoc/parser/simple.rb