Fixing stuff for lexonomy, works for now
This commit is contained in:
parent
be573d38a5
commit
88824ee273
|
@ -1,12 +1,75 @@
|
||||||
<meta charset="utf-8"/>
|
<meta charset="utf-8"/>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>PYVsms</title>
|
<title>PYVsms</title>
|
||||||
<link rel="stylesheet" href="main.css" />
|
<link rel="stylesheet" href="main.css" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
<script src="bundle.js"></script>
|
<script src="bundle.js"></script>
|
||||||
</body>
|
<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>
|
</html>
|
||||||
|
|
|
@ -11,6 +11,9 @@ class Proxy:
|
||||||
else:
|
else:
|
||||||
return self.proxied[attr]
|
return self.proxied[attr]
|
||||||
|
|
||||||
|
def __setattr__(self, attr, value):
|
||||||
|
self.proxied[attr] = value
|
||||||
|
|
||||||
|
|
||||||
_document = Proxy(document)
|
_document = Proxy(document)
|
||||||
_window = Proxy(window)
|
_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 model import Model
|
||||||
from view import View
|
from view import View
|
||||||
from update import update
|
from update import update
|
||||||
import modals
|
from export import export_to_xml
|
||||||
|
|
||||||
|
|
||||||
model = Model()
|
model = Model()
|
||||||
|
|
||||||
|
|
||||||
def main(xml_str):
|
def plugin_init(div, _entry, editable):
|
||||||
model.import_xml(xml_str)
|
view = View(div)
|
||||||
update.set_view(View(document.getElementById("app")))
|
|
||||||
update.set_model(model)
|
update.set_model(model)
|
||||||
|
update.set_view(view)
|
||||||
|
|
||||||
|
|
||||||
|
def plugin_render(_div, entry):
|
||||||
|
model.import_xml(entry.content)
|
||||||
update.update_model()
|
update.update_model()
|
||||||
|
|
||||||
|
|
||||||
main("""<entry>
|
def plugin_save(_div):
|
||||||
<head>
|
return export_to_xml(model)
|
||||||
<status>A</status>
|
|
||||||
<headword>
|
|
||||||
<lemma>adolescenca</lemma>
|
# export!
|
||||||
</headword>
|
window.plugin_init = plugin_init
|
||||||
<grammar>
|
window.plugin_render = plugin_render
|
||||||
<category>samostalnik</category>
|
window.plugin_save = plugin_save
|
||||||
</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>""")
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user