fix(ci): keep docs directory around

This commit is contained in:
Daylin Morgan 2023-05-14 18:01:50 -05:00
parent c888fa53f9
commit ce8ea8c173
Signed by: daylin
GPG key ID: C1E52E7DD81DF79F
22 changed files with 8647 additions and 32 deletions

3
.gitignore vendored
View file

@ -156,9 +156,6 @@ cython_debug/
#.idea/
# End of https://www.toptal.com/developers/gitignore/api/python
docs/themes/*.svg
docs/rich-diff.md
docs/index.md
capture.svg

View file

@ -1,12 +1,6 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 23.3.0
hooks:

View file

@ -35,9 +35,7 @@ install-bin: build/x86_64-unknown-linux-gnu/release/install/yartsu/yartsu ## ins
$(call msg,Installing yartsu to ~/bin)
@cp ./build/x86_64-unknown-linux-gnu/release/install/yartsu/yartsu ~/bin
DOCS_RECIPES := $(patsubst %,docs-%,theme diff)
.PHONY: $(DOCS_RECIPES)
docs: docs/index.md $(DOCS_RECIPES) ## generate docs/svg
docs: docs/index.md docs/rich-diff.md ## generate docs/svg
@mkdocs build
docs/index.md: README.md
@ -46,8 +44,8 @@ docs/index.md: README.md
docs-theme:
@./scripts/theme-showcase-gen
docs-diff:
@./scripts/rich-diff > docs/rich-diff.md
docs/rich-diff.md:
@./scripts/rich-diff > $@
docs-logos:
@lolcat -F .5 -S 9 -f assets/logo.txt | yartsu -o assets/logo.svg

0
docs/.gitkeep Normal file
View file

77
docs/rich-diff.md Normal file
View file

@ -0,0 +1,77 @@
# Deviation From Rich
## Versions
- Rich: 13.3.5
- Yartsu: 23.5.1b2.dev30+gf5ae41d
## CONSOLE_SVG_FORMAT Diff
```diff
---
+++
@@ -1,5 +1,5 @@
-<svg class="rich-terminal" viewBox="0 0 {width} {height}" xmlns="http://www.w3.org/2000/svg">
- <!-- Generated with Rich https://www.textualize.io -->
+<svg class="rich-terminal shadow" viewBox="0 0 {width} {height}" xmlns="http://www.w3.org/2000/svg">
+ <!-- Generated with Rich https://www.textualize.io & yartsu https://github.com/daylinmorgan/yartsu -->
<style>
@font-face {{
@@ -32,6 +32,10 @@
font-family: arial;
}}
+ .shadow {{
+ -webkit-filter: drop-shadow( 2px 5px 2px rgba(0, 0, 0, .7));
+ filter: drop-shadow( 2px 5px 2px rgba(0, 0, 0, .7));
+ }}
{styles}
</style>
@@ -43,7 +47,7 @@
</defs>
{chrome}
- <g transform="translate({terminal_x}, {terminal_y})" clip-path="url(#{unique_id}-clip-terminal)">
+ <g transform="translate({terminal_x}, {terminal_y}) scale(.95)" clip-path="url(#{unique_id}-clip-terminal)">
{backgrounds}
<g class="{unique_id}-matrix">
{matrix}
```
## Console.export_svg Diff
```diff
---
+++
@@ -70,9 +70,9 @@
line_height = char_height * 1.22
margin_top = 1
- margin_right = 1
- margin_bottom = 1
- margin_left = 1
+ margin_right = char_width * 5 / 6
+ margin_bottom = 20 * 5 / 3
+ margin_left = char_width * 5 / 6
padding_top = 40
padding_right = 8
@@ -222,8 +222,8 @@
x=terminal_width // 2,
y=margin_top + char_height + 6,
)
- chrome += f"""
- <g transform="translate(26,22)">
+ chrome += """
+ <g transform="translate(32,22)">
<circle cx="0" cy="0" r="7" fill="#ff5f57"/>
<circle cx="22" cy="0" r="7" fill="#febc2e"/>
<circle cx="44" cy="0" r="7" fill="#28c840"/>
```
AUTO-GENERATED by scripts/rich-diff

31
docs/themes.md Normal file
View file

@ -0,0 +1,31 @@
# Themes
<p align='center'>
<img src="/yartsu/themes/list.svg" width="50%">
</p>
See below for example outputs of each.
=== "cat-mocha"
![cat-mocha](./themes/cat-mocha.svg)
=== "cat-macchiato"
![cat-macchiato](./themes/cat-macchiato.svg)
=== "cat-frappe"
![cat-frappe](./themes/cat-frappe.svg)
=== "cat-latte"
![cat-latte](./themes/cat-latte.svg)
=== "dracula"
![dracula](./themes/dracula.svg)
=== "gruvbox-dark"
![gruvbox-dark](./themes/gruvbox-dark.svg)
=== "gruvbox-light"
![gruvbox-light](./themes/gruvbox-light.svg)
=== "nord"
![nord](./themes/nord.svg)
=== "dimmed_monokai"
![dimmed_monokai](./themes/dimmed_monokai.svg)
=== "monokai"
![monokai](./themes/monokai.svg)
=== "night-owlish"
![night-owlish](./themes/night-owlish.svg)
=== "rich-default"
![rich-default](./themes/rich-default.svg)

700
docs/themes/cat-frappe.svg vendored Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 170 KiB

700
docs/themes/cat-latte.svg vendored Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 170 KiB

700
docs/themes/cat-macchiato.svg vendored Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 170 KiB

700
docs/themes/cat-mocha.svg vendored Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 170 KiB

700
docs/themes/dimmed_monokai.svg vendored Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 170 KiB

699
docs/themes/dracula.svg vendored Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 168 KiB

700
docs/themes/gruvbox-dark.svg vendored Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 168 KiB

700
docs/themes/gruvbox-light.svg vendored Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 170 KiB

128
docs/themes/list.svg vendored Normal file
View file

@ -0,0 +1,128 @@
<svg class="rich-terminal shadow" viewBox="0 0 524.3333333333334 497.13333333333327" xmlns="http://www.w3.org/2000/svg">
<!-- Generated with Rich https://www.textualize.io & yartsu https://github.com/daylinmorgan/yartsu -->
<style>
@font-face {
font-family: "Fira Code";
src: local("FiraCode-Regular"),
url("https://cdnjs.cloudflare.com/ajax/libs/firacode/6.2.0/woff2/FiraCode-Regular.woff2") format("woff2"),
url("https://cdnjs.cloudflare.com/ajax/libs/firacode/6.2.0/woff/FiraCode-Regular.woff") format("woff");
font-style: normal;
font-weight: 400;
}
@font-face {
font-family: "Fira Code";
src: local("FiraCode-Bold"),
url("https://cdnjs.cloudflare.com/ajax/libs/firacode/6.2.0/woff2/FiraCode-Bold.woff2") format("woff2"),
url("https://cdnjs.cloudflare.com/ajax/libs/firacode/6.2.0/woff/FiraCode-Bold.woff") format("woff");
font-style: bold;
font-weight: 700;
}
.terminal-4149855771-matrix {
font-family: Fira Code, monospace;
font-size: 20px;
line-height: 24.4px;
font-variant-east-asian: full-width;
}
.terminal-4149855771-title {
font-size: 18px;
font-weight: bold;
font-family: arial;
}
.shadow {
-webkit-filter: drop-shadow( 2px 5px 2px rgba(0, 0, 0, .7));
filter: drop-shadow( 2px 5px 2px rgba(0, 0, 0, .7));
}
.terminal-4149855771-r1 { fill: #c6d0f5;font-style: italic; }
.terminal-4149855771-r2 { fill: #c6d0f5 }
.terminal-4149855771-r3 { fill: #c6d0f5;font-weight: bold }
</style>
<defs>
<clipPath id="terminal-4149855771-clip-terminal">
<rect x="0" y="0" width="487.0" height="413.79999999999995" />
</clipPath>
<clipPath id="terminal-4149855771-line-0">
<rect x="0" y="1.5" width="488" height="24.65"/>
</clipPath>
<clipPath id="terminal-4149855771-line-1">
<rect x="0" y="25.9" width="488" height="24.65"/>
</clipPath>
<clipPath id="terminal-4149855771-line-2">
<rect x="0" y="50.3" width="488" height="24.65"/>
</clipPath>
<clipPath id="terminal-4149855771-line-3">
<rect x="0" y="74.7" width="488" height="24.65"/>
</clipPath>
<clipPath id="terminal-4149855771-line-4">
<rect x="0" y="99.1" width="488" height="24.65"/>
</clipPath>
<clipPath id="terminal-4149855771-line-5">
<rect x="0" y="123.5" width="488" height="24.65"/>
</clipPath>
<clipPath id="terminal-4149855771-line-6">
<rect x="0" y="147.9" width="488" height="24.65"/>
</clipPath>
<clipPath id="terminal-4149855771-line-7">
<rect x="0" y="172.3" width="488" height="24.65"/>
</clipPath>
<clipPath id="terminal-4149855771-line-8">
<rect x="0" y="196.7" width="488" height="24.65"/>
</clipPath>
<clipPath id="terminal-4149855771-line-9">
<rect x="0" y="221.1" width="488" height="24.65"/>
</clipPath>
<clipPath id="terminal-4149855771-line-10">
<rect x="0" y="245.5" width="488" height="24.65"/>
</clipPath>
<clipPath id="terminal-4149855771-line-11">
<rect x="0" y="269.9" width="488" height="24.65"/>
</clipPath>
<clipPath id="terminal-4149855771-line-12">
<rect x="0" y="294.3" width="488" height="24.65"/>
</clipPath>
<clipPath id="terminal-4149855771-line-13">
<rect x="0" y="318.7" width="488" height="24.65"/>
</clipPath>
<clipPath id="terminal-4149855771-line-14">
<rect x="0" y="343.1" width="488" height="24.65"/>
</clipPath>
<clipPath id="terminal-4149855771-line-15">
<rect x="0" y="367.5" width="488" height="24.65"/>
</clipPath>
</defs>
<rect fill="#1e1e2e" stroke="rgba(255,255,255,0.35)" stroke-width="1" x="10.1667" y="1" width="504" height="462.8" rx="8"/><text class="terminal-4149855771-title" fill="#c6d0f5" text-anchor="middle" x="252" y="27">yartsu&#160;--list-themes</text>
<g transform="translate(32,22)">
<circle cx="0" cy="0" r="7" fill="#ff5f57"/>
<circle cx="22" cy="0" r="7" fill="#febc2e"/>
<circle cx="44" cy="0" r="7" fill="#28c840"/>
</g>
<g transform="translate(18.166666666666664, 41) scale(.95)" clip-path="url(#terminal-4149855771-clip-terminal)">
<g class="terminal-4149855771-matrix">
<text class="terminal-4149855771-r1" x="0" y="20" textLength="329.4" clip-path="url(#terminal-4149855771-line-0)">&#160;&#160;&#160;&#160;&#160;Available&#160;Themes&#160;&#160;&#160;&#160;&#160;&#160;</text><text class="terminal-4149855771-r2" x="488" y="20" textLength="12.2" clip-path="url(#terminal-4149855771-line-0)">
</text><text class="terminal-4149855771-r2" x="0" y="44.4" textLength="329.4" clip-path="url(#terminal-4149855771-line-1)">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</text><text class="terminal-4149855771-r2" x="488" y="44.4" textLength="12.2" clip-path="url(#terminal-4149855771-line-1)">
</text><text class="terminal-4149855771-r3" x="24.4" y="68.8" textLength="170.8" clip-path="url(#terminal-4149855771-line-2)">name&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</text><text class="terminal-4149855771-r2" x="207.4" y="68.8" textLength="12.2" clip-path="url(#terminal-4149855771-line-2)"></text><text class="terminal-4149855771-r3" x="231.8" y="68.8" textLength="73.2" clip-path="url(#terminal-4149855771-line-2)">source</text><text class="terminal-4149855771-r2" x="488" y="68.8" textLength="12.2" clip-path="url(#terminal-4149855771-line-2)">
</text><text class="terminal-4149855771-r2" x="0" y="93.2" textLength="329.4" clip-path="url(#terminal-4149855771-line-3)">╶────────────────┼────────╴</text><text class="terminal-4149855771-r2" x="488" y="93.2" textLength="12.2" clip-path="url(#terminal-4149855771-line-3)">
</text><text class="terminal-4149855771-r2" x="0" y="117.6" textLength="329.4" clip-path="url(#terminal-4149855771-line-4)">&#160;&#160;cat-mocha&#160;&#160;&#160;&#160;&#160;&#160;&#160;yartsu&#160;&#160;</text><text class="terminal-4149855771-r2" x="488" y="117.6" textLength="12.2" clip-path="url(#terminal-4149855771-line-4)">
</text><text class="terminal-4149855771-r2" x="0" y="142" textLength="329.4" clip-path="url(#terminal-4149855771-line-5)">&#160;&#160;cat-macchiato&#160;&#160;&#160;yartsu&#160;&#160;</text><text class="terminal-4149855771-r2" x="488" y="142" textLength="12.2" clip-path="url(#terminal-4149855771-line-5)">
</text><text class="terminal-4149855771-r2" x="0" y="166.4" textLength="329.4" clip-path="url(#terminal-4149855771-line-6)">&#160;&#160;cat-frappe&#160;&#160;&#160;&#160;&#160;&#160;yartsu&#160;&#160;</text><text class="terminal-4149855771-r2" x="488" y="166.4" textLength="12.2" clip-path="url(#terminal-4149855771-line-6)">
</text><text class="terminal-4149855771-r2" x="0" y="190.8" textLength="329.4" clip-path="url(#terminal-4149855771-line-7)">&#160;&#160;cat-latte&#160;&#160;&#160;&#160;&#160;&#160;&#160;yartsu&#160;&#160;</text><text class="terminal-4149855771-r2" x="488" y="190.8" textLength="12.2" clip-path="url(#terminal-4149855771-line-7)">
</text><text class="terminal-4149855771-r2" x="0" y="215.2" textLength="329.4" clip-path="url(#terminal-4149855771-line-8)">&#160;&#160;dracula&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;yartsu&#160;&#160;</text><text class="terminal-4149855771-r2" x="488" y="215.2" textLength="12.2" clip-path="url(#terminal-4149855771-line-8)">
</text><text class="terminal-4149855771-r2" x="0" y="239.6" textLength="329.4" clip-path="url(#terminal-4149855771-line-9)">&#160;&#160;gruvbox-dark&#160;&#160;&#160;&#160;yartsu&#160;&#160;</text><text class="terminal-4149855771-r2" x="488" y="239.6" textLength="12.2" clip-path="url(#terminal-4149855771-line-9)">
</text><text class="terminal-4149855771-r2" x="0" y="264" textLength="329.4" clip-path="url(#terminal-4149855771-line-10)">&#160;&#160;gruvbox-light&#160;&#160;&#160;yartsu&#160;&#160;</text><text class="terminal-4149855771-r2" x="488" y="264" textLength="12.2" clip-path="url(#terminal-4149855771-line-10)">
</text><text class="terminal-4149855771-r2" x="0" y="288.4" textLength="329.4" clip-path="url(#terminal-4149855771-line-11)">&#160;&#160;nord&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;yartsu&#160;&#160;</text><text class="terminal-4149855771-r2" x="488" y="288.4" textLength="12.2" clip-path="url(#terminal-4149855771-line-11)">
</text><text class="terminal-4149855771-r2" x="0" y="312.8" textLength="329.4" clip-path="url(#terminal-4149855771-line-12)">&#160;&#160;dimmed_monokai&#160;&#160;rich&#160;&#160;&#160;&#160;</text><text class="terminal-4149855771-r2" x="488" y="312.8" textLength="12.2" clip-path="url(#terminal-4149855771-line-12)">
</text><text class="terminal-4149855771-r2" x="0" y="337.2" textLength="329.4" clip-path="url(#terminal-4149855771-line-13)">&#160;&#160;monokai&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;rich&#160;&#160;&#160;&#160;</text><text class="terminal-4149855771-r2" x="488" y="337.2" textLength="12.2" clip-path="url(#terminal-4149855771-line-13)">
</text><text class="terminal-4149855771-r2" x="0" y="361.6" textLength="329.4" clip-path="url(#terminal-4149855771-line-14)">&#160;&#160;night-owlish&#160;&#160;&#160;&#160;rich&#160;&#160;&#160;&#160;</text><text class="terminal-4149855771-r2" x="488" y="361.6" textLength="12.2" clip-path="url(#terminal-4149855771-line-14)">
</text><text class="terminal-4149855771-r2" x="0" y="386" textLength="329.4" clip-path="url(#terminal-4149855771-line-15)">&#160;&#160;rich-default&#160;&#160;&#160;&#160;rich&#160;&#160;&#160;&#160;</text><text class="terminal-4149855771-r2" x="488" y="386" textLength="12.2" clip-path="url(#terminal-4149855771-line-15)">
</text><text class="terminal-4149855771-r2" x="0" y="410.4" textLength="329.4" clip-path="url(#terminal-4149855771-line-16)">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</text><text class="terminal-4149855771-r2" x="488" y="410.4" textLength="12.2" clip-path="url(#terminal-4149855771-line-16)">
</text>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 10 KiB

697
docs/themes/monokai.svg vendored Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 168 KiB

696
docs/themes/night-owlish.svg vendored Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 168 KiB

700
docs/themes/nord.svg vendored Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 170 KiB

700
docs/themes/rich-default.svg vendored Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 168 KiB

View file

@ -25,12 +25,10 @@ theme:
icon: material/brightness-7
name: Switch to dark mode
plugins:
- search
- git-revision-date-localized:
enable_creation_date: true
markdown_extensions:
- def_list
- attr_list
- md_in_html
- pymdownx.highlight:
anchor_linenums: true
- pymdownx.inlinehilite

View file

@ -1,5 +1,6 @@
#!/usr/bin/env bash
set -euxo pipefail
THEME_MD="./docs/themes.md"
themes=$(yartsu --list-themes | tail -n +5 | cut -d' ' -f 3)

View file

@ -89,7 +89,17 @@ def main() -> None:
term.print(f"[ThemeError]: {args.theme} is not a valid theme", err=True)
sys.exit(1)
if args.cmd:
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.cmd:
cmd = " ".join(args.cmd)
try:
@ -103,20 +113,9 @@ def main() -> None:
sys.exit(returncode)
parsed_input = Text.from_ansi(captured_output)
else:
cmd = None
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:
cmd = None
parsed_input = Text.from_ansi(args.input.read())
title = args.title or cmd or "yartsu"