aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rdoc/markup/preprocess.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rdoc/markup/preprocess.rb')
-rw-r--r--lib/rdoc/markup/preprocess.rb16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/rdoc/markup/preprocess.rb b/lib/rdoc/markup/preprocess.rb
index 760351d386..00dd4be4ad 100644
--- a/lib/rdoc/markup/preprocess.rb
+++ b/lib/rdoc/markup/preprocess.rb
@@ -14,21 +14,25 @@ class RDoc::Markup::PreProcess
##
# Look for common options in a chunk of text. Options that we don't handle
- # are passed back to our caller as |directive, param|
+ # are yielded to the caller.
def handle(text)
- text.gsub!(/^([ \t#]*):(\w+):\s*(.+)?\n/) do
+ text.gsub!(/^([ \t]*#?[ \t]*):(\w+):([ \t]*)(.+)?\n/) do
+ next $& if $3.empty? and $4 and $4[0, 1] == ':'
+
prefix = $1
directive = $2.downcase
- param = $3
+ param = $4
case directive
- when "include"
+ when 'include' then
filename = param.split[0]
- include_file(filename, prefix)
+ include_file filename, prefix
else
- yield(directive, param)
+ result = yield directive, param
+ result = "#{prefix}:#{directive}: #{param}\n" unless result
+ result
end
end
end