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
10
anki/deck.py
10
anki/deck.py
|
|
@ -1134,7 +1134,8 @@ facts.modelId = :id""", id=model.id)
|
|||
else:
|
||||
mod = ""
|
||||
# tags
|
||||
tags = dict(self.tagsList(priority="", where="and cards.id in %s" %
|
||||
tags = dict(self.shortTagsList(
|
||||
where="and cards.id in %s" %
|
||||
ids2str([x[0] for x in ids])))
|
||||
facts = {}
|
||||
# fields
|
||||
|
|
@ -1180,6 +1181,13 @@ cardModels.name %s from cards, facts, models, cardModels where
|
|||
cards.factId == facts.id and facts.modelId == models.id
|
||||
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):
|
||||
"Return a hash listing tags in model, fact and cards."
|
||||
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>' % (
|
||||
hexifyID(v[0]), v[1])
|
||||
fields['tags'] = canonifyTags(tags)
|
||||
fields['Tags'] = fields['tags']
|
||||
# render q & a
|
||||
ret = []
|
||||
for (type, format) in (("question", cm.qformat),
|
||||
|
|
|
|||
Loading…
Reference in a new issue