New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Codebraid breaks on pandoc citations. #12
Comments
I did some experimentation, using So: diff --git a/codebraid/converters/pandoc.py b/codebraid/converters/pandoc.py
index 132a5f2..e03537c 100644
--- a/codebraid/converters/pandoc.py
+++ b/codebraid/converters/pandoc.py
@@ -510,7 +510,7 @@ def _get_walk_less_note_contents_closure(enumerate=enumerate, isinstance=isinsta
yield from walk_node_list_less_note_contents(obj)
elif isinstance(obj, dict):
yield (obj, node_list, index)
- if obj['t'] == 'Note':
+ if obj.get('t') == 'Note':
continue
obj_contents = obj.get('c', None)
if isinstance(obj_contents, list):
@@ -1004,7 +1004,7 @@ class PandocConverter(Converter):
'SoftBreak', 'Span'])
for node_tuple in self._walk_ast_less_note_contents(ast):
node, parent_node_list, parent_node_list_index = node_tuple
- node_type = node['t']
+ node_type = node.get('t')
if node_type in ignorable_inline_node_types:
pass
elif node_type == 'Str':
@@ -1212,7 +1212,7 @@ class PandocConverter(Converter):
thaw_raw_node = self._thaw_raw_node
for node_tuple in self._walk_ast(final_ast):
node, parent_node_list, parent_node_list_index = node_tuple
- node_type = node['t']
+ node_type = node.get('t')
if node_type in ('Code', 'CodeBlock') and 'codebraid--temp' in node['c'][0][1]:
thaw_raw_node(node)
else: However, this is a blind replace on my part, simply replacing wherever it complained that it was broken, so I have no idea if this breaks anything else. Should I open a PR? |
…, fixing incompatibility with nodes generated by citations (#12)
It should be fixed in the last commit. Citations like that are represented in Pandoc's AST in a form that I hadn't previously encountered. |
Seems to fix it! Thank you for the quick turnaround :) |
…, fixing incompatibility with nodes generated by citations (#12)
Minimal example:
Fails with:
The text was updated successfully, but these errors were encountered: