diff options
Diffstat (limited to '_ext')
-rw-r--r-- | _ext/crowbar_domain.py | 2 | ||||
-rw-r--r-- | _ext/gemtext_builder.py | 30 |
2 files changed, 16 insertions, 16 deletions
diff --git a/_ext/crowbar_domain.py b/_ext/crowbar_domain.py index 619487d..673f756 100644 --- a/_ext/crowbar_domain.py +++ b/_ext/crowbar_domain.py @@ -52,7 +52,7 @@ class ElementDirective(ObjectDescription): else: peg_rule += addnodes.desc_sig_operator('', '', nodes.literal(text=token)) return element - + def add_target_and_index(self, name, sig, signode): signode['ids'].append('element' + '-' + name) if 'noindex' not in self.options: diff --git a/_ext/gemtext_builder.py b/_ext/gemtext_builder.py index c26b053..9c7326d 100644 --- a/_ext/gemtext_builder.py +++ b/_ext/gemtext_builder.py @@ -14,7 +14,7 @@ class GemtextWriter(writers.Writer): def __init__(self, builder): super().__init__() self.builder = builder - + def translate(self): visitor = self.builder.create_translator(self.document, self.builder) self.document.walkabout(visitor) @@ -33,25 +33,25 @@ class GemtextTranslator(SphinxTranslator): if self.current_line != '': self.body.append(self.current_line) self.current_line = '' - + def visit_document(self, node: nodes.document): self.heading_level = 1 self.current_line = '' self.body = [] self.literal = False self.pending_links = [] - + def depart_document(self, node: nodes.document): self._finish_line() - + def visit_section(self, node: nodes.section): self.heading_level += 1 if len(self.body) > 0 and self.body[-1] != '': self.body.append('') - + def depart_section(self, node: nodes.section): self.heading_level -= 1 - + def visit_title(self, node: nodes.title): pass @@ -65,7 +65,7 @@ class GemtextTranslator(SphinxTranslator): if not self.literal: text = text.replace('\n', ' ') self.current_line += text - + def depart_Text(self, node: nodes.Text): pass @@ -95,7 +95,7 @@ class GemtextTranslator(SphinxTranslator): self.body.append('=> {} {}'.format(node.attributes['uri'], node.attributes['alt'])) else: raise NotImplementedError('inline images') - + def depart_image(self, node: nodes.image): pass @@ -104,12 +104,12 @@ class GemtextTranslator(SphinxTranslator): def visit_strong(self, node: nodes.strong): self.current_line += '**' - + depart_strong = visit_strong def visit_emphasis(self, node: nodes.emphasis): self.current_line += '_' - + depart_emphasis = visit_emphasis def visit_target(self, node: nodes.target): @@ -165,16 +165,16 @@ class GemtextTranslator(SphinxTranslator): self.body.append('```') self.body.append('') self.literal = False - + def visit_index(self, node: nodes.Node): pass - + def depart_index(self, node: nodes.Node): pass def visit_desc(self, node: nodes.Node): pass - + def depart_desc(self, node: nodes.Node): pass @@ -250,10 +250,10 @@ class GemtextBuilder(Builder): def get_outdated_docs(self): yield from self.env.found_docs # can't be fucked to implement this right yield 'genindex' - + def get_target_uri(self, docname: str, typ: str = None): return docname + '.gmi' - + def prepare_writing(self, docnames: Set[str]): self.writer = GemtextWriter(self) |