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 enable_creation_date: true
markdown_extensions: markdown_extensions:
- def_list
- pymdownx.highlight: - pymdownx.highlight:
anchor_linenums: true anchor_linenums: true
- pymdownx.inlinehilite - pymdownx.inlinehilite
- pymdownx.snippets - pymdownx.snippets
- pymdownx.superfences - 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) themes=$(yartsu --list-themes | tail -n +5 | cut -d' ' -f 3)
newline() {
echo >>"$THEME_MD"
}
mkdir -p ./docs/themes mkdir -p ./docs/themes
rm -f ./docs/themes/* rm -f ./docs/themes/*
rm -f $THEME_MD rm -f $THEME_MD
yartsu -o docs/themes/list.svg -- yartsu --list-themes
echo '<div id="top"></div>' >>$THEME_MD cat >>"$THEME_MD" <<EOF
newline # Themes
echo "# Themes" >>$THEME_MD
newline
printf "Available themes:\n\n" >>$THEME_MD <p align='center'>
<img src="/yartsu/themes/list.svg" width="50%">
</p>
for theme in $themes; do See below for example outputs of each.
echo "- [$theme](#${theme//_//})" >>$THEME_MD EOF
done
newline
for theme in $themes; do for theme in $themes; do
url="docs/themes/${theme}.svg" url="docs/themes/${theme}.svg"
cat >>"$THEME_MD" <<EOF cat >>"$THEME_MD" <<EOF
## $theme === "$theme"
![$theme](./themes/${theme}.svg) ![$theme](./themes/${theme}.svg)
<p align="right">(<a href="#top">back to top</a>)</p>
EOF EOF
yartsu --theme "$theme" -o "$url" --demo -t "yartsu --theme ${theme} --demo" yartsu --theme "$theme" -o "$url" --demo -t "yartsu --theme ${theme} --demo"
done done

View file

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