diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2018-09-09 02:18:55 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-09-09 02:18:55 -0600 |
| commit | cfa34ccfd6441c56cadf52c35c3c225bbcf94271 (patch) | |
| tree | 4110131185b7d0b22158a94ef849c7dc0fcc65f4 | |
| parent | 30e1a48c1c89848f9ce3d910ceb9029d9e176646 (diff) | |
resolves #2863 only support a single unicode bullet as a list marker (PR #2864)
| -rw-r--r-- | CHANGELOG.adoc | 1 | ||||
| -rw-r--r-- | lib/asciidoctor.rb | 4 | ||||
| -rw-r--r-- | test/lists_test.rb | 28 |
3 files changed, 6 insertions, 27 deletions
diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index a6a08318..c2f9a9a3 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -44,6 +44,7 @@ Improvements:: * use shorthands %F and %T instead of %Y-%m-%d and %H:%M:%S to format time * read file in binary mode whenever contents are being normalized * use .drop(0) to duplicate arrays (roughly 1.5x as fast as .dup) + * only recognize a bullet glyph which is non-repeating as an unordered list marker Documentation:: diff --git a/lib/asciidoctor.rb b/lib/asciidoctor.rb index 70a690af..4a0288ad 100644 --- a/lib/asciidoctor.rb +++ b/lib/asciidoctor.rb @@ -671,7 +671,7 @@ module Asciidoctor # Detects the start of any list item. # # NOTE we only have to check as far as the blank character because we know it means non-whitespace follows. - AnyListRx = /^(?:[ \t]*(?:-|\*\**|\.\.*|\u2022\u2022*|\d+\.|[a-zA-Z]\.|[IVXivx]+\))[ \t]|[ \t]*.*?(?::::{0,2}|;;)(?:$|[ \t])|<?\d+>[ \t])/ + AnyListRx = /^(?:[ \t]*(?:-|\*\**|\.\.*|\u2022|\d+\.|[a-zA-Z]\.|[IVXivx]+\))[ \t]|[ \t]*.*?(?::::{0,2}|;;)(?:$|[ \t])|<?\d+>[ \t])/ # Matches an unordered list item (one level for hyphens, up to 5 levels for asterisks). # @@ -681,7 +681,7 @@ module Asciidoctor # - Foo # # NOTE we know trailing (.*) will match at least one character because we strip trailing spaces - UnorderedListRx = /^[ \t]*(-|\*\**|\u2022\u2022*)[ \t]+(.*)$/ + UnorderedListRx = /^[ \t]*(-|\*\**|\u2022)[ \t]+(.*)$/ # Matches an ordered list item (explicit numbering or up to 5 consecutive dots). # diff --git a/test/lists_test.rb b/test/lists_test.rb index be54dafc..8007ba15 100644 --- a/test/lists_test.rb +++ b/test/lists_test.rb @@ -942,35 +942,13 @@ List assert_css 'li', output, 26 end - test 'nested elements (5) with unicode bullet' do + test 'does not recognize lists with repeating unicode bullets' do input = <<-EOS -List -==== - -• Foo •• Boo -••• Snoo -•••• Froo -••••• Groo -• Blech EOS output = render_string input - assert_xpath '//ul', output, 5 - assert_xpath '(//ul)[1]/li', output, 2 - assert_xpath '((//ul)[1]/li//ul)[1]/li', output, 1 - assert_xpath '(((//ul)[1]/li//ul)[1]/li//ul)[1]/li', output, 1 - assert_xpath '((((//ul)[1]/li//ul)[1]/li//ul)[1]/li//ul)[1]/li', output, 1 - assert_xpath '(((((//ul)[1]/li//ul)[1]/li//ul)[1]/li//ul)[1]/li//ul)[1]/li', output, 1 - end if ::RUBY_MIN_VERSION_1_9 - - test 'nested arbitrary depth with unicode bullet' do - input = [] - ('a'..'z').each_with_index do |ch, i| - input << %(#{'•' * (i + 1)} #{ch}) - end - output = render_embedded_string input.join(%(\n)) - refute_includes output, '•' - assert_css 'li', output, 26 + assert_xpath '//ul', output, 0 + assert_includes output, '•' end if ::RUBY_MIN_VERSION_1_9 test "nested ordered elements (2)" do |
