summary refs log tree commit diff
path: root/gemtext.py
diff options
context:
space:
mode:
Diffstat (limited to 'gemtext.py')
-rw-r--r--gemtext.py10
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:])