Skip to content

Commit e67207c

Browse files
m-messerclaude
andcommitted
fix: reformat markdown filter files and fix stale MathDelimiterProblem attribute
black --check was failing on markdown.py and test_markdown_filter.py, which were never reformatted after being added. That masked a second bug: _warn_markdown_issues still read problem.value, left over from before check_markdown() started returning MathDelimiterProblem dataclasses (f08f4df) instead of bare MathDelimiterError enums. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent a4da502 commit e67207c

3 files changed

Lines changed: 9 additions & 5 deletions

File tree

in2lambda/filters/markdown.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,11 @@ def markdown_converter(
164164
except Exception:
165165
expression = elem.text
166166
return pf.RawInline(
167-
f"${expression}$"
168-
if elem.format == "InlineMath"
169-
else f"\n\n$$\n{expression}\n$$\n\n",
167+
(
168+
f"${expression}$"
169+
if elem.format == "InlineMath"
170+
else f"\n\n$$\n{expression}\n$$\n\n"
171+
),
170172
format="markdown",
171173
)
172174

in2lambda/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
def _warn_markdown_issues(text: str, source: str) -> None:
2323
"""Echo a warning for each math-delimiter problem found in a markdown source."""
2424
for problem in check_markdown(text):
25-
click.echo(f"Warning: {source}: {problem.value}")
25+
click.echo(f"Warning: {source}: {problem}")
2626

2727

2828
def docx_to_md(docx_file: str) -> str:

tests/test_markdown_filter.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ def test_example_parses_into_questions_parts_and_solutions(filters_dir: str) ->
2424
"How long does the ball take to reach the ground, using:\n\n"
2525
"- the vertical motion equation\n- the given height and gravity"
2626
)
27-
assert projectile.parts[1].text == "How far from the launch point does the ball land?"
27+
assert (
28+
projectile.parts[1].text == "How far from the launch point does the ball land?"
29+
)
2830
assert projectile.parts[0].worked_solution.startswith("Vertical motion is")
2931
# The ``---`` separator survives as a literal step boundary.
3032
assert "\n\n---\n\n" in projectile.parts[0].worked_solution

0 commit comments

Comments
 (0)