summaryrefslogtreecommitdiff
path: root/lib/rdoc
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-07-30 01:18:04 +0900
committergit <svn-admin@ruby-lang.org>2022-07-30 11:04:11 +0900
commitaf265d73fb2726fcd405d86d37d28bbf03de3b04 (patch)
tree62ce041f53907015ea81c2af99851f702b6bdd6b /lib/rdoc
parent0e85586ecc983ebb4541cd046949428d1ef5d635 (diff)
[ruby/rdoc] Fix blockquote with word in verbatim
https://github.com/ruby/rdoc/commit/75eee668a5
Diffstat (limited to 'lib/rdoc')
-rw-r--r--lib/rdoc/markup/parser.rb16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/rdoc/markup/parser.rb b/lib/rdoc/markup/parser.rb
index b0fcb61f50..0029df7e65 100644
--- a/lib/rdoc/markup/parser.rb
+++ b/lib/rdoc/markup/parser.rb
@@ -289,6 +289,10 @@ class RDoc::Markup::Parser
line << data
when :BLOCKQUOTE then
line << '>>>'
+ peek_type, _, peek_column = peek_token
+ if peek_type != :NEWLINE and peek_column
+ line << ' ' * (peek_column - column - 3)
+ end
else # *LIST_TOKENS
list_marker = case type
when :BULLET then data
@@ -374,11 +378,8 @@ class RDoc::Markup::Parser
unget
parse_text parent, indent
when :BLOCKQUOTE then
- type, _, column = get
- if type == :NEWLINE
- type, _, column = get
- end
- unget if type
+ nil while (type, = get; type) and type != :NEWLINE
+ _, _, column, = peek_token
bq = RDoc::Markup::BlockQuote.new
p :blockquote_start => [data, column] if @debug
parse bq, column
@@ -546,7 +547,10 @@ class RDoc::Markup::Parser
[:NOTE, @s[1], *pos]
# >>> followed by end of line => :BLOCKQUOTE
when @s.scan(/>>> *(\w+)?$/) then
- [:BLOCKQUOTE, @s[1], *pos]
+ if word = @s[1]
+ @s.unscan(word)
+ end
+ [:BLOCKQUOTE, word, *pos]
# anything else: :TEXT
else
@s.scan(/(.*?)( )?\r?$/)