Skip to content

Commit 703ef3a

Browse files
authored
Fix Chapter 2 localization highlighting
1 parent 912851e commit 703ef3a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

script.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ def parse_text(text: str) -> str:
6969

7070
def highlight_text(matches: re.Match[str]) -> str:
7171
return env.get_template('highlight/text.html').render(
72-
before_var=matches[1],
73-
variable=matches[2],
72+
before_var="",
73+
variable=matches[1],
7474
after_var=matches[3],
75-
parsed_text=parse_text(matches[2])
75+
parsed_text=parse_text(matches[1])
7676
)
7777

7878

@@ -205,7 +205,7 @@ def process_line(
205205
) -> str:
206206
# Highlight localized strings
207207
line = re.sub(
208-
r'([A-Za-z0-9_]+loc\((?:\d+, )?")((?:[^"\\]|\\.)+)(", "[a-z0-9_-]+"\))', # noqa: E501
208+
r'(?:[A-Za-z0-9_]+loc\((?:\d+, )?")((?:[^"\\]|\\.)+)(", "[a-z0-9_-]+")\)', # noqa: E501
209209
highlight_text,
210210
line,
211211
flags=re.IGNORECASE

0 commit comments

Comments
 (0)