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 +4 -4
- data/lib/jekyll-l10n/constants.rb +8 -1
- data/lib/jekyll-l10n/po_file/writer.rb +9 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7d37b72d3a9ac81cdfa5fdf8b7bdb46440004fdd72225f4c53a403a881f8a67f
|
|
4
|
+
data.tar.gz: c25fd4fe9fa8ccbff69eb563480e54e57566464b7e7b283850ba3e4c55806e0a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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 +=
|
|
224
|
+
i += chunk.length
|
|
218
225
|
end
|
|
219
226
|
|
|
220
227
|
lines.join("\n")
|