Show More
@@ -14,29 +14,17 b' class LatexTransformer(ActivatableTransformer):' | |||||
14 | Converter for latex destined documents. |
|
14 | Converter for latex destined documents. | |
15 | """ |
|
15 | """ | |
16 |
|
16 | |||
17 |
def |
|
17 | def cell_transform(self, cell, other, index): | |
18 | """ |
|
18 | """ | |
19 | Entrypoint |
|
19 | Apply a transformation on each cell, | |
20 |
|
20 | |||
21 | nb - Input notebook |
|
21 | receive the current cell, the resource dict and the index of current cell as parameter. | |
22 | other - Maps to 'resources' in Jinja |
|
|||
23 | """ |
|
|||
24 |
|
||||
25 | # Only run if enabled. |
|
|||
26 | if self.enabled: |
|
|||
27 | return self.Transform(nb, other) |
|
|||
28 |
|
22 | |||
29 | def Transform(self, nb, other): |
|
23 | Returns modified cell and resource dict. | |
30 |
|
|
24 | """ | |
31 | Transform the notebook to make it compatible with markdown2latex. |
|
|||
32 | """ |
|
|||
33 |
|
||||
34 | #Fix the markdown in every markdown cell. |
|
|||
35 | for sheet in nb.worksheets: |
|
|||
36 | for cell in sheet.cells: |
|
|||
37 |
|
|
25 | if hasattr(cell, "source") and cell.cell_type == "markdown": | |
38 |
|
|
26 | cell.source = self.remove_math_space(cell.source) | |
39 |
return |
|
27 | return cell, other | |
40 |
|
28 | |||
41 | def remove_math_space(self, text): |
|
29 | def remove_math_space(self, text): | |
42 | """ |
|
30 | """ |
General Comments 0
You need to be logged in to leave comments.
Login now