Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
janky but works, and should report if theres a situation its not ready to handle.
- Loading branch information
Showing
3 changed files
with
42 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,4 +18,5 @@ instructions-debian.txt | |
cl.md | ||
./telegram/ | ||
mautrix/ | ||
tempts/ | ||
matacc.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,32 @@ | ||
#!/bin/bash | ||
|
||
for f in $1/*.html; do | ||
for color in neutral positive urge warning info critical; do | ||
sed -i "s/~${color}/~${color} dark:~d_${color}/g" $f | ||
if [[ "$1" == "html" ]]; then | ||
for f in $2/*.html; do | ||
for color in neutral positive urge warning info critical; do | ||
sed -i "s/~${color}/~${color} dark:~d_${color}/g" $f | ||
done | ||
done | ||
done | ||
elif [[ "$1" == "ts" ]]; then | ||
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 | ||
echo "found classList @ " $l | ||
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 | ||
echo "found inline @ " $l ", " $(sed -n "${l}p" $f) | ||
sed -i "${l},${l}s/~${color}/~${color} dark:~d_${color}/g" $f | ||
fi | ||
done | ||
done | ||
fi |