Fix: paragraph format

This commit is contained in:
Kujiu 2021-01-31 13:09:28 +01:00
parent 0800969c39
commit 497edf0e1e
Signed by: kujiu
GPG key ID: ABBB2CAC6855599F

View file

@ -460,6 +460,7 @@ class GeminiTranslator(SphinxTranslator):
def depart_field_name(self, node: Element) -> None: def depart_field_name(self, node: Element) -> None:
self.add_text(':') self.add_text(':')
self.end_block()
def visit_field_body(self, node: Element) -> None: def visit_field_body(self, node: Element) -> None:
pass pass
@ -682,7 +683,11 @@ class GeminiTranslator(SphinxTranslator):
raise nodes.SkipNode raise nodes.SkipNode
def visit_Text(self, node: Text) -> None: def visit_Text(self, node: Text) -> None:
self.add_text(node.astext()) text = node.astext()
if isinstance(node.parent, nodes.paragraph):
text = text.replace('\r', '')
text = text.replace('\n', ' ')
self.add_text(text)
def depart_Text(self, node: Text) -> None: def depart_Text(self, node: Text) -> None:
pass pass