Fix some errors when text is None

This commit is contained in:
Kujiu 2021-06-02 19:34:15 +02:00
parent 0c23110169
commit 04f3997ef8
Signed by: kujiu
GPG key ID: ABBB2CAC6855599F
5 changed files with 11 additions and 5 deletions

View file

@ -2,6 +2,11 @@
Changes
=======
1.1.2 (*2021-06-02*)
====================
- Fix error when text is None
1.1.1 (*2021-02-03*)
====================

View file

@ -28,7 +28,7 @@ with open("README.rst", "r") as fh:
setup(
name="sphinx_gemini_builder",
version="1.1.1",
version="1.1.2",
url="https://procrastinator.nerv-project.eu/nerv-project/sphinx_gemini_builder",
license="EUPL 1.2",
author="Kujiu",

View file

@ -5,7 +5,7 @@
Build Gemini blog from Sphinx.
"""
__version_info__ = (1, 1, 1)
__version_info__ = (1, 1, 2)
__version__ = '.'.join([str(val) for val in __version_info__])

View file

@ -45,7 +45,8 @@ class Page:
self.body += '\n'
def add_raw(self, text: str) -> None:
self.body += text
if text:
self.body += text
def end_block(self) -> None:
self.body += '\n'

View file

@ -61,10 +61,10 @@ class GeminiTranslator(SphinxTranslator):
def add_text(self, text: str) -> None:
if self.table:
if len(self.cell_text):
self.cell_text[-1] += text
self.cell_text[-1] += text or ''
else:
self.cell_text.append(text)
else:
elif text:
self.body += text
def add_link(self, url: str, label: str = '') -> None: