]>
Commit | Line | Data |
---|---|---|
69a34bb0 JB |
1 | From 917e0359fa93acd9b22d7122e2c03d994d9fda44 Mon Sep 17 00:00:00 2001 |
2 | From: Eric Holscher <eric@ericholscher.com> | |
3 | Date: Thu, 11 Oct 2018 16:52:24 +0200 | |
4 | Subject: [PATCH 2/2] Fix passing to math node | |
5 | ||
6 | --- | |
7 | recommonmark/transform.py | 14 ++++++++------ | |
8 | 1 file changed, 8 insertions(+), 6 deletions(-) | |
9 | ||
10 | diff --git a/recommonmark/transform.py b/recommonmark/transform.py | |
11 | index 72fd47d..916f144 100644 | |
12 | --- a/recommonmark/transform.py | |
13 | +++ b/recommonmark/transform.py | |
14 | @@ -205,12 +205,14 @@ def auto_inline_code(self, node): | |
15 | if not self.config['enable_inline_math']: | |
16 | return None | |
17 | content = content[1:-1] | |
18 | - self.state_machine.reset(self.document, | |
19 | - node.parent, | |
20 | - self.current_level) | |
21 | - return self.state_machine.run_role('math', content=content) | |
22 | - else: | |
23 | - return None | |
24 | + if content: | |
25 | + self.state_machine.reset(self.document, | |
26 | + node.parent, | |
27 | + self.current_level) | |
28 | + # Properly allow rst to get the raw content | |
29 | + math_content = '`%s`' % content | |
30 | + return self.state_machine.run_role('math', content=math_content) | |
31 | + return None | |
32 | ||
33 | def auto_code_block(self, node): | |
34 | """Try to automatically generate nodes for codeblock syntax. |