small fixes

main
Peder Bergebakken Sundt 2022-11-20 00:37:48 +01:00
parent 9d15daf227
commit 51d821d500
4 changed files with 29 additions and 16 deletions

View File

@ -1,16 +1,21 @@
# I'm no PHONY!
STYLES := $(patsubst templates/%/render.sh,%,$(wildcard templates/*/render.sh)) STYLES := $(patsubst templates/%/render.sh,%,$(wildcard templates/*/render.sh))
help: help:
@printf "make %s\n" \ @printf "make %s\n" \
render-styles \ render-styles \
render-styles-push \
$(patsubst %,render-style-%-stdout,$(STYLES)) \ $(patsubst %,render-style-%-stdout,$(STYLES)) \
$(patsubst %,render-example-card-%-stdout,$(STYLES)) \ $(patsubst %,render-example-card-%-stdout,$(STYLES)) \
$(patsubst %,render-style-%-live,$(STYLES)) \ $(patsubst %,render-style-%-live,$(STYLES)) \
$(patsubst %,render-example-card-%-live,$(STYLES)) \ $(patsubst %,render-example-card-%-live,$(STYLES)) \
$(patsubst %,render-style-%,$(STYLES)) \ $(patsubst %,render-style-%-file,$(STYLES)) \
$(patsubst %,render-example-card-%,$(STYLES)) $(patsubst %,render-style-%-file-push,$(STYLES)) \
| sort
render-styles: $(patsubst %,render-style-%,$(STYLES)) render-styles: $(patsubst %,render-style-%-file,$(STYLES))
render-styles-push: $(patsubst %,render-style-%-file-push,$(STYLES))
render-style-%-stdout: templates/%/render.sh render-style-%-stdout: templates/%/render.sh
./"$<" | bat --language html --plain --paging never ./"$<" | bat --language html --plain --paging never
@ -24,9 +29,9 @@ render-style-%-live:
render-example-card-%-live: render-example-card-%-live:
fd --type f . templates/$* | entr make render-example-card-$*-stdout fd --type f . templates/$* | entr make render-example-card-$*-stdout
render-style-%: render-style-%-file:
make --quiet render-style-$*-stdout > pvv/styles/$*.html mkdir -p pvv/styles
make --quiet render-style-$*-stdout > pvv/styles/$*.html
render-example-card-%:
./"$<"
render-style-%-file-push: render-style-%-file
./api.py set-style $* pvv/styles/$*.html

4
api.py
View File

@ -61,8 +61,8 @@ def set_card(card_id: int, file: typer.FileText):
@app.command() @app.command()
def get_styles(): def get_styles():
# this one fails due to trailing comma # this one fails due to trailing comma
#rich.print_json(data=post("get_my_styles").json()) rich.print_json(data=post("get_my_styles").json())
rich.print(post("get_my_styles").text) #rich.print(post("get_my_styles").text)
@app.command() @app.command()
def get_style(style_id: int): def get_style(style_id: int):

View File

@ -7,7 +7,8 @@ test -e pvv && {
} }
mkdir -p pvv/{cards,styles} mkdir -p pvv/{cards,styles}
./api.py get-styles | hjson -c | jq '.[].id' --raw-output | #./api.py get-styles | hjson -c | jq '.[].id' --raw-output |
./api.py get-styles | jq '.[].id' --raw-output |
while read style_id; do while read style_id; do
(set -x (set -x
./api.py get-style $style_id > pvv/styles/$style_id.html ./api.py get-style $style_id > pvv/styles/$style_id.html

View File

@ -2,12 +2,19 @@ with import <nixpkgs> {};
pkgs.mkShell { pkgs.mkShell {
packages = with pkgs; [ packages = with pkgs; [
jq jq
hjson # to deal with broken json gron
sd
#hjson # to deal with broken json
j2cli j2cli
sass sass
libxslt libxslt
python3Packages.rich nim
python3Packages.httpx ] ++ (with python3Packages; [
python3Packages.typer libxml2
]; rich
httpx
typer
# dev-only
python-lsp-server
]);
} }