Fix inconsistent backslash escaping
This commit is contained in:
parent
047f229177
commit
458c8cff9d
|
@ -13,12 +13,12 @@ do
|
||||||
local function replace_single(pfx, c)
|
local function replace_single(pfx, c)
|
||||||
local pl = #pfx
|
local pl = #pfx
|
||||||
if pl % 2 == 0 then
|
if pl % 2 == 0 then
|
||||||
return pfx .. c
|
return pfx:sub(1, pl/2) .. c
|
||||||
end
|
end
|
||||||
return string.sub(pfx, 1, math.floor(pl/2)) .. (schartbl[c] or c)
|
return string.sub(pfx, 1, math.floor(pl/2)) .. (schartbl[c] or c)
|
||||||
end
|
end
|
||||||
unescape_string = function(str)
|
unescape_string = function(str)
|
||||||
return (string.gsub(str, [[(\+)([abefnrtv'"?])]], replace_single):gsub([[\\]], [[\]]))
|
return string.gsub(str, [[(\+)([abefnrtv'"?])]], replace_single)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ describe("PO file converter", function()
|
||||||
# textdomain: foo
|
# textdomain: foo
|
||||||
foo=bar
|
foo=bar
|
||||||
baz=
|
baz=
|
||||||
#@=wh\at\@n=@=w\as\@n
|
#@=wh\at\\@n=@=w\as\\@n
|
||||||
multiline@nstrings=
|
multiline@nstrings=
|
||||||
with context?=oder doch nicht]], poconvert.from_string("foo", [[
|
with context?=oder doch nicht]], poconvert.from_string("foo", [[
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -22,8 +22,8 @@ msgid "baz"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#, fuzzy
|
#, fuzzy
|
||||||
msgid "=wh\\at\\\n"
|
msgid "=wh\\at\\\\\n"
|
||||||
msgstr "=w\\as\\\n"
|
msgstr "=w\\as\\\\\n"
|
||||||
|
|
||||||
msgid "multi"
|
msgid "multi"
|
||||||
"line\n"
|
"line\n"
|
||||||
|
|
Loading…
Reference in New Issue