From 0619cc9f8ec95611c3011a1db52969fab89da3a2 Mon Sep 17 00:00:00 2001
From: Frank Steinberg <steinberg@ibr.cs.tu-bs.de>
Date: Sat, 12 Oct 2019 15:54:53 +0200
Subject: [PATCH] Cleanup. Formatting fix.

---
 web/save.cgi                       |  4 ++++
 xsl/bjcp-2015-styleguide-apply.xsl | 12 ------------
 2 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/web/save.cgi b/web/save.cgi
index 61dc160..e91fa6f 100755
--- a/web/save.cgi
+++ b/web/save.cgi
@@ -135,6 +135,10 @@ if os.path.isfile(translatedfilename) or os.path.isfile(origfilename):
     cmd = "xsltproc xsl/bjcp-2015-styleguide-apply.xsl %s" % (snippetfilename)
     docmd(cmd)
 
+    log("reformatting %s/%s.xml" % (LANG, id))
+    cmd = 'xmllint --format %s/%s.xml | sed -e \'s/ standalone="yes"//\' > cache/tmp.xml ; cmp -s cache/tmp.xml %s/%s.xml ; if [ $? -ne 0 ] ; then cat cache/tmp.xml > %s/%s.xml ; fi ; rm cache/tmp.xml' % (LANG, id, LANG, id, LANG, id)
+    docmd(cmd)
+
     if doadd:
         log("adding new file %s/%s.xml to local repository" % (LANG, id))
         cmd = 'git add %s/%s.xml' % (LANG, id)
diff --git a/xsl/bjcp-2015-styleguide-apply.xsl b/xsl/bjcp-2015-styleguide-apply.xsl
index fb9f7fb..e7598c3 100644
--- a/xsl/bjcp-2015-styleguide-apply.xsl
+++ b/xsl/bjcp-2015-styleguide-apply.xsl
@@ -36,17 +36,11 @@
 
   <xsl:variable name="snippetnode" select="/bjcp:styleguide//bjcp:*[@id = $snippetid]"/>
 
-<!--
-  <xsl:variable name="origroot" select="document('../bjcp-2015-styleguide-orig.xml')/bjcp:styleguide"/>
--->
   <xsl:variable name="origroot" select="document(concat('../orig/',$snippetid,'.xml'))/bjcp:styleguide"/>
 
   <xsl:variable name="orignode" select="$origroot//bjcp:*[@id = $snippetid]"/>
 
   <xsl:variable name="targetfilename">
-    <!--
-    <xsl:text>../</xsl:text>
-    -->
     <xsl:value-of select="$lang"/>
     <xsl:text>/</xsl:text>
     <xsl:value-of select="$snippetid"/>
@@ -116,12 +110,6 @@
 
 
   <xsl:template match="bjcp:name|bjcp:description|bjcp:overall-impression|bjcp:aroma|bjcp:appearance|bjcp:flavor|bjcp:mouthfeel|bjcp:comments|bjcp:history|bjcp:characteristic-ingredients|bjcp:style-comparison|bjcp:entry-instructions|bjcp:commercial-examples" mode="merge">
-<!--
-    <xsl:text>MERGING </xsl:text>
-    <xsl:value-of select="local-name(.)"/>
-    <xsl:text> MERGING
- </xsl:text>
--->
     <xsl:variable name="name">
       <xsl:value-of select="local-name(.)"/>
     </xsl:variable>
-- 
GitLab