From ec972309b961669dcbde491c72fcd53ad0fe93e3 Mon Sep 17 00:00:00 2001 From: Frank Steinberg <steinberg@ibr.cs.tu-bs.de> Date: Tue, 8 Oct 2019 15:23:42 +0200 Subject: [PATCH] Fixes. --- Makefile | 2 +- web/edit.js | 1 + web/save.cgi | 14 +++++++++----- xsl/bjcp-2015-styleguide-split.xsl | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index a197cc0..c398e0c 100644 --- a/Makefile +++ b/Makefile @@ -51,7 +51,7 @@ check: bjcp-2015-styleguide-orig.xml bjcp-2015-styleguide-de.xml install: bjcp-2015-styleguide-de-edit.html ssh z "if [ ! -d /var/www/bjcp-styleguide ] ; then sudo mkdir /var/www/bjcp-styleguide ; sudo chown frank.www-data /var/www/bjcp-styleguide ; sudo chmod u+rwx,g+rwxs /var/www/bjcp-styleguide ; touch /var/www/bjcp-styleguide/logfile ; mkdir /var/www/bjcp-styleguide/snippets; fi" scp bjcp-2015-styleguide-de-edit.html web/bjcp-styleguide.css web/edit.css web/edit.js web/pell.css web/pell.js web/save.cgi z:/var/www/bjcp-styleguide/ - ssh z "cd /var/www/bjcp-styleguide ; rm -rf bjcp-2015-styleguide ; git clone https://github.com/frsteinb/bjcp-2015-styleguide.git ; cd bjcp-2015-styleguide ; make" + ssh z "cd /var/www/bjcp-styleguide ; rm -rf bjcp-2015-styleguide ; git clone https://github.com/frsteinb/bjcp-2015-styleguide.git ; cd bjcp-2015-styleguide ; make bjcp-2015-styleguide-orig.xml" clean: @rm -rf orig diff --git a/web/edit.js b/web/edit.js index d81ee69..35a0e60 100644 --- a/web/edit.js +++ b/web/edit.js @@ -120,6 +120,7 @@ function dosave() { xhr.onreadystatechange = function() { if (xhr.readyState === 4) { editor.style.display = "none"; + editelem.innerHTML = x; } } diff --git a/web/save.cgi b/web/save.cgi index 90e7e4f..7c145e7 100755 --- a/web/save.cgi +++ b/web/save.cgi @@ -11,8 +11,8 @@ import datetime DIR = "/var/www/bjcp-styleguide" LOGFILE = "%s/logfile" % DIR -SNIPPETDIR = "/var/www/bjcp-styleguide/snippets" -REPODIR = "/var/www/bjcp-styleguide/bjcp-2015-styleguide" +SNIPPETDIR = "%s/snippets" % DIR +REPODIR = "%s/bjcp-2015-styleguide" % DIR LANG = "de" @@ -111,13 +111,17 @@ origfilename = "%s/orig/%s.xml" % (REPODIR, id) translatedfilename = "%s/%s/%s.xml" % (REPODIR, LANG, id) if os.path.isfile(translatedfilename): - log("creating new translation file %s/%s.xml from orig/%s.xml and snippet" % (LANG, id, id)) + log("updating translation file %s/%s.xml based on snippet" % (LANG, id)) cmd = "xsltproc --stringparam snippet %s %s/xsl/bjcp-2015-styleguide-merge.xsl %s > %s.tmp ; mv %s.tmp %s" % (snippetfilename, REPODIR, translatedfilename, translatedfilename, translatedfilename, translatedfilename) os.system(cmd) -if os.path.isfile(origfilename): - log("updating translation file %s/%s.xml based on snippet" % (LANG, id)) + cmd = "make -C %s && cp %s/bjcp-2015-styleguide-de-edit.html %s/bjcp-2015-styleguide-de-edit.html" % (REPODIR, REPODIR, DIR) + os.system(cmd) +elif os.path.isfile(origfilename): + log("creating new translation file %s/%s.xml from orig/%s.xml and snippet" % (LANG, id, id)) cmd = "xsltproc --stringparam snippet %s %s/xsl/bjcp-2015-styleguide-merge.xsl %s > %s" % (snippetfilename, REPODIR, origfilename, translatedfilename) os.system(cmd) + cmd = "make -C %s && cp %s/bjcp-2015-styleguide-de-edit.html %s/bjcp-2015-styleguide-de-edit.html" % (REPODIR, REPODIR, DIR) + os.system(cmd) else: log("neither orig file %s nor translated file %s for id %s exists" % (origfilename, translatedfilename, id)) diff --git a/xsl/bjcp-2015-styleguide-split.xsl b/xsl/bjcp-2015-styleguide-split.xsl index dc0257a..e5dbd40 100644 --- a/xsl/bjcp-2015-styleguide-split.xsl +++ b/xsl/bjcp-2015-styleguide-split.xsl @@ -109,7 +109,7 @@ <!-- suppress these tags in translations --> - <xsl:template match="tags|specs"> + <xsl:template match="bjcp:tags|bjcp:specs"> </xsl:template> -- GitLab