Broken project to implement a cross-protocol browser in textual
gemtext: Don't format as textual static markdown
Zach DeCook 2022-12-24
parent 2278c71 · commit b9d3929
-rw-r--r--gemtext.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/gemtext.py b/gemtext.py
index c20b5b1..749e6dc 100644
--- a/gemtext.py
+++ b/gemtext.py
@@ -9,15 +9,17 @@ class Gemtext(Static):
super().__init__(id=id)
self.addlines(fp)
def addlines(self, fp):
- for line in fp:
+ for lin in fp:
+ line = lin
if type(line) is bytes:
line = line.decode("UTF-8")
+ line = line.rstrip("\r\n")
if line.startswith("=>"):
path = line[2:].lstrip().split(' ')[0]
- text = ' '.join(line[2:].lstrip().split(' ')[1:]).rstrip("\r\n")
+ text = ' '.join(line[2:].lstrip().split(' ')[1:])
self.mount(Button(text or path, name=path))
else:
- self.mount(Static(line.rstrip("\r\n")))
+ self.mount(Static(line, markup=False))
if __name__ == "__main__":
from textual.app import App