yartsu/scripts/theme-showcase-gen

38 lines
708 B
Text
Raw Normal View History

2022-06-14 18:35:47 -05:00
#!/usr/bin/env bash
THEME_MD="./docs/themes.md"
2023-05-11 07:29:55 -05:00
themes=$(yartsu --list-themes | tail -n +5 | cut -d' ' -f 3)
2022-06-14 18:35:47 -05:00
2022-06-15 13:06:30 -05:00
newline() {
echo >>"$THEME_MD"
}
2023-05-14 13:58:06 -05:00
mkdir -p ./docs/themes
rm -f ./docs/themes/*
2022-06-14 18:35:47 -05:00
rm -f $THEME_MD
2022-06-15 13:06:30 -05:00
echo '<div id="top"></div>' >>$THEME_MD
newline
2022-06-14 18:35:47 -05:00
echo "# Themes" >>$THEME_MD
2022-06-15 13:06:30 -05:00
newline
2023-05-14 13:58:06 -05:00
printf "Available themes:\n\n" >>$THEME_MD
2022-06-15 13:06:30 -05:00
for theme in $themes; do
2023-05-14 13:58:06 -05:00
echo "- [$theme](#${theme//_//})" >>$THEME_MD
2022-06-15 13:06:30 -05:00
done
2023-05-14 13:58:06 -05:00
newline
2022-06-15 13:06:30 -05:00
2022-06-14 18:35:47 -05:00
for theme in $themes; do
2023-05-14 13:58:06 -05:00
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"
2022-06-14 18:35:47 -05:00
done
echo "finished."