File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11"""Python library and CLT for converting LaTeX documents into Lambda Feedback compatible JSON/ZIP files."""
22
3+ import beartype
34import click
45import panflute
56import rich_click
6- import beartype
77from beartype .claw import beartype_this_package
88from rich .traceback import install
99
Original file line number Diff line number Diff line change 1+ \documentclass {article }
2+
3+ \begin {document }
4+
5+ \newenvironment {SomeSolutionDividerName}{}{}
6+
7+ \section* {Minimal Example }
8+
9+ \hrulefill
10+
11+ \medskip
12+
13+ \begin {enumerate }
14+
15+ \item Here is some interesting information. Calculate the following:
16+
17+ \begin {enumerate }
18+ \item $ 1 +1 $
19+ \item $ 2 +2 $
20+ \end {enumerate }
21+
22+ \begin {SomeSolutionDividerName }
23+ \begin {enumerate }
24+ \item $ 1 +1 =2 $
25+ \item $ 2 +2 =4 $
26+ \end {enumerate }
27+ \end {SomeSolutionDividerName }
28+
29+ \item This questions has no parts. What is the solution?
30+
31+ \begin {SomeSolutionDividerName }
32+ This is the solution.
33+ \end {SomeSolutionDividerName }
34+
35+ \end {enumerate }
36+
37+ \end {document }
Original file line number Diff line number Diff line change 11#!/usr/bin/env python3
22
3- """Pandoc filter for Physics Linear Algebra.
4-
5- See https://pandoc.org/filters.html for more information.
6- """
3+ """A filter that parses files where solutions come after the whole questions and are broken down by part."""
74
85from typing import Optional
96
Original file line number Diff line number Diff line change 1+ \documentclass {article }
2+
3+ \begin {document }
4+
5+ \newenvironment {SomeSolutionDividerName}{}{}
6+
7+ \section* {Minimal Example }
8+
9+ \hrulefill
10+
11+ \medskip
12+
13+ \begin {enumerate }
14+
15+ \item Here is some interesting information. Calculate the following:
16+
17+ \begin {enumerate }
18+ \item $ 1 +1 $
19+
20+ \begin {SomeSolutionDividerName }
21+ $ 1 +1 =2 $
22+ \end {SomeSolutionDividerName }
23+
24+ \item $ 2 +2 $
25+
26+ \begin {SomeSolutionDividerName }
27+ $ 2 +2 =4 $
28+ \end {SomeSolutionDividerName }
29+ \end {enumerate }
30+
31+ \item This questions has no parts. What is the solution?
32+
33+ \begin {SomeSolutionDividerName }
34+ This is the solution.
35+ \end {SomeSolutionDividerName }
36+
37+ \end {enumerate }
38+
39+ \end {document }
Original file line number Diff line number Diff line change 11#!/usr/bin/env python3
22
3- """Pandoc filter for Physics Linear Algebra.
4-
5- See https://pandoc.org/filters.html for more information.
6- """
3+ """A filter that parses files where a soltution follows each individual part."""
74
85from collections import deque
96from typing import Optional
Original file line number Diff line number Diff line change 1+ \documentclass [12pt ]{article }
2+
3+ \newenvironment {AnyName}{}{}
4+
5+ \begin {document }
6+
7+ \section {Minimal Example }
8+
9+ \subsection {}
10+
11+ Here is some preliminary question information that might be useful.
12+
13+ \begin {enumerate }
14+ \item This is part (a)
15+ \item The filter still works even if there aren't any parts
16+ \end {enumerate }
17+
18+ \begin {AnyName }
19+ \paragraph {Solution }
20+
21+ This is the final answer. It contains the solutions for all parts without breaking them up.
22+
23+ $$
24+ 1 +1 = 2
25+ $$
26+
27+ The solution is copied across all parts.
28+
29+ \end {AnyName }
30+
31+ \subsection {}
32+
33+ This is question 2.
34+
35+ \begin {AnyName }
36+ \paragraph {Solution } And here's the solution
37+ \end {AnyName }
38+
39+ \end {document }
Original file line number Diff line number Diff line change 11#!/usr/bin/env python3
22
3- """Pandoc filter for Materials files (specifically by Jonathan Rackham).
4-
5- See https://pandoc.org/filters.html for more information.
6- """
3+ """A filter that parses files where solutions are denoted by beginning with the paragraph text 'Solution'. The solutions don't break down by part."""
74
85from typing import Optional
96
@@ -36,6 +33,7 @@ def pandoc_filter(
3633 """
3734 match type (elem ):
3835 # Question text is stored in paragraph blocks where the preceding block is a section header.
36+ # TODO: This doesn't work if the question has more than one paragraph
3937 case pf .Para :
4038 if (
4139 isinstance (elem .prev , pf .Header )
You can’t perform that action at this time.
0 commit comments