Skip to content

Commit

Permalink
Make TIDYLINK multi-word label non-greedy
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Nov 14, 2023
1 parent 3d3862a commit 9034d3f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rdoc/markup/formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def add_regexp_handling_RDOCLINK

def add_regexp_handling_TIDYLINK
@markup.add_regexp_handling(/(?:
\{.*?\} | # multi-word label
\{[^{}]*\} | # multi-word label
\b[^\s{}]+? # single-word label
)
Expand Down
6 changes: 6 additions & 0 deletions test/rdoc/test_rdoc_markup_formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ def @to.handle_regexp_TIDYLINK target
formatted = document.accept @to

assert_equal '<{foo}[rdoc-label:bar]>.', formatted

document = doc(para('<tt>{abc}</tt>: {foo}[rdoc-label:bar].'))

formatted = document.accept @to

assert_equal '<code>{abc}</code>: <{foo}[rdoc-label:bar]>.', formatted
end

def test_parse_url
Expand Down

0 comments on commit 9034d3f

Please sign in to comment.