mirror of
https://github.com/ankitects/anki.git
synced 2025-09-22 16:02:23 -04:00
limit length of clayout field summary
This commit is contained in:
parent
3014839d29
commit
6bbd6d2dd5
1 changed files with 10 additions and 2 deletions
|
@ -102,6 +102,7 @@ class CardLayout(QDialog):
|
||||||
|
|
||||||
def _fieldsOnTemplate(self, fmt):
|
def _fieldsOnTemplate(self, fmt):
|
||||||
matches = re.findall("{{[^#/}]+?}}", fmt)
|
matches = re.findall("{{[^#/}]+?}}", fmt)
|
||||||
|
charsAllowed = 30
|
||||||
result = collections.OrderedDict()
|
result = collections.OrderedDict()
|
||||||
for m in matches:
|
for m in matches:
|
||||||
# strip off mustache
|
# strip off mustache
|
||||||
|
@ -112,9 +113,16 @@ class CardLayout(QDialog):
|
||||||
if m == "FrontSide":
|
if m == "FrontSide":
|
||||||
continue
|
continue
|
||||||
|
|
||||||
result[m] = True
|
if m not in result:
|
||||||
|
result[m] = True
|
||||||
|
charsAllowed -= len(m)
|
||||||
|
if charsAllowed <= 0:
|
||||||
|
break
|
||||||
|
|
||||||
return "+".join(result.keys())
|
str = "+".join(result.keys())
|
||||||
|
if charsAllowed <= 0:
|
||||||
|
str += "+..."
|
||||||
|
return str
|
||||||
|
|
||||||
def _isCloze(self):
|
def _isCloze(self):
|
||||||
return self.model['type'] == MODEL_CLOZE
|
return self.model['type'] == MODEL_CLOZE
|
||||||
|
|
Loading…
Reference in a new issue