fix(#4): demo takes precedence

This commit is contained in:
Daylin Morgan 2023-05-14 17:56:03 -05:00
parent a14608d21c
commit c888fa53f9
Signed by: daylin
GPG key ID: C1E52E7DD81DF79F
4 changed files with 23 additions and 77 deletions

View file

@ -1,55 +0,0 @@
<div id="top"></div>
# Themes
Available themes:
- [cat-mocha](#cat-mocha)
- [cat-macchiato](#cat-macchiato)
- [cat-frappe](#cat-frappe)
- [cat-latte](#cat-latte)
- [dracula](#dracula)
- [gruvbox-dark](#gruvbox-dark)
- [gruvbox-light](#gruvbox-light)
- [nord](#nord)
- [dimmed_monokai](#dimmed/monokai)
- [monokai](#monokai)
- [night-owlish](#night-owlish)
- [rich-default](#rich-default)
## cat-mocha
![cat-mocha](./themes/cat-mocha.svg)
<p align="right">(<a href="#top">back to top</a>)</p>
## cat-macchiato
![cat-macchiato](./themes/cat-macchiato.svg)
<p align="right">(<a href="#top">back to top</a>)</p>
## cat-frappe
![cat-frappe](./themes/cat-frappe.svg)
<p align="right">(<a href="#top">back to top</a>)</p>
## cat-latte
![cat-latte](./themes/cat-latte.svg)
<p align="right">(<a href="#top">back to top</a>)</p>
## dracula
![dracula](./themes/dracula.svg)
<p align="right">(<a href="#top">back to top</a>)</p>
## gruvbox-dark
![gruvbox-dark](./themes/gruvbox-dark.svg)
<p align="right">(<a href="#top">back to top</a>)</p>
## gruvbox-light
![gruvbox-light](./themes/gruvbox-light.svg)
<p align="right">(<a href="#top">back to top</a>)</p>
## nord
![nord](./themes/nord.svg)
<p align="right">(<a href="#top">back to top</a>)</p>
## dimmed_monokai
![dimmed_monokai](./themes/dimmed_monokai.svg)
<p align="right">(<a href="#top">back to top</a>)</p>
## monokai
![monokai](./themes/monokai.svg)
<p align="right">(<a href="#top">back to top</a>)</p>
## night-owlish
![night-owlish](./themes/night-owlish.svg)
<p align="right">(<a href="#top">back to top</a>)</p>
## rich-default
![rich-default](./themes/rich-default.svg)
<p align="right">(<a href="#top">back to top</a>)</p>

View file

@ -31,9 +31,10 @@ plugins:
enable_creation_date: true
markdown_extensions:
- def_list
- pymdownx.highlight:
anchor_linenums: true
- pymdownx.inlinehilite
- pymdownx.snippets
- pymdownx.superfences
- pymdownx.tabbed:
alternate_style: true

View file

@ -4,32 +4,26 @@ 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
yartsu -o docs/themes/list.svg -- yartsu --list-themes
echo '<div id="top"></div>' >>$THEME_MD
newline
echo "# Themes" >>$THEME_MD
newline
cat >>"$THEME_MD" <<EOF
# Themes
printf "Available themes:\n\n" >>$THEME_MD
<p align='center'>
<img src="/yartsu/themes/list.svg" width="50%">
</p>
for theme in $themes; do
echo "- [$theme](#${theme//_//})" >>$THEME_MD
done
newline
See below for example outputs of each.
EOF
for theme in $themes; do
url="docs/themes/${theme}.svg"
cat >>"$THEME_MD" <<EOF
## $theme
=== "$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

View file

@ -106,13 +106,19 @@ def main() -> None:
else:
cmd = None
if args.input:
parsed_input = Text.from_ansi(args.input.read())
elif args.demo:
console = Console(file=io.StringIO(), record=True, force_terminal=True)
if args.demo:
console = Console(
file=io.StringIO(),
record=True,
force_terminal=True,
color_system="truecolor",
legacy_windows=False,
)
parsed_input = make_test_card() # type: ignore
elif args.input:
parsed_input = Text.from_ansi(args.input.read())
title = args.title or cmd or "yartsu"
if args.width: