Skip to content

Commit caaab98

Browse files
committed
fix lessonchecker
1 parent 3b5564d commit caaab98

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

Scripts/LessonChecker.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ def handle_starttag(self, tag, attrs):
190190
case _:
191191
# Any other unescaped
192192
if State.CODE in self.state:
193-
print(tag)
194193
self.state |= State.ERROR
195194
self._warn(
196195
f"<mark> annotations are the only tags allowed in <code> blocks! Violation in lesson {self.lesson_name} line num: {self.getpos()} tag: {tag}"
@@ -222,11 +221,13 @@ def handle_data(self, data):
222221
self.output.append(data)
223222

224223
def handle_entityref(self, name):
224+
print(name)
225225
match name:
226226
case "lt" | "gt" | "amp":
227227
raw_entity = f"&{name};"
228-
case str() if m := re.search(r"lt(.+)", name):
229-
raw_entity = f"&lt;{m.group(1)};"
228+
229+
case str() if m := re.search(r"(lt|gt|amp)(.+)", name):
230+
raw_entity = f"&{m.group(1)};{m.group(2)}"
230231

231232
self.state |= State.ERROR
232233
self._warn(

Scripts/test_LessonChecker.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
"extract": True,
111111
"verify": False,
112112
"fix": False,
113-
"silent": True,
113+
"silent": False,
114114
"expected_return": False,
115115
"expected_code": "#include<sycl/sycl.hpp>",
116116
},
@@ -166,15 +166,14 @@
166166
},
167167
{
168168
"name": "fix_partial_escape_sequences",
169-
"body": '<div>&amp</div>',
169+
"body": "<div>&lt1</div>",
170170
"extract": False,
171171
"verify": False,
172172
"fix": True,
173173
"silent": False,
174174
"expected_return": True,
175-
"expected_output": '<div>&amp;</div>',
175+
"expected_output": "<div>&lt;1</div>",
176176
},
177-
178177
]
179178

180179

0 commit comments

Comments
 (0)