Fixing stuff for lexonomy, works for now
This commit is contained in:
parent
be573d38a5
commit
88824ee273
|
@ -8,5 +8,68 @@
|
|||
<body>
|
||||
<div id="app"></div>
|
||||
<script src="bundle.js"></script>
|
||||
<script>
|
||||
var div = document.getElementById("app");
|
||||
var editable = true;
|
||||
var entry = {"content": `<entry>
|
||||
<head>
|
||||
<status>A</status>
|
||||
<headword>
|
||||
<lemma>adolescenca</lemma>
|
||||
</headword>
|
||||
<grammar>
|
||||
<category>samostalnik</category>
|
||||
</grammar>
|
||||
<comment></comment>
|
||||
</head>
|
||||
<body>
|
||||
<senseList>
|
||||
<sense>
|
||||
<labelList>
|
||||
<label>tehnika</label>
|
||||
</labelList>
|
||||
<definitionList>
|
||||
<definition type="indicator">obdobje</definition>
|
||||
</definitionList>
|
||||
<translationContainerList>
|
||||
<translationContainer cluster="1">
|
||||
<translation>preizkus</translation>
|
||||
<explanation>explainme!</explanation>
|
||||
<tagsContainer>
|
||||
<tag><type>podrocje</type><value>biologija</value></tag>
|
||||
</tagsContainer>
|
||||
</translationContainer>
|
||||
<translationContainer cluster="1">
|
||||
<translation>fsd</translation>
|
||||
</translationContainer>
|
||||
<translationContainer cluster="2">
|
||||
<translation>preskus</translation>
|
||||
</translationContainer>
|
||||
<translationContainer cluster="2">
|
||||
<translation>sdfsd</translation>
|
||||
<tagsContainer>
|
||||
<tag><type>podrocje</type><value>ozboltologija</value></tag>
|
||||
</tagsContainer>
|
||||
</translationContainer>
|
||||
<translationContainer cluster="3">
|
||||
<translation>fsd</translation>
|
||||
</translationContainer>
|
||||
</translationContainerList>
|
||||
<exampleContainerList>
|
||||
<exampleContainer>
|
||||
<example>The test was interesting.</example>
|
||||
<translationContainer>
|
||||
<translation>Preizkus je bil zanimiv.</translation>
|
||||
</translationContainer>
|
||||
</exampleContainer>
|
||||
</exampleContainerList>
|
||||
</sense>
|
||||
</senseList>
|
||||
</body>
|
||||
</entry>`};
|
||||
|
||||
plugin_init(div, entry, editable);
|
||||
plugin_render(div, entry);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -11,6 +11,9 @@ class Proxy:
|
|||
else:
|
||||
return self.proxied[attr]
|
||||
|
||||
def __setattr__(self, attr, value):
|
||||
self.proxied[attr] = value
|
||||
|
||||
|
||||
_document = Proxy(document)
|
||||
_window = Proxy(window)
|
||||
|
|
78
src/main.py
78
src/main.py
|
@ -1,74 +1,30 @@
|
|||
from browser import document
|
||||
from browser import window
|
||||
from model import Model
|
||||
from view import View
|
||||
from update import update
|
||||
import modals
|
||||
from export import export_to_xml
|
||||
|
||||
|
||||
model = Model()
|
||||
|
||||
|
||||
def main(xml_str):
|
||||
model.import_xml(xml_str)
|
||||
update.set_view(View(document.getElementById("app")))
|
||||
def plugin_init(div, _entry, editable):
|
||||
view = View(div)
|
||||
update.set_model(model)
|
||||
update.set_view(view)
|
||||
|
||||
|
||||
def plugin_render(_div, entry):
|
||||
model.import_xml(entry.content)
|
||||
update.update_model()
|
||||
|
||||
|
||||
main("""<entry>
|
||||
<head>
|
||||
<status>A</status>
|
||||
<headword>
|
||||
<lemma>adolescenca</lemma>
|
||||
</headword>
|
||||
<grammar>
|
||||
<category>samostalnik</category>
|
||||
</grammar>
|
||||
<comment></comment>
|
||||
</head>
|
||||
<body>
|
||||
<senseList>
|
||||
<sense>
|
||||
<labelList>
|
||||
<label>tehnika</label>
|
||||
</labelList>
|
||||
<definitionList>
|
||||
<definition type="indicator">obdobje</definition>
|
||||
</definitionList>
|
||||
<translationContainerList>
|
||||
<translationContainer cluster="1">
|
||||
<translation>preizkus</translation>
|
||||
<explanation>explainme!</explanation>
|
||||
<tagsContainer>
|
||||
<tag><type>podrocje</type><value>biologija</value></tag>
|
||||
</tagsContainer>
|
||||
</translationContainer>
|
||||
<translationContainer cluster="1">
|
||||
<translation>fsd</translation>
|
||||
</translationContainer>
|
||||
<translationContainer cluster="2">
|
||||
<translation>preskus</translation>
|
||||
</translationContainer>
|
||||
<translationContainer cluster="2">
|
||||
<translation>sdfsd</translation>
|
||||
<tagsContainer>
|
||||
<tag><type>podrocje</type><value>ozboltologija</value></tag>
|
||||
</tagsContainer>
|
||||
</translationContainer>
|
||||
<translationContainer cluster="3">
|
||||
<translation>fsd</translation>
|
||||
</translationContainer>
|
||||
</translationContainerList>
|
||||
<exampleContainerList>
|
||||
<exampleContainer>
|
||||
<example>The test was interesting.</example>
|
||||
<translationContainer>
|
||||
<translation>Preizkus je bil zanimiv.</translation>
|
||||
</translationContainer>
|
||||
</exampleContainer>
|
||||
</exampleContainerList>
|
||||
</sense>
|
||||
</senseList>
|
||||
</body>
|
||||
</entry>""")
|
||||
def plugin_save(_div):
|
||||
return export_to_xml(model)
|
||||
|
||||
|
||||
# export!
|
||||
window.plugin_init = plugin_init
|
||||
window.plugin_render = plugin_render
|
||||
window.plugin_save = plugin_save
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user