GithubHelp home page GithubHelp logo

Comments (3)

Synthetica9 avatar Synthetica9 commented on June 18, 2024

I did some experimentation, using .get('t') in a few places seems to fix everything.

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?

from codebraid.

gpoore avatar gpoore commented on June 18, 2024

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.

from codebraid.

Synthetica9 avatar Synthetica9 commented on June 18, 2024

Seems to fix it! Thank you for the quick turnaround :)

from codebraid.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.