Skip to content

Commit

Permalink
[ruby/rdoc] Markup punctuations need to be separated with a space
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu authored and matzbot committed Dec 2, 2023
1 parent 4ee1f0f commit c9c1670
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/rdoc/text.rb
Expand Up @@ -313,6 +313,6 @@ def wrap(txt, line_len = 76)
# Character class to be separated by a space when concatenating
# lines.

SPACE_SEPARATED_LETTER_CLASS = /[\p{Nd}\p{Lc}\p{Pc}]/
SPACE_SEPARATED_LETTER_CLASS = /[\p{Nd}\p{Lc}\p{Pc}]|[!-~&&\W]/

end
14 changes: 13 additions & 1 deletion test/rdoc/test_rdoc_markup_to_html.rb
Expand Up @@ -257,7 +257,7 @@ def accept_paragraph_br
end

def accept_paragraph_break
assert_equal "\n<p>hello<br>world</p>\n", @to.res.join
assert_equal "\n<p>hello<br> world</p>\n", @to.res.join
end

def accept_paragraph_i
Expand Down Expand Up @@ -416,6 +416,18 @@ def test_accept_paragraph_newline
@to.start_accepting
@to.accept_paragraph para("#{ohayo}\n", "#{sekai}\n")
assert_equal "\n<p>#{ohayo}#{sekai}</p>\n", @to.res.join

@to.start_accepting
@to.accept_paragraph para("+hello+\n", "world\n")
assert_equal "\n<p><code>hello</code> world</p>\n", @to.res.join

@to.start_accepting
@to.accept_paragraph para("hello\n", "+world+\n")
assert_equal "\n<p>hello <code>world</code></p>\n", @to.res.join

@to.start_accepting
@to.accept_paragraph para("+hello+\n", "+world+\n")
assert_equal "\n<p><code>hello</code> <code>world</code></p>\n", @to.res.join
end

def test_accept_heading_output_decoration
Expand Down

0 comments on commit c9c1670

Please sign in to comment.