Simplify code.
--- a/py/gadict_srs_anki.py Thu Sep 15 20:13:18 2016 +0300
+++ b/py/gadict_srs_anki.py Fri Sep 16 00:44:40 2016 +0300
@@ -198,24 +198,17 @@
buf.append("<span class='syn'>syn: ")
buf.append("; ".join(["{"+s+"}" for s in sense.syn_list]))
buf.append("</span>")
- if len(sense.tr_list) > 1:
- for (lang, tr) in sense.tr_list:
+ for (lang, tr) in sense.tr_list:
+ if len(sense.tr_list) > 1:
buf.append("<div class='sense'>")
- buf.append(" <span class='lang'>")
- buf.append(lang)
- buf.append("</span>")
- buf.append(" <span class='tr'>")
- buf.append(tr)
- buf.append("</span>")
+ buf.append(" <span class='lang'>")
+ buf.append(lang)
+ buf.append("</span>")
+ buf.append(" <span class='tr'>")
+ buf.append(tr)
+ buf.append("</span>")
+ if len(sense.tr_list) > 1:
buf.append("</div>")
- else:
- for (lang, tr) in sense.tr_list:
- buf.append(" <span class='lang'>")
- buf.append(lang)
- buf.append("</span>")
- buf.append(" <span class='tr'>")
- buf.append(tr)
- buf.append("</span>")
direct_to = "".join(buf)
builder.add_note("en->tr", identity, direct_from, direct_to)
builder.add_note("tr->en", identity, direct_to, direct_from)