zim-wiki team mailing list archive
-
zim-wiki team
-
Mailing list archive
-
Message #02796
feedback of idea
Hi All,
Feedback wanted of an idea.
I love to put all files that belongs to an idea into the attachment
folder of the wiki-tree. Most of the time this works fine, but sometimes
files get indexed that shouldn't f.x. source-files of a programming project.
One solution is to put a ".zimconfig" into each folder that havn't the
default setting. This can be if spell check language is different from
default, or you don't want to scan a directory into the wiki.
Attacted is one example of how not-to-scan-directory can be. When
".zimconfig" exists in the attachment folder, the folder is not scanned.
".zimconfig" can be more specific of configuration, i.e. "ignoredir" or
"language="", in later implementations.
The attached example does not delete pages which are in the database. It
only doesn't scan new ones. To test first delete the database in
".zim/index.db"
Is it a feature we want?
Best regards,
Patrik
--
PGP-key fingerprint: 1B30 7F61 AF9E 538A FCD6 2BE7 CED7 B0E4 3BF9 8D6C
=== modified file 'zim/index.py'
--- zim/index.py 2014-01-04 16:43:23 +0000
+++ zim/index.py 2014-06-04 14:01:49 +0000
@@ -85,6 +85,7 @@
from __future__ import with_statement
+import os
import sqlite3
import gobject
import unicodedata
@@ -643,6 +644,7 @@
indexpath._row['childrenkey'] = None
self._flush_queue(path)
+
self._update_pagelist_queue.append(indexpath)
if not indexpath.isroot:
self._index_page_queue.append(indexpath)
@@ -714,11 +716,27 @@
try:
if self._update_pagelist_queue:
path = self._update_pagelist_queue.pop(0)
- with self.db_commit:
- self._update_pagelist(path)
+
+ rawpath = ""
+ if not path.isroot:
+ rawpath = self.notebook.get_attachments_dir(path)
+
+ scan = True
+ if rawpath != "" :
+ attachmentconfig = str ( rawpath + os.path.sep + ".zimconfig" )
+# print "1: %s, %s" % (rawpath, attachmentconfig )
+
+ if os.path.isfile ( attachmentconfig ):
+ print "2: %s, %s" % (rawpath, attachmentconfig )
+ scan = False
+
+ if scan :
+ with self.db_commit:
+ self._update_pagelist(path)
elif self._index_page_queue:
path = self._index_page_queue.pop(0)
page = self.notebook.get_page(path)
+# print "2: %s, %s" % (path.name, page)
with self.db_commit:
self._index_page(path, page)
except KeyboardInterrupt:
Follow ups