Re-enable spec/library for full CI runs.
[rbx.git] / lib / rdoc / parser / simple.rb
blob6e123a4655891f5f58ca0d22c5d1669c8ba0be25
1 require 'rdoc/parser'
3 ##
4 # Parse a non-source file. We basically take the whole thing as one big
5 # comment. If the first character in the file is '#', we strip leading pound
6 # signs.
8 class RDoc::Parser::Simple < RDoc::Parser
10   parse_files_matching(//)
12   ##
13   # Prepare to parse a plain file
15   def initialize(top_level, file_name, content, options, stats)
16     super
18     preprocess = RDoc::Markup::PreProcess.new @file_name, @options.rdoc_include
20     preprocess.handle @content do |directive, param|
21       warn "Unrecognized directive '#{directive}' in #{@file_name}"
22     end
23   end
25   ##
26   # Extract the file contents and attach them to the toplevel as a comment
28   def scan
29     @top_level.comment = remove_private_comments(@content)
30     @top_level
31   end
33   def remove_private_comments(comment)
34     comment.gsub(/^--[^-].*?^\+\+/m, '').sub(/^--.*/m, '')
35   end
37 end