2 require 'rdoc/code_objects'
3 require 'rdoc/markup/preprocess'
6 # Parse a non-source file. We basically take the whole thing as one big
7 # comment. If the first character in the file is '#', we strip leading pound
10 class RDoc::SimpleParser
13 # Prepare to parse a plain file
15 def initialize(top_level, file_name, body, options, stats)
16 preprocess = RDoc::Markup::PreProcess.new(file_name, options.rdoc_include)
18 preprocess.handle(body) do |directive, param|
19 warn "Unrecognized directive '#{directive}' in #{file_name}"
24 @top_level = top_level
28 # Extract the file contents and attach them to the toplevel as a comment
31 @top_level.comment = remove_private_comments(@body)
35 def remove_private_comments(comment)
36 comment.gsub(/^--[^-].*?^\+\+/m, '').sub(/^--.*/m, '')