| 1 | #!/bin/bash |
| 2 | # Really quick hacky script to comment/uncomment links to translations |
| 3 | # of the GPG guide. |
| 4 | |
| 5 | enc_mode=$1 |
| 6 | enc_lang=$2 |
| 7 | |
| 8 | if [ $enc_mode = 'enable' ] |
| 9 | then |
| 10 | # Regex to match <li> tag with language link |
| 11 | enc_regex="<!--\(<li><a.*href=\"\/${enc_lang}\".*<\/li>\)-->" |
| 12 | # Uncomment it |
| 13 | sed -i "s/$enc_regex/\1/" **/*.html |
| 14 | elif [ $enc_mode = 'disable' ] |
| 15 | then |
| 16 | # Regex to match <li> tag with language link |
| 17 | enc_regex="\(<li><a.*href=\"\/${enc_lang}\".*<\/li>\)" |
| 18 | # Comment it out |
| 19 | sed -i "s/$enc_regex/<!--\1-->/" **/*.html |
| 20 | else |
| 21 | echo 'Usage: toggle-lang enable|disable <lang>' |
| 22 | fi |