jekyll-l10n 1.3.12 → 1.3.13

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: d594bbf71a900016c2db658e2608e859ba9f9beac94ab8ef33feff21fc77d3fd
4
- data.tar.gz: ad7faef2249fe61c2621a48fc65ad37f7c657dd9e96c1891d513c62827903e49
3
+ metadata.gz: 7d37b72d3a9ac81cdfa5fdf8b7bdb46440004fdd72225f4c53a403a881f8a67f
4
+ data.tar.gz: c25fd4fe9fa8ccbff69eb563480e54e57566464b7e7b283850ba3e4c55806e0a
5
5
  SHA512:
6
- metadata.gz: f866be079e66e85d89a70950109afba2a33981572586f0daddee61310d43bc96afe273d2fc6901c276f2354e88833a3a8edb1dcadcfbf892988b3e9791a9b985
7
- data.tar.gz: 10f2079998d4ff46a2842e064037ce501ea1e937f8cce10720d10216ed43eb2462fc943cb1f50c2992ad66d03ad057d91915d3abd725cf62c5634cd5e9812a10
6
+ metadata.gz: aa5c0191a23efcf045dfa31da01b87b32a3d7b7facffda51aa1b24920e766293bafe836d9ca33e0452b6e46e9993e2f51ea19e52baf2ebb8434ea64fcfc89cd6
7
+ data.tar.gz: 87c2d77e2397c5b3705dd59a351320457ecd77ba50578c0ba766dcc7101c7ee3ce5a985d4d41d4fb162e1b56f6b98d50cd4b11eee63f040e2601290b55ce6a1c
@@ -50,7 +50,14 @@ module Jekyll
50
50
  # @return [Integer] 80
51
51
  PO_SHORT_LINE_LENGTH = 80
52
52
 
53
- # Character chunk size for long strings (split across multiple lines)
53
+ # Character chunk size for long strings (split across multiple lines).
54
+ # Must be kept in sync with the escape-sequence guard in
55
+ # {PoFileWriter.format_long_string}: when a chunk ends with an odd number
56
+ # of backslashes the trailing \\ is the first byte of a \\" pair and the
57
+ # chunk is shrunk by 1 so the escape sequence is never split across lines.
58
+ # Splitting \\" produces a dangling \\ in the reader's per-line unescape,
59
+ # which corrupts HTML attributes (e.g. target="_blank\\" instead of
60
+ # target="_blank").
54
61
  # @return [Integer] 70
55
62
  PO_LINE_LENGTH = 70
56
63
 
@@ -201,7 +201,7 @@ module Jekyll
201
201
  escaped.split("\n").each do |line|
202
202
  next if line.strip.empty?
203
203
 
204
- lines << "#{delimiter}#{line}#{delimiter}"
204
+ lines << "#{delimiter}#{line}\\n#{delimiter}"
205
205
  end
206
206
  lines << "#{delimiter}#{delimiter}" if lines.length == 1
207
207
  lines.join("\n")
@@ -213,8 +213,15 @@ module Jekyll
213
213
 
214
214
  while i < escaped.length
215
215
  chunk = escaped[i...(i + Jekyll::L10n::Constants::PO_LINE_LENGTH)]
216
+
217
+ # Never split an escape sequence: if chunk ends with an odd number of
218
+ # backslashes, the trailing \ is the first byte of \" — pull it back
219
+ # so it stays with its partner " in the next chunk.
220
+ trailing_backslashes = chunk[/\\*\z/].length
221
+ chunk = chunk[0...-1] if trailing_backslashes.odd?
222
+
216
223
  lines << "#{delimiter}#{chunk}#{delimiter}"
217
- i += Jekyll::L10n::Constants::PO_LINE_LENGTH
224
+ i += chunk.length
218
225
  end
219
226
 
220
227
  lines.join("\n")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-l10n
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.12
4
+ version: 1.3.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - ReleaseBot