From c916253f17b329550250549ea0aef4b67ced026f Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Thu, 29 Oct 2020 19:42:29 -0600 Subject: fix gemtest builder again i really should be running this locally more often --- _ext/gemtext_builder.py | 62 ++++++++++++++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 24 deletions(-) (limited to '_ext') diff --git a/_ext/gemtext_builder.py b/_ext/gemtext_builder.py index 53bc2a1..c26b053 100644 --- a/_ext/gemtext_builder.py +++ b/_ext/gemtext_builder.py @@ -82,6 +82,8 @@ class GemtextTranslator(SphinxTranslator): pass def depart_reference(self, node: nodes.reference): + if 'refuri' not in node.attributes: + return if self.current_line.startswith('=>'): self._finish_line() self.body.append('=> {} {}'.format(node.attributes['refuri'], node.astext())) @@ -141,89 +143,101 @@ class GemtextTranslator(SphinxTranslator): def depart_inline(self, node: nodes.inline): pass - def visit_title_reference(self, nodes: nodes.title_reference): + def visit_title_reference(self, node: nodes.title_reference): pass - def depart_title_reference(self, nodes: nodes.title_reference): + def depart_title_reference(self, node: nodes.title_reference): pass - def visit_literal(self, nodes: nodes.literal): + def visit_literal(self, node: nodes.literal): self.current_line += '`' depart_literal = visit_literal - def visit_literal_block(self, nodes: nodes.literal_block): + def visit_literal_block(self, node: nodes.literal_block): if self.body[-1] != '': self.body.append('') self.body.append('```') self.literal = True - def depart_literal_block(self, nodes: nodes.literal_block): + def depart_literal_block(self, node: nodes.literal_block): self._finish_line() self.body.append('```') self.body.append('') self.literal = False - def visit_index(self, nodes: nodes.Node): + def visit_index(self, node: nodes.Node): pass - def depart_index(self, nodes: nodes.Node): + def depart_index(self, node: nodes.Node): pass - def visit_desc(self, nodes: nodes.Node): + def visit_desc(self, node: nodes.Node): pass - def depart_desc(self, nodes: nodes.Node): + def depart_desc(self, node: nodes.Node): pass visit_term = visit_list_item - def depart_term(self, nodes: nodes.Node): + def depart_term(self, node: nodes.Node): self._finish_line() - def visit_definition(self, nodes: nodes.Node): + def visit_definition(self, node: nodes.Node): pass - def depart_definition(self, nodes: nodes.Node): + def depart_definition(self, node: nodes.Node): pass visit_desc_signature = visit_term depart_desc_signature = depart_term - def visit_desc_name(self, nodes: nodes.Node): + def visit_desc_name(self, node: nodes.Node): pass - def depart_desc_name(self, nodes: nodes.Node): + def depart_desc_name(self, node: nodes.Node): pass - def visit_desc_content(self, nodes: nodes.Node): + def visit_desc_content(self, node: nodes.Node): pass - def depart_desc_content(self, nodes: nodes.Node): + def depart_desc_content(self, node: nodes.Node): pass - def visit_glossary(self, nodes: nodes.Node): + def visit_glossary(self, node: nodes.Node): pass - def depart_glossary(self, nodes: nodes.Node): + def depart_glossary(self, node: nodes.Node): pass - def visit_definition_list(self, nodes: nodes.Node): + def visit_definition_list(self, node: nodes.Node): pass - def depart_definition_list(self, nodes: nodes.Node): + def depart_definition_list(self, node: nodes.Node): pass - def visit_definition_list_item(self, nodes: nodes.Node): + def visit_definition_list_item(self, node: nodes.Node): pass - def depart_definition_list_item(self, nodes: nodes.Node): + def depart_definition_list_item(self, node: nodes.Node): pass - def visit_todo_node(self, nodes: nodes.Node): + def visit_todo_node(self, node: nodes.Node): pass - def depart_todo_node(self, nodes: nodes.Node): + def depart_todo_node(self, node: nodes.Node): + pass + + def visit_note(self, node: nodes.Node): + pass + + def depart_note(self, node: nodes.Node): + pass + + def visit_math(self, node: nodes.Node): + pass + + def depart_math(self, node: nodes.Node): pass class GemtextBuilder(Builder): -- cgit v1.2.3