forked from vmg/redcarpet
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from gfx/fix_utf8_handling
fix utf8 handling in C code
- Loading branch information
Showing
5 changed files
with
34 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -131,6 +131,24 @@ def test_whitespace_after_urls | |
html_equal exp, rd | ||
end | ||
|
||
def test_auto_linked_www_utf8_issue | ||
rd = render_with({ autolink: true }, "www.example.com/码") | ||
exp = %{<p><a href="http://www.example.com/%E7%A0%81">www.example.com/码</a></p>\n} | ||
assert_equal exp, rd | ||
end | ||
|
||
def test_auto_linked_url_utf8_issue | ||
rd = render_with({ autolink: true }, "http://example.com/码") | ||
exp = %{<p><a href="http://example.com/%E7%A0%81">http://example.com/码</a></p>\n} | ||
assert_equal exp, rd | ||
end | ||
|
||
def test_auto_linked_email_utf8_issue | ||
rd = render_with({ autolink: true }, "[email protected]あ") | ||
exp = %{<p><a href="mailto:[email protected]">[email protected]</a>あ</p>\n} | ||
assert_equal exp, rd | ||
end | ||
|
||
def test_memory_leak_when_parsing_char_links | ||
@markdown.render(<<-leaks) | ||
2. Identify the wild-type cluster and determine all clusters | ||
|
@@ -243,6 +261,12 @@ def test_that_fenced_flag_works_without_space | |
assert !out.include?("<pre><code>") | ||
end | ||
|
||
def test_that_fenced_flag_works_with_utf8 | ||
text = "```ム\ncode\n```" | ||
out = Greenmat::Markdown.new(Greenmat::Render::HTML, :fenced_code_blocks => true).render(text) | ||
assert out.include?(%{<pre><code class="ム">}) | ||
end | ||
|
||
def test_that_indented_flag_works | ||
text = <<indented | ||
This is a simple text | ||
|