Browse Source

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

tags/stw2018
Max Mehl 8 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:
image: vsasyan/xmllint
commands:
- find . -type f \( -iname "*.xhtml" -o -iname "*.xml" -o -iname "*.xsl" \) -exec xmllint --noout {} +
- bash tools/check-non-en-frontpage.sh news

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

@@ -0,0 +1,22 @@
#/bin/bash

# checks whether there non-EN items appear on the FSFE front-page, which is undesired

DIR=$1

# select all items which have the front-page tag
exit=0
for f in $( grep -R "<tag.*>front-page</tag>" --files-with-matches ${DIR}/2*/*.{xhtml,xml} )
do
base="${f%.*}" # file.xx
base="${base%.*}" # file
sfx=${f##*.} # xhtml
en="$base.en.$sfx" # file.en.xhtml
if [[ ! -f "$en" ]]
then
echo "$f" # echo file if it's not existent in an English version
exit=1
fi
done

exit $exit

+ 0
- 18
tools/find_news_without_en_translation.sh View File

@@ -1,18 +0,0 @@
#/bin/bash
ROOT=$(dirname "$(readlink -f "$0")")
source "$ROOT"/config.cfg
LOC_trunk=$(echo $LOC_trunk | sed 's|/$||')

cd ${LOC_trunk}/news
for f in $( grep -R front-page --files-with-matches 2*/*.{xhtml,xml} )
do
base="${f%.*}"
base="${base%.*}"
sfx=${f##*.}
en="$base.en.$sfx"
if [[ ! -f "$en" ]]
then
echo "$f"
fi
done


Loading…
Cancel
Save