Skip to content

Commit b595ca1

Browse files
committed
fixups
1 parent 4b3bb23 commit b595ca1

File tree

4 files changed

+17
-19
lines changed

4 files changed

+17
-19
lines changed

sphinx/transforms/i18n.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"""
1010

1111
from os import path
12-
from re import match, MULTILINE
12+
from re import match, DOTALL
1313
from textwrap import indent
1414
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Type, TypeVar
1515

@@ -84,7 +84,7 @@ def publish_msgstr(app: "Sphinx", source: str, source_path: str, source_line: in
8484

8585

8686
def parse_noqa(source: str) -> Tuple[str, bool]:
87-
m = match(r"(.*)(?<!\\)#\s*noqa\s*$", source, MULTILINE)
87+
m = match(r"(.*)(?<!\\)#\s*noqa\s*$", source, DOTALL)
8888
if m:
8989
return m.group(1), True
9090
else:

tests/roots/test-intl/xx/LC_MESSAGES/literalblock.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ msgstr "LITERAL-BLOCK\n"
8080
msgid "test_code_for_noqa()\n"
8181
"continued()"
8282
msgstr ""
83-
"# Trailing noqa should not get stripped\n"
84-
"# from this block. #noqa"
83+
"# TRAILING noqa SHOULD NOT GET STRIPPED\n"
84+
"# FROM THIS BLOCK. #noqa"
8585

8686
msgid "doctest blocks"
8787
msgstr "DOCTEST-BLOCKS"

tests/roots/test-intl/xx/LC_MESSAGES/noqa.po

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ msgstr ""
1919

2020
#: ../tests/roots/test-intl/noqa.txt:2
2121
msgid "First section"
22-
msgstr ""
22+
msgstr "FIRST SECTION"
2323

2424
#: ../tests/roots/test-intl/noqa.txt:4
2525
msgid "Some text with a reference, :ref:`next-section`."
@@ -28,20 +28,17 @@ msgstr "TRANSLATED TEXT WITHOUT REFERENCE. #noqa"
2828
#: ../tests/roots/test-intl/noqa.txt:6
2929
msgid "Another reference: :ref:`next-section`."
3030
msgstr ""
31-
"TEST WHITESPACE INSENSITIVITY.\n"
32-
"\n"
33-
"\n"
34-
" # \n"
35-
"\n"
36-
"noqa"
31+
"TEST noqa WHITESPACE INSENSITIVITY.\n"
32+
"# \n"
33+
" noqa"
3734

3835
#: ../tests/roots/test-intl/noqa.txt:8
3936
msgid "This should allow to test escaping ``#noqa``."
40-
msgstr "``#noqa`` is escaped at the end of this string. \\#noqa"
37+
msgstr "``#noqa`` IS ESCAPED AT THE END OF THIS STRING. \\#noqa"
4138

4239
#: ../tests/roots/test-intl/noqa.txt:13
4340
msgid "Next section"
44-
msgstr ""
41+
msgstr "NEXT SECTION WITH PARAGRAPH TO TEST BARE noqa"
4542

4643
# This edge case should not fail.
4744
#: ../tests/roots/test-intl/noqa.txt:15

tests/test_intl.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -198,20 +198,21 @@ def test_text_inconsistency_warnings(app, warning):
198198
def test_noqa(app, warning):
199199
app.build()
200200
result = (app.outdir / 'noqa.txt').read_text()
201-
expect = r"""First section
201+
expect = r"""FIRST SECTION
202202
*************
203203
204204
TRANSLATED TEXT WITHOUT REFERENCE.
205205
206-
TEST WHITESPACE INSENSITIVITY.
206+
TEST noqa WHITESPACE INSENSITIVITY.
207207
208-
"#noqa" is escaped at the end of this string. #noqa
208+
"#noqa" IS ESCAPED AT THE END OF THIS STRING. #noqa
209209
210210
211-
Next section
212-
************
211+
NEXT SECTION WITH PARAGRAPH TO TEST BARE noqa
212+
*********************************************
213213
214-
Some text, again referring to the section: Next section.
214+
Some text, again referring to the section: NEXT SECTION WITH PARAGRAPH
215+
TO TEST BARE noqa.
215216
"""
216217
assert result == expect
217218
assert "next-section" not in getwarning(warning)

0 commit comments

Comments
 (0)