gemini.git

going-flying.com gemini git repository

summary

tree

log

refs

af0cf9154815da3e9b0f4b0eeb2a1d92736905b5 - Matthew Ernisse - 1596041498

I think this is why new blocks of thoughts get added backwards.

view tree

view raw

diff --git a/files/thoughts-to-gemini.py b/files/thoughts-to-gemini.py
index e35218d..eea3cf3 100755
--- a/files/thoughts-to-gemini.py
+++ b/files/thoughts-to-gemini.py
@@ -112,6 +112,7 @@ class DeHTMLizer(object):
 			return el.string
 		else:
 			return ''
+		
 
 	def parseTag(self, tag):
 		# So, of the tags that I believe we'll encounter that we
@@ -133,7 +134,7 @@ class DeHTMLizer(object):
 					buf += self.parseElement(el)
 
 				return buf
-
+					
 			else:
 				if tag.name == 'blockquote':
 					return f'“{tag.string}”'
@@ -175,6 +176,10 @@ class Thoughts(object):
 			local_newest = self.thoughts[0]['id']
 			if self.api.newest > local_newest:
 				_t = ThoughtApi(local_newest)
+				_t.thoughts.sort(
+					key=lambda k: k['id'],
+					reverse=True
+				)
 				self.thoughts.extend(_t.thoughts)
 		else:
 			_t = ThoughtApi()