diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2014-07-13 04:16:42 -0600 |
|---|---|---|
| committer | Dan Allen <dan.j.allen@gmail.com> | 2014-07-14 18:58:41 -0600 |
| commit | 064ecdca78a1e3ed7f2bc67c1cb4751e30a5bd79 (patch) | |
| tree | 95a4d831b1fcce1b7e817a2935f769827ef3a1e5 /test/text_test.rb | |
| parent | b645558d02a7ef612dfb4891615cdf5286f805d0 (diff) | |
resolves #717 disable single quotes as formatting marks for emphasized text
- disable single quotes as emphasis formatting marks by default
- introduce compat-mode document attribute to reenable legacy behavior
- add compat_mode property to document to set compatibility mode
- don't replace trailing single quote with right single smart quote
- introduce `' as the formatting mark to make a right single quote (rsquo)
- unescape escaped single quote explicitly
- update compat file for AsciiDoc Python
Diffstat (limited to 'test/text_test.rb')
| -rw-r--r-- | test/text_test.rb | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/test/text_test.rb b/test/text_test.rb index 7ed02564..cc675845 100644 --- a/test/text_test.rb +++ b/test/text_test.rb @@ -171,32 +171,43 @@ This line is separated something that is not a horizontal rule... end end - test "emphasized text" do - assert_xpath "//em", render_string("An 'emphatic' no") + test "emphasized text using underscore characters" do + assert_xpath "//em", render_string("An _emphatic_ no") end - test "emphasized text with single quote" do - assert_xpath "//em[text()=\"Johnny#{[8217].pack('U*')}s\"]", render_string("It's 'Johnny's' phone") + test 'emphasized text with single quote using apostrophe characters' do + rsquo = [8217].pack 'U*' + assert_xpath %(//em[text()="Johnny#{rsquo}s"]), render_string(%q(It's 'Johnny's' phone), :attributes => {'compat-mode' => 'legacy'}) + assert_xpath %(//p[text()="It#{rsquo}s 'Johnny#{rsquo}s' phone"]), render_string(%q(It's 'Johnny's' phone)) end - test "emphasized text with escaped single quote" do - assert_xpath "//em[text()=\"Johnny's\"]", render_string("It's 'Johnny\\'s' phone") + test 'emphasized text with escaped single quote using apostrophe characters' do + assert_xpath %(//em[text()="Johnny's"]), render_string(%q(It's 'Johnny\\'s' phone), :attributes => {'compat-mode' => 'legacy'}) + assert_xpath %(//p[text()="It's 'Johnny's' phone"]), render_string(%q(It\\'s 'Johnny\\'s' phone)) end test "escaped single quote is restored as single quote" do assert_xpath "//p[contains(text(), \"Let's do it!\")]", render_string("Let\\'s do it!") end + test 'unescape escaped single quote emphasis in legacy mode only' do + assert_xpath %(//p[text()="A 'single quoted string' example"]), render_embedded_string(%(A \\'single quoted string' example), :attributes => {'compat-mode' => 'legacy'}) + assert_xpath %(//p[text()="'single quoted string'"]), render_embedded_string(%(\\'single quoted string'), :attributes => {'compat-mode' => 'legacy'}) + + assert_xpath %(//p[text()="A \\'single quoted string' example"]), render_embedded_string(%(A \\'single quoted string' example)) + assert_xpath %(//p[text()="\\'single quoted string'"]), render_embedded_string(%(\\'single quoted string')) + end + test "emphasized text at end of line" do - assert_xpath "//em", render_string("This library is 'awesome'") + assert_xpath "//em", render_string("This library is _awesome_") end test "emphasized text at beginning of line" do - assert_xpath "//em", render_string("'drop' it") + assert_xpath "//em", render_string("_drop_ it") end test "emphasized text across line" do - assert_xpath "//em", render_string("'check it'") + assert_xpath "//em", render_string("_check it_") end test "unquoted text" do |
