Browse Source

slightly rewrite Thomas' script and add to drone's syntax check

tags/stw2018
Max Mehl 6 months ago
parent
commit
8f9f61eb3b
Signed by: max.mehl <max.mehl@fsfe.org> GPG Key ID: 2704E4AB371E2E92
3 changed files with 23 additions and 18 deletions
  1. 1
    0
      .drone.yml
  2. 22
    0
      tools/check-non-en-frontpage.sh
  3. 0
    18
      tools/find_news_without_en_translation.sh

+ 1
- 0
.drone.yml View File

@@ -3,3 +3,4 @@ pipeline:
3 3
     image: vsasyan/xmllint
4 4
     commands:
5 5
         - find . -type f \( -iname "*.xhtml" -o -iname "*.xml" -o -iname "*.xsl" \) -exec xmllint --noout {} +
6
+        - bash tools/check-non-en-frontpage.sh news

+ 22
- 0
tools/check-non-en-frontpage.sh View File

@@ -0,0 +1,22 @@
1
+#/bin/bash
2
+
3
+# checks whether there non-EN items appear on the FSFE front-page, which is undesired
4
+
5
+DIR=$1
6
+
7
+# select all items which have the front-page tag
8
+exit=0
9
+for f in $( grep -R "<tag.*>front-page</tag>" --files-with-matches ${DIR}/2*/*.{xhtml,xml} )
10
+do
11
+	base="${f%.*}"      # file.xx
12
+	base="${base%.*}"   # file
13
+	sfx=${f##*.}        # xhtml
14
+	en="$base.en.$sfx"  # file.en.xhtml
15
+	if [[ ! -f "$en" ]]
16
+	then
17
+		echo "$f"         # echo file if it's not existent in an English version
18
+    exit=1
19
+	fi
20
+done
21
+
22
+exit $exit

+ 0
- 18
tools/find_news_without_en_translation.sh View File

@@ -1,18 +0,0 @@
1
-#/bin/bash
2
-ROOT=$(dirname "$(readlink -f "$0")")
3
-source "$ROOT"/config.cfg
4
-LOC_trunk=$(echo $LOC_trunk | sed 's|/$||')
5
-
6
-cd ${LOC_trunk}/news
7
-for f in $( grep -R front-page --files-with-matches 2*/*.{xhtml,xml} )
8
-do
9
-	base="${f%.*}"
10
-	base="${base%.*}"
11
-	sfx=${f##*.}
12
-	en="$base.en.$sfx"
13
-	if [[ ! -f "$en" ]]
14
-	then
15
-		echo "$f"
16
-	fi
17
-done
18
-

Loading…
Cancel
Save