From 497edf0e1e2c1667a640e421a4dcbda0d856b827 Mon Sep 17 00:00:00 2001 From: "kujiu (@rincevent)" Date: Sun, 31 Jan 2021 13:09:28 +0100 Subject: [PATCH] Fix: paragraph format --- sphinx_gemini_builder/writer.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sphinx_gemini_builder/writer.py b/sphinx_gemini_builder/writer.py index ca98e8d..d09705b 100644 --- a/sphinx_gemini_builder/writer.py +++ b/sphinx_gemini_builder/writer.py @@ -459,7 +459,8 @@ class GeminiTranslator(SphinxTranslator): self.add_text(':') 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: pass @@ -682,7 +683,11 @@ class GeminiTranslator(SphinxTranslator): raise nodes.SkipNode 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: pass