From 38fe7a57408888804b6e45f68986b8a2f20e05f7 Mon Sep 17 00:00:00 2001 From: Ozbolt Menegatti Date: Tue, 14 Jan 2020 00:03:42 +0100 Subject: [PATCH] Moving xml to outer file and now html simple and xml direct from Cyprian Also, cleaned makefile, less magic strings --- build/Makefile | 41 +++++++++++++------- res/main.html | 67 +------------------------------- res/vsms1.xml | 103 +++++++++++++++++++++++++++++++++++++++++++++++++ src/local.js | 7 ++++ 4 files changed, 138 insertions(+), 80 deletions(-) create mode 100644 res/vsms1.xml create mode 100644 src/local.js diff --git a/build/Makefile b/build/Makefile index 548b4cc..97ad517 100644 --- a/build/Makefile +++ b/build/Makefile @@ -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) $@ + +$(XML_FILE): $(RES_XML_FILE) + cp $(RES_XML_FILE) $@ + +copy: $(XML_FILE) $(HTML_FILE) clean: rm -fr $(TS_BUILD) - rm -f bundle.js index.html main.css - - + rm -f $(HTML_FILE) $(XML_FILE) bundle.js index.html main.css diff --git a/res/main.html b/res/main.html index e0be51f..1461589 100644 --- a/res/main.html +++ b/res/main.html @@ -7,71 +7,8 @@
+ - + diff --git a/res/vsms1.xml b/res/vsms1.xml new file mode 100644 index 0000000..a5cea63 --- /dev/null +++ b/res/vsms1.xml @@ -0,0 +1,103 @@ + + + + + AE + + bolnišnica + + bolníšnica + xyz + abc + + + + + bolnišnica + + + + samostalnik + feminine + + + + 151686 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + object + an object for living + + + + + + + + hiša + + + + dom + + + + + + Kupili smo hišo. + + + + + Blah blah blah 1. + + + + + si + ogledati + hiša + + + blah blah2 + + + + Ogledali smo si hišo. + + Blah blah blah 3. + + + + + + + + + diff --git a/src/local.js b/src/local.js new file mode 100644 index 0000000..30eeca0 --- /dev/null +++ b/src/local.js @@ -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);