# HG changeset patch # User Oleksandr Gavenko # Date 1474487841 -10800 # Node ID 5709d5bd349b2db9ed9d25ccd3218b081dce6c75 # Parent 4b610eaaf4be27eb84a7c898685070b37da4eba3 Fix: reverse card missed glossary. Translation list may be None after adding glossary syntax. diff -r 4b610eaaf4be -r 5709d5bd349b py/gadict.py --- a/py/gadict.py Wed Sep 21 22:46:28 2016 +0300 +++ b/py/gadict.py Wed Sep 21 22:57:21 2016 +0300 @@ -50,8 +50,6 @@ raise ParseException("Part of speech expected...\n") self.pos = pos self.tr_list = tr_list - if not tr_list: - self.tr_list = [] self.ex_list = ex_list self.glos_list = glos_list self.ant_list = ant_list @@ -60,7 +58,10 @@ self.topic_list = topic_list def add_tr(self, tr): - self.tr_list.append(tr) + if self.tr_list: + self.tr_list.append(tr) + else: + self.tr_list = [tr] def add_ex(self, ex): if self.ex_list: diff -r 4b610eaaf4be -r 5709d5bd349b py/gadict_c5.py --- a/py/gadict_c5.py Wed Sep 21 22:46:28 2016 +0300 +++ b/py/gadict_c5.py Wed Sep 21 22:57:21 2016 +0300 @@ -110,7 +110,7 @@ FOUT.write("; ".join(["{"+s+"}" for s in sense.rel_list])) if not LANGS or len(LANGS) != 1: FOUT.write("\n") - for (lang, tr) in sense.tr_list: + for (lang, tr) in sense.ex_list or []: if LANGS and not (lang in LANGS): continue FOUT.write(" ") diff -r 4b610eaaf4be -r 5709d5bd349b py/gadict_srs_anki.py --- a/py/gadict_srs_anki.py Wed Sep 21 22:46:28 2016 +0300 +++ b/py/gadict_srs_anki.py Wed Sep 21 22:57:21 2016 +0300 @@ -113,8 +113,11 @@ font-style: italic; font-size: .85em; } +div.glos .lang { + color: brown; +} span.glos { - font-size: .85em; + font-size: .95em; } """ @@ -208,7 +211,7 @@ buf.append(" syn: ") buf.append("; ".join(sense.syn_list)) buf.append("") - for (lang, tr) in sense.tr_list: + for (lang, tr) in sense.tr_list or []: if len(sense.tr_list) > 1: buf.append("
") buf.append(" ") @@ -264,7 +267,7 @@ buf.append(" rel: ") buf.append("; ".join(sense.rel_list)) buf.append("") - for (lang, tr) in sense.tr_list: + for (lang, tr) in sense.tr_list or []: if len(sense.tr_list) > 1: buf.append("
") buf.append(" ") @@ -275,6 +278,15 @@ buf.append("") if len(sense.tr_list) > 1: buf.append("
") + for (lang, tr) in sense.glos_list or []: + buf.append("
") + buf.append(" ") + buf.append(lang) + buf.append("") + buf.append(" ") + buf.append(tr) + buf.append("") + buf.append("
") reverse_from = "".join(buf) # without examples!! builder.add_note("en->tr", identity, direct_from, direct_to) builder.add_note("tr->en", identity, reverse_from, direct_from)