markbridge 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f805bfbca5d3f0ecb098c54a27c367a3b5c44bdf79a59bd4f4f04073f3b4e3d7
4
- data.tar.gz: 77d62ba2660fc967f9475fafb768e3728e54ad0811f562bc575fdfcfbd2bfe5a
3
+ metadata.gz: cd32ca1996ac298962ade2f5728f0e0b9999ae0e2934b44474e003ca74888e32
4
+ data.tar.gz: 43334aa515a7326ac7e514e1ebd252f7517866a6fe254c350f7c51085ca26ba4
5
5
  SHA512:
6
- metadata.gz: b65279c8b48a47f1c745e601dca97ccdaa170279830ed6ecb82aed03439cb0ed05a37d5ff3818920efde337fbe65c32c9cf3e24e354bbd072b230fe7334128ea
7
- data.tar.gz: a6139242a1f81149bf0e3eb1560ec70028979e5ee2aba12d0b0477e1b8b505e526a657e4dc5854a89f4903aad376fe687bf80a72d77b8eb3238f46f76b267cb8
6
+ metadata.gz: a2d9e6f8ed438bbe9425a33c4cf834e707bea7efc953bfd0d1c1aa53faea9b578ed54d7cb6a0fccb1a79ee433f43feb2a6858bf00f8fc19f8d55bef0237842f0
7
+ data.tar.gz: 90f49ebacb4bc8be03b27aa0b730aea8a4b6f6206a601e19cd7fdc6cfb56e23916dec63ae990ce05c525103afd29d2949b15e812d74662e53776dced970177f2
@@ -132,7 +132,14 @@ module Markbridge
132
132
  private
133
133
 
134
134
  def escape_text(text)
135
- lines = text.split("\n", -1)
135
+ # On CRLF input, consume `\r` as part of the line terminator instead
136
+ # of leaving it on the line. A trailing `\r` breaks line-end anchored
137
+ # regexes (e.g. SETEXT_UNDERLINE_*) and the `ws_end >= line_length`
138
+ # early-out in escape_indented_code, leaking NBSPs onto
139
+ # whitespace-only CRLF lines. The `include?` guard keeps the
140
+ # LF-only fast path on a string split (regex split is ~20% slower
141
+ # on the indented-code hot path).
142
+ lines = text.include?("\r") ? text.split(/\r?\n/, -1) : text.split("\n", -1)
136
143
  return escape_line(lines[0], false) if lines.size == 1
137
144
 
138
145
  # Pre-allocate result buffer
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Markbridge
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.3"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: markbridge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Discourse Team