Skip to content

Commit

Permalink
Remove unnecessary \z from regexp
Browse files Browse the repository at this point in the history
  • Loading branch information
gettalong committed Nov 16, 2024
1 parent 8fe657c commit 2cb1942
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/kramdown/converter/kramdown.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def convert_text(el, opts)
def convert_p(el, opts)
w = @options[:line_width] - opts[:indent].to_s.to_i
first, second, *rest = inner(el, opts).strip.gsub(/(.{1,#{w}})( +|$\n?)/, "\\1\n").split(/\n/)
first&.gsub!(/^(?:(#|>)|(\d+)\.([\s\z])|([+-]\s))/) { $1 || $4 ? "\\#{$1 || $4}" : "#{$2}\\.#{$3}" }
first&.gsub!(/^(?:(#|>)|(\d+)\.(\s)|([+-]\s))/) { $1 || $4 ? "\\#{$1 || $4}" : "#{$2}\\.#{$3}" }
second&.gsub!(/^([=-]+\s*?)$/, "\\\1")
res = [first, second, *rest].compact.join("\n") + "\n"
res.gsub!(/^ {0,3}:/, "\\:")
Expand Down
2 changes: 2 additions & 0 deletions test/testcases/block/08_list/escaping.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@

<p>1984.5 is not a book.</p>

<p>1984.</p>

<p>- This too!</p>
2 changes: 2 additions & 0 deletions test/testcases/block/08_list/escaping.text
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ I have read the book 1984.

1984.5 is not a book.

1984\.

\- This too!

0 comments on commit 2cb1942

Please sign in to comment.