fix issue where every pronoun set was regarded as unknown & provide link to repository
This commit is contained in:
parent
df9e6cd41c
commit
83741f0cd1
|
@ -32,3 +32,5 @@ copy it into your gemini directory and make it executable of course
|
|||
* 2022-05-31: export pronouns to csv file; add one new sentence
|
||||
* 2022-05-31: make it shown when a pronoun is preferred that is unknown, also some more comments
|
||||
* 2022-07-30: provide a back link
|
||||
* 2022-09-18: fix issue where every pronoun set was regarded as unknown
|
||||
* 2022-09-18: provide link to repository
|
||||
|
|
24
index.gmi
24
index.gmi
|
@ -1,17 +1,20 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
_link="https://tildegit.org/konomo/gem-pd"
|
||||
readonly _link
|
||||
|
||||
if [[ -z "$QUERY_STRING" ]]; then
|
||||
printf "10 Please enter your name. You may add ; and your preferred pronoun\r\n"
|
||||
fi
|
||||
name=$QUERY_STRING
|
||||
pronouns=""
|
||||
pronoun=""
|
||||
setnumber=999
|
||||
|
||||
if [[ "${name}" == *"%3B"* ]]; then
|
||||
pronouns="${name#*%3B}"
|
||||
pronoun="${name#*%3B}"
|
||||
name=$(echo -n "${name}" | sed 's/%3B.*//')
|
||||
elif [[ "${name}" == *";"* ]]; then # This shouldn't happen, but I have seen it with Xenia on Android
|
||||
pronouns="${name#*;}"
|
||||
pronoun="${name#*;}"
|
||||
name=$(echo -n "${name}" | sed 's/;.*//')
|
||||
fi
|
||||
|
||||
|
@ -29,20 +32,21 @@ pr_ref=( $(tail -n +2 pronouns.csv | cut -d ',' -f5) )
|
|||
|
||||
cnt=0
|
||||
|
||||
if [[ "${pronouns}" != "" ]]; then
|
||||
if [[ "${pronoun}" != "" ]]; then
|
||||
# looks through the loaded pronouns to see if the preferred pronoun
|
||||
# that was (optionally) entered is available.
|
||||
for i in "${pr_sub[@]}"; do
|
||||
if [[ "${i}" == "${pronouns}" ]]; then
|
||||
if [[ "${i}" == "${pronoun}" ]]; then
|
||||
setnumber=$cnt
|
||||
fi
|
||||
((cnt++))
|
||||
done
|
||||
# write the used pronoun if one is specified
|
||||
if [[ "${setnumber}" != "${cnt}" ]]; then
|
||||
printf " (unknown pronoun)\n"
|
||||
# if the pronoun entered is known,
|
||||
# then say so
|
||||
if [[ "${pr_sub[@]}" =~ "${pronoun}" ]]; then
|
||||
printf " (%s)\n" "${pronoun}"
|
||||
else
|
||||
printf " (%s)\n" "$pronouns"
|
||||
printf " (unknown pronoun)\n"
|
||||
fi
|
||||
else
|
||||
printf "\n"
|
||||
|
@ -86,6 +90,8 @@ for i in "${pr_sub[@]}"; do
|
|||
((cnt++))
|
||||
done
|
||||
|
||||
printf "=> ${_link} Check out the source code\n"
|
||||
|
||||
ownname=$(basename "$0")
|
||||
if [[ "${ownname}" == "index.gmi" ]]; then # if script is in its own dir
|
||||
printf "=> ../index.gmi Back" # then go to parent dir
|
||||
|
|
Loading…
Reference in New Issue