reworked json structure
Browse files
app.py
CHANGED
@@ -122,19 +122,23 @@ def handle_json_output(json_list : list) :
|
|
122 |
random_string1 = generate_random_string()
|
123 |
random_string2 = generate_random_string()
|
124 |
element = json_list[i]
|
|
|
|
|
|
|
|
|
125 |
# middle item
|
126 |
if i != n-1 :
|
127 |
element["termType"] = "basic"
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
# last item on the list
|
133 |
else:
|
134 |
element["termType"] = "cloze"
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
return json_list
|
139 |
|
140 |
|
|
|
122 |
random_string1 = generate_random_string()
|
123 |
random_string2 = generate_random_string()
|
124 |
element = json_list[i]
|
125 |
+
element["frontHTML"] = (f'<div id="element-richtextarea-{random_string1}" style="position:absolute;left:100px;top:50px;width:800px;height:300px;text-align:center;display:flex;align-items:center;font-size:40px;\">'
|
126 |
+
f'<p>{element["frontText"]}</p></div>')
|
127 |
+
element["backtHTML"] = (f'<div id="element-richtextarea-{random_string2}" style="position:absolute;left:100px;top:50px;width:800px;height:300px;text-align:center;display:flex;align-items:center;font-size:40px;\">'
|
128 |
+
f'<p>{element["backText"]}</p></div>')
|
129 |
# middle item
|
130 |
if i != n-1 :
|
131 |
element["termType"] = "basic"
|
132 |
+
# element["frontHTML"] = (f'<div id="element-richtextarea-{random_string1}" style="position:absolute;left:100px;top:50px;width:800px;height:300px;text-align:center;display:flex;align-items:center;font-size:40px;\">'
|
133 |
+
# f'<p>{element["frontText"]}</p></div>')
|
134 |
+
# element["backtHTML"] = (f'<div id="element-richtextarea-{random_string2}" style="position:absolute;left:100px;top:50px;width:800px;height:300px;text-align:center;display:flex;align-items:center;font-size:40px;\">'
|
135 |
+
# f'<p>{element["backText"]}</p></div>')
|
136 |
+
# # last item on the list
|
137 |
else:
|
138 |
element["termType"] = "cloze"
|
139 |
+
# element["frontHTML"] = (f'<div id="element-richtextarea-{random_string1}" style="position:absolute;left:100px;top:50px;width:800px;height:300px;text-align:center;display:flex;align-items:center;font-size:40px;\">'
|
140 |
+
# f'<p>{element["frontText"]}</p> <p><span class="closure" data-index="1" data-hint="">{element["backText"]}</p></div>')
|
141 |
+
# element["backText"] , element["backHTML"] = "" , ""
|
142 |
return json_list
|
143 |
|
144 |
|