mirror of
https://github.com/ankitects/anki.git
synced 2025-11-11 15:17:12 -05:00
add capitalized tags field, don't use cardmodelname in tags
This commit is contained in:
parent
7c630b9805
commit
6658b47661
2 changed files with 11 additions and 2 deletions
12
anki/deck.py
12
anki/deck.py
|
|
@ -1134,8 +1134,9 @@ facts.modelId = :id""", id=model.id)
|
||||||
else:
|
else:
|
||||||
mod = ""
|
mod = ""
|
||||||
# tags
|
# tags
|
||||||
tags = dict(self.tagsList(priority="", where="and cards.id in %s" %
|
tags = dict(self.shortTagsList(
|
||||||
ids2str([x[0] for x in ids])))
|
where="and cards.id in %s" %
|
||||||
|
ids2str([x[0] for x in ids])))
|
||||||
facts = {}
|
facts = {}
|
||||||
# fields
|
# fields
|
||||||
for k, g in groupby(self.s.all("""
|
for k, g in groupby(self.s.all("""
|
||||||
|
|
@ -1180,6 +1181,13 @@ cardModels.name %s from cards, facts, models, cardModels where
|
||||||
cards.factId == facts.id and facts.modelId == models.id
|
cards.factId == facts.id and facts.modelId == models.id
|
||||||
and cards.cardModelId = cardModels.id %s""" % (priority, where))
|
and cards.cardModelId = cardModels.id %s""" % (priority, where))
|
||||||
|
|
||||||
|
def shortTagsList(self, where=""):
|
||||||
|
return self.s.all("""
|
||||||
|
select cards.id, cards.tags || "," || facts.tags || "," || models.tags
|
||||||
|
from cards, facts, models where
|
||||||
|
cards.factId == facts.id and facts.modelId == models.id
|
||||||
|
%s""" % where)
|
||||||
|
|
||||||
def allTags(self):
|
def allTags(self):
|
||||||
"Return a hash listing tags in model, fact and cards."
|
"Return a hash listing tags in model, fact and cards."
|
||||||
return list(set(parseTags(",".join([x[1] for x in self.tagsList()]))))
|
return list(set(parseTags(",".join([x[1] for x in self.tagsList()]))))
|
||||||
|
|
|
||||||
|
|
@ -119,6 +119,7 @@ def formatQA(cid, mid, fact, tags, cm):
|
||||||
fields[k] = '<span class="fm%s">%s</span>' % (
|
fields[k] = '<span class="fm%s">%s</span>' % (
|
||||||
hexifyID(v[0]), v[1])
|
hexifyID(v[0]), v[1])
|
||||||
fields['tags'] = canonifyTags(tags)
|
fields['tags'] = canonifyTags(tags)
|
||||||
|
fields['Tags'] = fields['tags']
|
||||||
# render q & a
|
# render q & a
|
||||||
ret = []
|
ret = []
|
||||||
for (type, format) in (("question", cm.qformat),
|
for (type, format) in (("question", cm.qformat),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue