2021-12-30 00:49:43 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-12-30 23:52:53 +00:00
|
|
|
if [[ "$1" == "ts" ]]; then
|
2021-12-30 02:45:29 +00:00
|
|
|
for f in $2/*.ts; do
|
|
|
|
# FIXME: inline html
|
|
|
|
for l in $(grep -n "~neutral\|~positive\|~urge\|~warning\|~info\|~critical" $f | sed -e 's/:.*//g'); do
|
|
|
|
# for l in $(sed -n '/classList/=' $f); do
|
|
|
|
line=$(sed -n "${l}p" $f)
|
|
|
|
echo $line | grep "classList" &> /dev/null
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo $line | sed 's/.*classList//; s/).*//' | grep "~neutral\|~positive\|~urge\|~warning\|~info\|~critical" &> /dev/null
|
|
|
|
if [ $? -eq 0 ]; then
|
2021-12-31 00:22:28 +00:00
|
|
|
# echo "found classList @ " $l
|
2021-12-30 02:45:29 +00:00
|
|
|
for color in neutral positive urge warning info critical; do
|
|
|
|
sed -i "${l},${l}s/\"~${color}\"/\"~${color}\", \"dark:~d_${color}\"/g" $f
|
|
|
|
done
|
|
|
|
else
|
|
|
|
echo "FIX: classList found, but color tag wasn't in it"
|
|
|
|
fi
|
|
|
|
else
|
2021-12-31 00:22:28 +00:00
|
|
|
# echo "found inline in " $f " @ " $l ", " $(sed -n "${l}p" $f)
|
2021-12-30 02:59:44 +00:00
|
|
|
for color in neutral positive urge warning info critical; do
|
|
|
|
sed -i "${l},${l}s/~${color}/~${color} dark:~d_${color}/g" $f
|
|
|
|
done
|
2021-12-30 02:45:29 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
|
|
|
fi
|