Broken project to implement a cross-protocol browser in textual
Diffstat (limited to 'gemtext.py')
| -rw-r--r-- | gemtext.py | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -5,11 +5,13 @@ from textual.containers import Container class Gemtext(Static): """Gemtext widget.""" - def __init__(self, txt, id): + def __init__(self, fp, id): super().__init__(id=id) - self.addlines(txt) - def addlines(self, txt): - for line in txt.split('\n'): + self.addlines(fp) + def addlines(self, fp): + for line in fp: + if type(line) is bytes: + line = line.decode("UTF-8") if line.startswith("=>"): path = line[2:].lstrip().split(' ')[0] text = ' '.join(line[2:].lstrip().split(' ')[1:]) |