#!/bin/bash # Replace the language picker site-wide, using a common source file: # "lang-picker-source". The script is called from the root of enc-live. # It doesn't take an argument. set -e set -o pipefail head=$(mktemp -t rt.XXXXXX) || exit 1 picker=$(mktemp -t rt.XXXXXX) || exit 1 tail=$(mktemp -t rt.XXXXXX) || exit 1 trap 'rm -f "$head" "$picker" "$tail"' EXIT # List all HTML files with a language picker and take them one by one. # The regex will select index and workshops. find . -regex "\./.*/[iw][no][dr].*\.html" -not -path "./missing/*" | sort | sed 's,^\./,,' | while read f; do # Extract the language from the file name. lang=${f%%/*} # Make sure the page is correctly formatted. if grep -q '