yartsu/scripts/theme-showcase-gen

37 lines
708 B
Bash
Executable file

#!/usr/bin/env bash
THEME_MD="./docs/themes.md"
themes=$(yartsu --list-themes | tail -n +5 | cut -d' ' -f 3)
newline() {
echo >>"$THEME_MD"
}
mkdir -p ./docs/themes
rm -f ./docs/themes/*
rm -f $THEME_MD
echo '<div id="top"></div>' >>$THEME_MD
newline
echo "# Themes" >>$THEME_MD
newline
printf "Available themes:\n\n" >>$THEME_MD
for theme in $themes; do
echo "- [$theme](#${theme//_//})" >>$THEME_MD
done
newline
for theme in $themes; do
url="docs/themes/${theme}.svg"
cat >>"$THEME_MD" <<EOF
## $theme
![$theme](./themes/${theme}.svg)
<p align="right">(<a href="#top">back to top</a>)</p>
EOF
yartsu --theme "$theme" -o "$url" --demo -t "yartsu --theme ${theme} --demo"
done
echo "finished."