Moving xml to outer file and now html simple and xml direct from Cyprian

Also, cleaned makefile, less magic strings
pull/1/head
Ozbolt Menegatti 4 years ago
parent b2d1441e9a
commit 38fe7a5740

@ -4,39 +4,50 @@ RES_FOLDER=$(CURDIR)/../res
TS_BUILD=tsbuild
TS_FLAGS=-da -n -m -od ../build/$(TS_BUILD) # has to be relative for some reason
BR_FLAGS=-p esmify --debug
BR_FLAGS=-p esmify -t brfs --debug
LESS_FLAGS=--include-path=../node_modules/picnic
LESS_FILE=$(RES_FOLDER)/main.less
PY_FILE=$(SRC_FOLDER)/main.py
HTML_FILE=$(RES_FOLDER)/main.html
CSS_FILE=main.css
LESS_FILE=main.less
PY_FILE=main.py
HTML_FILE=main.html
XML_FILE=vsms1.xml
.PHONY: all transcrypt $(LESS_FILE) $(PY_FILE) $(HTML_FILE)
RES_LESS_FILE=$(RES_FOLDER)/$(LESS_FILE)
RES_PY_FILE=$(SRC_FOLDER)/$(PY_FILE)
RES_HTML_FILE=$(RES_FOLDER)/$(HTML_FILE)
RES_XML_FILE=$(RES_FOLDER)/$(XML_FILE)
# mypy:
# mypy src/main.py
.PHONY: all transcrypt copy $(RES_LESS_FILE) $(RES_PY_FILE) $(RES_HTML_FILE) $(RES_XML_FILE)
all: main.css bundle.js index.html
transcrypt: $(PY_FILE) $(TS_BUILD)
all: copy $(CSS_FILE) bundle.js local.js
transcrypt: $(RES_PY_FILE) $(TS_BUILD)
transcrypt $(TS_FLAGS) $<
bundle.js: transcrypt
cd ..; browserify $(BR_FLAGS) build/$(TS_BUILD)/main.js -o build/bundle.js
main.css: $(LESS_FILE)
local.js:
browserify $(BR_FLAGS) ../src/local.js -o ./local.js
$(CSS_FILE): $(RES_LESS_FILE)
lessc $(LESS_FLAGS) $< > $@
$(TS_BUILD):
mkdir -p $(TS_BUILD)
index.html: $(HTML_FILE)
cp $(RES_FOLDER)/main.html $@
$(HTML_FILE): $(RES_HTML_FILE)
cp $(RES_HTML_FILE) $@
clean:
rm -fr $(TS_BUILD)
rm -f bundle.js index.html main.css
$(XML_FILE): $(RES_XML_FILE)
cp $(RES_XML_FILE) $@
copy: $(XML_FILE) $(HTML_FILE)
clean:
rm -fr $(TS_BUILD)
rm -f $(HTML_FILE) $(XML_FILE) bundle.js index.html main.css

@ -7,71 +7,8 @@
</head>
<body>
<div id="app"></div>
<script src="https://code.jquery.com/jquery-3.4.1.js"></script>
<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>
<labelList>
<label type="podrocje">biologija</label>
</labelList>
</translationContainer>
<translationContainer cluster="1">
<translation></translation>
<explanation>expl2</explanation>
</translationContainer>
<translationContainer cluster="2">
<translation source="SrC">preskus</translation>
</translationContainer>
<translationContainer cluster="2">
<translation>sdfsd</translation>
<labelList>
<label type="podrocje">ozboltologija</label>
</labelList>
</translationContainer>
<translationContainer cluster="3">
<translation>fsd</translation>
</translationContainer>
</translationContainerList>
<exampleContainerList>
<exampleContainer>
<example>The test was interesting.</example>
<translationContainer>
<translation>Preizkus je bil zanimiv.</translation>
<translation>Drugi prevod.</translation>
</translationContainer>
</exampleContainer>
</exampleContainerList>
</sense>
</senseList>
</body>
</entry>`};
plugin_init(div, entry, editable);
plugin_render(div, entry);
</script>
<script src="local.js"></script>
</body>
</html>

@ -0,0 +1,103 @@
<?xml version="1.0" encoding="UTF-8"?>
<dictionary>
<entry>
<head>
<status>AE</status>
<headword>
<lemma audio="audio-3132">bolnišnica</lemma>
<homonymy>
<homonymyFeature name="pronunciation">bolníšnica</homonymyFeature>
<homonymyFeature name="blahblah">xyz</homonymyFeature>
<homonymyFeature name="bluhbluh">abc</homonymyFeature>
</homonymy>
</headword>
<lexicalUnit id="34242" type="single">
<lexeme lexical_unit_lexeme_id="535342">bolnišnica</lexeme>
</lexicalUnit>
<grammar>
<category>samostalnik</category>
<grammarFeature name="gender">feminine</grammarFeature>
</grammar>
<measureList>
<measure type="frequency" source="Gigafida 1.0">151686</measure>
</measureList>
<variantList>
<variant lexical_unit_id="12345"></variant>
</variantList>
<relatedEntryList>
<relatedEntry lexical_unit_id="56788"></relatedEntry>
<relatedEntry lexical_unit_id="56789"></relatedEntry>
</relatedEntryList>
<labelList>
<label type="sometype">value3</label>
</labelList>
<comment></comment>
</head>
<body>
<senseList>
<sense id="834324">
<labelList>
<label type="number">plural</label>
<label type="domain">Construction</label>
</labelList>
<definitionList>
<definition type="indicator">object</definition>
<definition type="general">an object for living</definition>
</definitionList>
<translationContainerList>
<translationContainer cluster="1">
<labelList>
<label type="type3">value7</label>
</labelList>
<translation targetLang="hun" source="source1">hiša</translation>
<explanation/>
</translationContainer>
<translationContainer cluster="1">
<translation targetLang="hun">dom</translation>
</translationContainer>
</translationContainerList>
<exampleContainerList>
<exampleContainer>
<corpusExample example_id="4343" modified="true" audio="audio-465346">Kupili smo <comp role="headword">hišo</comp>.</corpusExample>
<translationContainer>
<labelList>
<label type="type5">value8</label>
</labelList>
<translation targetLang="hun">Blah blah blah 1.</translation>
</translationContainer>
</exampleContainer>
<exampleContainer>
<multiwordExample lexical_unit_id="19" type="collocation" audio="audio-56643">
<comp role="collocate">si</comp>
<comp role="collocate" sloleks="LE_blahblah">ogledati</comp>
<comp role="headword">hiša</comp>
</multiwordExample>
<translationContainer>
<translation targetLang="hun" source="source2" audio="audio-blah-77242">blah blah2</translation>
</translationContainer>
</exampleContainer>
<exampleContainer>
<corpusExample example_id="552439" modified="false" lexical_unit_id="19"><comp role="collocate">Ogledali</comp> smo <comp role="collocate">si</comp> <comp role="headword">hišo</comp>.</corpusExample>
<translationContainer>
<translation targetLang="hun" source="source2">Blah blah blah 3.</translation>
</translationContainer>
</exampleContainer>
</exampleContainerList>
</sense>
</senseList>
</body>
</entry>
</dictionary>

@ -0,0 +1,7 @@
var fs = require('fs');
var div = document.getElementById("app");
var editable = true;
var entry = {"content": fs.readFileSync('vsms1.xml', 'utf8')};
plugin_init(div, entry, editable);
plugin_render(div, entry);
Loading…
Cancel
Save