From 61ab1f5dfd57464d30e2f0442d599a201848af2f Mon Sep 17 00:00:00 2001 From: Houssam Salem Date: Sat, 15 Feb 2014 23:04:59 +1100 Subject: [PATCH] Remove marked/leech tags when exporting without sched data (#986) --- anki/exporting.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/anki/exporting.py b/anki/exporting.py index cc12e3d5a..47288a1ce 100644 --- a/anki/exporting.py +++ b/anki/exporting.py @@ -134,8 +134,14 @@ class AnkiExporter(Exporter): data) # notes strnids = ids2str(nids.keys()) - notedata = self.src.db.all("select * from notes where id in "+ - strnids) + notedata = [] + for row in self.src.db.all( + "select * from notes where id in "+strnids): + # remove system tags if not exporting scheduling info + if not self.includeSched: + row = list(row) + row[5] = self.removeSystemTags(row[5]) + notedata.append(row) self.dst.db.executemany( "insert into notes values (?,?,?,?,?,?,?,?,?,?,?)", notedata) @@ -206,6 +212,11 @@ class AnkiExporter(Exporter): # overwrite to apply customizations to the deck before it's closed, # such as update the deck description pass + + def removeSystemTags(self, tags): + tags = ' '.join(tag for tag in tags.split() + if (tag.lower() != "marked" and tag.lower() != "leech")) + return tags # Packaged Anki decks ######################################################################