changeset 63:afe5cd7626dc

Some more work, this may break things a bit.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 01 Jun 2021 14:00:39 +0300
parents 1932f588743f
children 66d585e862b6
files lxmldump.py
diffstat 1 files changed, 23 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/lxmldump.py	Tue Jun 01 13:42:35 2021 +0300
+++ b/lxmldump.py	Tue Jun 01 14:00:39 2021 +0300
@@ -48,15 +48,15 @@
     },
 
     "word_item": {
-        PKK_MODE_NORMAL: "\"{word}\"{search}\n{attr}{hyphenation}{main_sense}{other_senses}\n",
+        PKK_MODE_NORMAL: "{word}{search}{attr}{hyphenation}:{main_sense}{other_senses}\n",
         PKK_MODE_ANKI: "\"{word}\"{search}{attr}{hyphenation};{main_sense}{other_senses}\n",
     },
     "word_attr_list": {
-        PKK_MODE_NORMAL: "{indent}attr \"({alist})\"\n",
+        PKK_MODE_NORMAL: " ({alist})",
         PKK_MODE_ANKI: " ({alist})",
     },
     "word_attr_list_empty": {
-        PKK_MODE_NORMAL: " ",
+        PKK_MODE_NORMAL: "",
         PKK_MODE_ANKI: "",
     },
     "word_attr_list_item": {
@@ -68,7 +68,7 @@
     },
 
     "hyphenation": {
-        PKK_MODE_NORMAL: "{indent}hyph \"{text}\"\n",
+        PKK_MODE_NORMAL: " [hyph: {text}]",
         PKK_MODE_ANKI: " [hyph: {text}]",
     },
     "no_hyphenation": {
@@ -77,14 +77,15 @@
 
 
     "search_list": {
-        PKK_MODE_NORMAL: ", {alist}\n",
+        PKK_MODE_NORMAL: ", {alist}",
         PKK_MODE_ANKI: ", {alist}",
     },
     "search_list_empty": {
         PKK_MODE_NORMAL: "",
     },
     "search_list_item": {
-        PKK_MODE_NORMAL: "\"{text}\"",
+        PKK_MODE_NORMAL: "{text}",
+        PKK_MODE_ANKI: "\"{text}\"",
     },
     "search_list_sep": {
         PKK_MODE_NORMAL: ", ",
@@ -92,6 +93,7 @@
 
     "main_sense_item": {
         PKK_MODE_NORMAL: "{definition}{example_list}",
+        PKK_MODE_ANKI: "{definition}{example_list}",
     },
     "sense_list": {
         PKK_MODE_NORMAL: "{alist}",
@@ -101,25 +103,31 @@
         PKK_MODE_NORMAL: "",
     },
     "sense_list_item": {
-        PKK_MODE_NORMAL: "{indent}sense #{index}:\n{definition}{example_list}",
+        PKK_MODE_NORMAL: "#{index}:{definition}{example_list}",
         PKK_MODE_ANKI: "#{index}:{definition}{example_list}",
     },
     "sense_list_sep": {
-        PKK_MODE_NORMAL: "",
+        PKK_MODE_NORMAL: " | ",
         PKK_MODE_ANKI: " | ",
     },
 
     "definition_item": {
-        PKK_MODE_NORMAL: "{indent}defn \"{text}\"\n",
+        PKK_MODE_NORMAL: " {text}",
         PKK_MODE_ANKI: " ? \"{text}\"",
     },
 
-    "example_item": {
-        PKK_MODE_NORMAL: "{indent}exmp \"{text}\"{geo_list}\n",
+    "example_list": {
+        PKK_MODE_NORMAL: " | {alist}",
+    },
+    "example_list_empty": {
+        PKK_MODE_NORMAL: "",
+    },
+    "example_list_item": {
+        PKK_MODE_NORMAL: "\"{text}\"{geo_list}",
         PKK_MODE_ANKI: " * \"{text}\"{geo_list}",
     },
-    "example_item_sep": {
-        PKK_MODE_NORMAL: "",
+    "example_list_sep": {
+        PKK_MODE_NORMAL: " ; ",
         PKK_MODE_ANKI: "",
     },
 
@@ -371,7 +379,7 @@
                 tclass=qnode.attrib["class"],
                 indent=pkk_geti(indent + 2)))
 
-        exlist.append(pkk_get_fmt("example_item").format(
+        exlist.append(pkk_get_fmt("example_list_item").format(
             text=pkk_node_to_text(wnode.find("./Example")),
             geo_list=pkk_get_list_str(indent + 1, geolist, "example_geo", False),
             indent=pkk_geti(indent + 1),
@@ -380,7 +388,7 @@
 
     return pkk_get_fmt(dname).format(
         definition=pkk_get_subs(indent, dnode, "./Definition", "definition_item"),
-        example_list=pkk_get_fmt("example_item_sep").join(exlist),
+        example_list=pkk_get_list_str(indent, exlist, "example", False),
         indent=pkk_geti(indent),
         index=dindex)