Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion babel/messages/jslexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def unquote_string(string: str) -> str:
assert string and string[0] == string[-1] and string[0] in '"\'`', (
'string provided is not properly delimited'
)
string = line_join_re.sub('\\1', string[1:-1])
string = line_join_re.sub('', string[1:-1])
result: list[str] = []
add = result.append
pos = 0
Expand Down
6 changes: 6 additions & 0 deletions tests/messages/test_js_extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ def test_simple_extract():
(3, ('s', 'p'), [], None)]


def test_extract_string_with_escaped_line_terminator():
buf = BytesIO(b"_('hey\\\nlol')")
messages = list(extract.extract('javascript', buf, extract.DEFAULT_KEYWORDS, [], {}))
assert messages == [(1, 'heylol', [], None)]


def test_various_calls():
buf = BytesIO(b"""\
msg1 = _(i18n_arg.replace(/"/, '"'))
Expand Down