Browse Source

canto num edits

main
lhess2021 4 years ago
parent
commit
981bd8992c
  1. 11
      shell-scripts.d/top-level-tags.sh

11
shell-scripts.d/top-level-tags.sh

@ -10,14 +10,15 @@ echo -e "\nAdding top-level tags."
for file in *;
do
if [[ "$file" != 'top-level-tags.sh' ]]; then
CANTO_NUM="$(echo "'$file'" | tr -d -c 0-9)" # get canto number
if [[ "$file" == inferno* ]]; then
CANTO_NUM_UNSAFE="$(echo "'$file'" | tr -d -c 0-9)" # get canto number
CANTO_NUM=$((10#$CANTO_NUM_UNSAFE)) # safe for bash (no octal 0xx)
if [[ "$file" == *inferno* ]]; then
CANTICLE="Inferno"
COMM_NUM="$CANTO_NUM" # same as inferno canto number
elif [[ "$file" == purgatorio* ]]; then
elif [[ "$file" == *purgatorio* ]]; then
CANTICLE="Purgatorio"
COMM_NUM="$((CANTO_NUM + 34))" # add 34 if in purgatory
elif [[ "$file" == paradiso* ]]; then
elif [[ "$file" == *paradiso* ]]; then
CANTICLE="Paradiso"
COMM_NUM="$((CANTO_NUM + 67))" # add 68 if in paradise
else
@ -44,7 +45,5 @@ do
echo -e "\t\t</canto>" >> "$file"
echo -e "\t</text>" >> "$file"
echo -e "</TEI>" >> "$file"
# Add a `.xml` extension
mv "$file" "$file.xml"
fi
done

Loading…
Cancel
Save