gemtext: fix missing empty lines in pre. blocks

This commit is contained in:
dece 2021-07-08 15:29:55 +02:00
parent 3d73d14983
commit 09f30d3d00

View file

@ -63,9 +63,10 @@ def parse_gemtext(text: str, dumb=False) -> ParsedGemtext:
preformatted = None preformatted = None
for line in text.splitlines(): for line in text.splitlines():
line = line.rstrip() line = line.rstrip()
# In standard mode, discard empty lines. In dumb mode, empty lines are # Empty lines:
# kept as basic text. # - in standard mode, discard them, except for preformatted blocks.
if not line and not dumb: # - in dumb mode, keep them.
if not line and not (dumb or preformatted):
continue continue
if line.startswith(Preformatted.FENCE): if line.startswith(Preformatted.FENCE):