Add related words to Anki cards. Break line if any reference is provided.
--- a/py/gadict_srs_anki.py Thu Sep 22 21:14:42 2016 +0300
+++ b/py/gadict_srs_anki.py Fri Sep 23 23:27:35 2016 +0300
@@ -167,16 +167,24 @@
buf.append("<span class='pos'>")
buf.append(sense.pos)
buf.append("</span>")
+ have_ref = False
if sense.ant_list and len(sense.ant_list) > 0:
+ have_ref = True
buf.append(" <span class='ant'>ant: ")
buf.append("; ".join(sense.ant_list))
buf.append("</span>")
if sense.syn_list and len(sense.syn_list) > 0:
+ have_ref = True
buf.append(" <span class='syn'>syn: ")
buf.append("; ".join(sense.syn_list))
buf.append("</span>")
+ if sense.rel_list and len(sense.rel_list) > 0:
+ have_ref = True
+ buf.append(" <span class='rel'>rel: ")
+ buf.append("; ".join(sense.rel_list))
+ buf.append("</span>")
for (lang, tr) in sense.tr_list or []:
- if len(sense.tr_list) > 1:
+ if len(sense.tr_list) > 1 or have_ref:
buf.append("<div class='sense'>")
buf.append(" <span class='lang'>")
buf.append(lang)
@@ -184,7 +192,7 @@
buf.append(" <span class='tr'>")
buf.append(tr)
buf.append("</span>")
- if len(sense.tr_list) > 1:
+ if len(sense.tr_list) > 1 or have_ref:
buf.append("</div>")
for (lang, tr) in sense.glos_list or []:
buf.append("<div class='glos'>")