Add script to enable/disable links to translations.
authorDavid Thompson <davet@gnu.org>
Fri, 27 Jun 2014 19:24:10 +0000 (15:24 -0400)
committerDavid Thompson <davet@gnu.org>
Fri, 27 Jun 2014 19:24:10 +0000 (15:24 -0400)
toggle-lang [new file with mode: 0755]

diff --git a/toggle-lang b/toggle-lang
new file mode 100755 (executable)
index 0000000..c59452d
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/bash
+# Really quick hacky script to comment/uncomment links to translations
+# of the GPG guide.
+
+enc_mode=$1
+enc_lang=$2
+
+if [ $enc_mode = 'enable' ]
+then
+    # Regex to match <li> tag with language link
+    enc_regex="<!--\(<li><a.*href=\"\/${enc_lang}\".*<\/li>\)-->"
+    # Uncomment it
+    sed -i "s/$enc_regex/\1/" **/*.html
+elif [ $enc_mode = 'disable' ]
+then
+    # Regex to match <li> tag with language link
+    enc_regex="\(<li><a.*href=\"\/${enc_lang}\".*<\/li>\)"
+    # Comment it out
+    sed -i "s/$enc_regex/<!--\1-->/" **/*.html
+else
+    echo 'Usage: toggle-lang enable|disable <lang>'
+fi