summaryrefslogtreecommitdiff
path: root/lib/rdoc/parser.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rdoc/parser.rb')
-rw-r--r--lib/rdoc/parser.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/rdoc/parser.rb b/lib/rdoc/parser.rb
index 47ecd746d0..5c6a0a8983 100644
--- a/lib/rdoc/parser.rb
+++ b/lib/rdoc/parser.rb
@@ -218,6 +218,8 @@ class RDoc::Parser
return unless parser
+ content = remove_modeline content
+
parser.new top_level, file_name, content, options, stats
rescue SystemCallError
nil
@@ -233,6 +235,13 @@ class RDoc::Parser
end
##
+ # Removes an emacs-style modeline from the first line of the document
+
+ def self.remove_modeline content
+ content.sub(/\A.*-\*-\s*(.*?\S)\s*-\*-.*\r?\n/, '')
+ end
+
+ ##
# If there is a <tt>markup: parser_name</tt> comment at the front of the
# file, use it to determine the parser. For example:
#