Update server.py
This commit is contained in:
parent
f915810025
commit
af2f23e44e
1 changed files with 57 additions and 47 deletions
10
server.py
10
server.py
|
@ -76,6 +76,13 @@ def relay():
|
||||||
if i.split(" ")[1].split(";")[0] != "text/gemini":
|
if i.split(" ")[1].split(";")[0] != "text/gemini":
|
||||||
print("Unrecognised type: " + i.split(" ")[1])
|
print("Unrecognised type: " + i.split(" ")[1])
|
||||||
return Response(" ".join(received.split("\n")[1:]), mimetype=i.split(" ")[1])
|
return Response(" ".join(received.split("\n")[1:]), mimetype=i.split(" ")[1])
|
||||||
|
else:
|
||||||
|
if escaped:
|
||||||
|
if i[0:3] == "```":
|
||||||
|
code += "</pre>\n"
|
||||||
|
escaped = False
|
||||||
|
else:
|
||||||
|
code += i + "\n"
|
||||||
else:
|
else:
|
||||||
if i[0:2] == "# ":
|
if i[0:2] == "# ":
|
||||||
if title == "Something went wrong...":
|
if title == "Something went wrong...":
|
||||||
|
@ -85,6 +92,9 @@ def relay():
|
||||||
elif i[0:3] == "## ":
|
elif i[0:3] == "## ":
|
||||||
temp = i[3:]
|
temp = i[3:]
|
||||||
code += f"<h2>{temp}</h2>\n"
|
code += f"<h2>{temp}</h2>\n"
|
||||||
|
elif i[0:3] == "```":
|
||||||
|
code += "<pre>\n"
|
||||||
|
escaped = True
|
||||||
elif i[0:4] == "### ":
|
elif i[0:4] == "### ":
|
||||||
temp = i[4:]
|
temp = i[4:]
|
||||||
code += f"<h3>{temp}</h3>\n"
|
code += f"<h3>{temp}</h3>\n"
|
||||||
|
|
Loading…
Add table
Reference in a new issue