Handle preformatted content.

This commit is contained in:
Solderpunk 2020-03-07 20:24:26 +01:00
parent fea4bc3757
commit eca985da3e
1 changed files with 6 additions and 1 deletions

View File

@ -86,8 +86,13 @@ while True:
# Handle a Gemini map
if mime == "text/gemini":
menu = []
preformatted = False
for line in body.splitlines():
if line.startswith("=>") and line[2:].strip():
if line.startswith("```"):
preformatted = not preformatted
elif preformatted:
print(line)
elif line.startswith("=>") and line[2:].strip():
bits = line[2:].strip().split(maxsplit=1)
link_url = bits[0]
link_url = absolutise_url(url, link_url)