From 09f30d3d005f9c213fac016c8e28e12150e44019 Mon Sep 17 00:00:00 2001 From: dece Date: Thu, 8 Jul 2021 15:29:55 +0200 Subject: [PATCH] gemtext: fix missing empty lines in pre. blocks --- bebop/gemtext.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bebop/gemtext.py b/bebop/gemtext.py index 16c9825..2f518c9 100644 --- a/bebop/gemtext.py +++ b/bebop/gemtext.py @@ -63,9 +63,10 @@ def parse_gemtext(text: str, dumb=False) -> ParsedGemtext: preformatted = None for line in text.splitlines(): line = line.rstrip() - # In standard mode, discard empty lines. In dumb mode, empty lines are - # kept as basic text. - if not line and not dumb: + # Empty lines: + # - in standard mode, discard them, except for preformatted blocks. + # - in dumb mode, keep them. + if not line and not (dumb or preformatted): continue if line.startswith(Preformatted.FENCE):