Skip to content

Commit 501482b

Browse files
committed
Ignore "]" following an RDOCLINK
This caused problems when an RDOCLINK was discovered inside a TIDYLINK. The ] wouldn't indicate the end of the RDOCLINK (any non-whitespace) so it would consume the ] and any following punctuation. This would cause a TIDYLINK to be unrecognized. The handling of markup inside a paragraph needs its own parser one of these days.
1 parent 6d8cbed commit 501482b

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lib/rdoc/markup/formatter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def accept_document document
8080
# Adds a special for links of the form rdoc-...:
8181

8282
def add_special_RDOCLINK
83-
@markup.add_special(/rdoc-[a-z]+:\S+/, :RDOCLINK)
83+
@markup.add_special(/rdoc-[a-z]+:[^\s\]]+/, :RDOCLINK)
8484
end
8585

8686
##

test/test_rdoc_markup_formatter.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,17 @@ def special_names
7070
def test_add_special_RDOCLINK
7171
@to.add_special_RDOCLINK
7272

73+
def @to.handle_special_RDOCLINK special
74+
"<#{special.text}>"
75+
end
76+
7377
assert_includes special_names, 'RDOCLINK'
78+
79+
document = doc(para('{foo}[rdoc-label:bar].'))
80+
81+
formatted = document.accept @to
82+
83+
assert_equal '{foo}[<rdoc-label:bar>].', formatted
7484
end
7585

7686
def test_add_special_TIDYLINK

0 commit comments

Comments
 (0)