diff --git a/ankiqt/ui/cardlist.py b/ankiqt/ui/cardlist.py index 5f8c34392..55ba824c1 100644 --- a/ankiqt/ui/cardlist.py +++ b/ankiqt/ui/cardlist.py @@ -88,17 +88,24 @@ class DeckModel(QAbstractTableModel): # not cached yet self.updateCard(index) s = self.columns[index.column()][1](index) + s = self.limitContent(s) s = s.replace("
", u" ") s = s.replace("
", u" ") - s = s.replace("\n", u" ") - s = stripHTML(s) + s = s.replace("\n", u" ") s = re.sub("\[sound:[^]]+\]", "", s) - s = s.replace("&", "&") + s = stripHTML(s) s = s.strip() return QVariant(s) else: return QVariant() + def limitContent(self, txt): + if "" in txt: + matches = re.findall("(?s)(.*?)", txt) + return " ".join(matches) + else: + return txt + def headerData(self, section, orientation, role): if orientation == Qt.Vertical: return QVariant()