diff options
| author | Zach DeCook <zachdecook@librem.one> | 2022-12-23 19:08:28 -0500 |
|---|---|---|
| committer | Zach DeCook <zachdecook@librem.one> | 2022-12-23 19:08:28 -0500 |
| commit | 259946e39ff7382a84a432a300c92d0f3744f12d (patch) | |
| tree | f194ce47ec65ff05afdd75f7266eaea26ecac137 /gemtext.py | |
| parent | f62aa8b56139a758dbe1cd7b093d980c260cea18 (diff) | |
| download | browset-259946e39ff7382a84a432a300c92d0f3744f12d.tar.gz | |
Browsing: Actually browse gemini!
Diffstat (limited to 'gemtext.py')
| -rw-r--r-- | gemtext.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/gemtext.py b/gemtext.py index 66a2ad6..959f565 100644 --- a/gemtext.py +++ b/gemtext.py @@ -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:]) |
