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))
help:
@printf "make %s\n" \
render-styles \
render-styles-push \
$(patsubst %,render-style-%-stdout,$(STYLES)) \
$(patsubst %,render-example-card-%-stdout,$(STYLES)) \
$(patsubst %,render-style-%-live,$(STYLES)) \
$(patsubst %,render-example-card-%-live,$(STYLES)) \
$(patsubst %,render-style-%,$(STYLES)) \
$(patsubst %,render-example-card-%,$(STYLES))
$(patsubst %,render-style-%-file,$(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
./"$<" | bat --language html --plain --paging never
@ -24,9 +29,9 @@ render-style-%-live:
render-example-card-%-live:
fd --type f . templates/$* | entr make render-example-card-$*-stdout
render-style-%:
make --quiet render-style-$*-stdout > pvv/styles/$*.html
render-example-card-%:
./"$<"
render-style-%-file:
mkdir -p pvv/styles
make --quiet render-style-$*-stdout > pvv/styles/$*.html
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()
def get_styles():
# this one fails due to trailing comma
#rich.print_json(data=post("get_my_styles").json())
rich.print(post("get_my_styles").text)
rich.print_json(data=post("get_my_styles").json())
#rich.print(post("get_my_styles").text)
@app.command()
def get_style(style_id: int):

View File

@ -7,7 +7,8 @@ test -e pvv && {
}
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
(set -x
./api.py get-style $style_id > pvv/styles/$style_id.html

View File

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