orgmode: also index text before the first heading. Add mimeview config

This commit is contained in:
Jean-Francois Dockes
2022-04-06 19:29:23 +02:00
parent 6643f48a7f
commit ad2db6cd1c
2 changed files with 10 additions and 3 deletions
+6 -2
View File
@@ -13,7 +13,8 @@ class OrgModeExtractor:
self.file = ""
self.contents = []
self.em = em
self.selftext = ""
def extractone(self, index):
if index >= len(self.docs):
return(False, "", "", True)
@@ -44,6 +45,9 @@ class OrgModeExtractor:
res = rb'''^\* '''
self.docs = re.compile(res, flags=re.MULTILINE).split(data)
# Note that there can be text before the first heading. This goes into the self doc,
# because it's not a proper entry.
self.selftext = self.docs[0]
self.docs = self.docs[1:]
#self.em.rclog("openfile: Entry count: %d" % len(self.docs))
return True
@@ -68,7 +72,7 @@ class OrgModeExtractor:
eof = rclexecm.RclExecM.eofnext
else:
eof = rclexecm.RclExecM.noteof
return (True, "", "", eof)
return (True, self.selftext, "", eof)
if self.currentindex >= len(self.docs):
self.em.rclog("getnext: EOF hit")