Add topic to dictd and Anki.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Sat, 19 Nov 2016 09:45:33 +0200
changeset 686 a9e3b6050544
parent 685 9ecc349062a1
child 687 a8d65f6de091
Add topic to dictd and Anki.
py/gadict_c5.py
py/gadict_srs_anki.py
--- a/py/gadict_c5.py	Fri Nov 18 23:53:31 2016 +0200
+++ b/py/gadict_c5.py	Sat Nov 19 09:45:33 2016 +0200
@@ -135,6 +135,11 @@
             FOUT.write(sense.pos)
             FOUT.write("» ")
             need_sep = False
+            if sense.topic_list and len(sense.topic_list) > 0:
+                FOUT.write("⌊")
+                FOUT.write(", ".join(["{"+s+"}" for s in sense.topic_list]))
+                FOUT.write("⌉")
+                need_sep = True
             if sense.ant_list and len(sense.ant_list) > 0:
                 FOUT.write(" ant: ")
                 FOUT.write("; ".join(["{"+s+"}" for s in sense.ant_list]))
--- a/py/gadict_srs_anki.py	Fri Nov 18 23:53:31 2016 +0200
+++ b/py/gadict_srs_anki.py	Sat Nov 19 09:45:33 2016 +0200
@@ -380,6 +380,11 @@
         buf.append(sense.pos)
         buf.append("</span>")
     have_ref = False
+    if sense.topic_list and len(sense.topic_list) > 0:
+        have_ref = True
+        buf.append(u" <span class='topic'>⌊")
+        buf.append(u", ".join(sense.topic_list))
+        buf.append(u"⌉</span>")
     if sense.ant_list and len(sense.ant_list) > 0:
         have_ref = True
         buf.append(" <span class='ant'>ant: ")