Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
[![site](https://github.com/h0ffmann/ptbr-writer/actions/workflows/site.yml/badge.svg)](https://github.com/h0ffmann/ptbr-writer/actions/workflows/site.yml)
[![version](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Fh0ffmann%2Fptbr-writer%2Fmain%2Fplugins%2Fptbr-writer%2F.claude-plugin%2Fplugin.json&query=%24.version&prefix=v&label=version&style=flat-square)](CHANGELOG.md)
[![license: MIT](https://img.shields.io/badge/license-MIT-1682D4?style=flat-square)](#license)
[![estimated reading time: ~20 min](https://img.shields.io/badge/reading%20time-~20%20min-1682D4?style=flat-square)](#reading-time)
[![estimated reading time: ~21 min](https://img.shields.io/badge/reading%20time-~21%20min-1682D4?style=flat-square)](#reading-time)
[![plugin: Claude Code](https://img.shields.io/badge/plugin-Claude%20Code-1682D4?style=flat-square)](#install)

</div>
Expand Down Expand Up @@ -141,7 +141,7 @@ binary ([run](https://github.com/h0ffmann/ptbr-writer/actions/runs/39537436728))

The time depends on the network. From the second run on, Nix reuses the store.

![Where the .pdf comes from: to-pdf.sh uses pandoc and xelatex if present; otherwise it downloads, through Nix, picasso (commit 4bc03e5, after v0.2.0), whose labs/ptbr-pdf compiles the to-pdf 0.1.0 crate, with pulldown-cmark 0.13.4, typst 0.15.1 and typst-as-lib 0.17.0 and 6 embedded fonts.](docs/img/pdf-dependencias.png)
![Where the .pdf comes from: to-pdf.sh uses pandoc and xelatex if present; otherwise it downloads, through Nix, picasso at the commit to-pdf.sh pins (PICASSO_REV), whose labs/ptbr-pdf compiles the to-pdf 0.1.0 crate, with pulldown-cmark 0.13.4, typst 0.15.1 and typst-as-lib 0.17.0 and 6 embedded fonts.](docs/img/pdf-dependencias.png)

<details open>
<summary>How to read this figure</summary>
Expand Down Expand Up @@ -248,7 +248,9 @@ Each figure is an Archify page, published on the site:

And the code graph of this repository, built on each site build by the `code-graph` of
[h0ffmann/picasso](https://github.com/h0ffmann/picasso) (tree-sitter, no model):
[Code graph](https://h0ffmann.github.io/ptbr-writer/grafo/graph.html).
[Code graph](https://h0ffmann.github.io/ptbr-writer/grafo/graph.html). The nodes that use picasso
lead into [picasso's graph](https://h0ffmann.github.io/ptbr-writer/grafo/picasso.html), built from the
`forks/picasso` submodule at the same commit as the other pins.

## roadmap

Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
[![site](https://github.com/h0ffmann/ptbr-writer/actions/workflows/site.yml/badge.svg)](https://github.com/h0ffmann/ptbr-writer/actions/workflows/site.yml)
[![versão](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Fh0ffmann%2Fptbr-writer%2Fmain%2Fplugins%2Fptbr-writer%2F.claude-plugin%2Fplugin.json&query=%24.version&prefix=v&label=vers%C3%A3o&style=flat-square)](CHANGELOG.md)
[![license: MIT](https://img.shields.io/badge/license-MIT-1682D4?style=flat-square)](#licença)
[![leitura estimada: ~20 min](https://img.shields.io/badge/leitura%20estimada-~20%20min-1682D4?style=flat-square)](#tempo-de-leitura)
[![leitura estimada: ~21 min](https://img.shields.io/badge/leitura%20estimada-~21%20min-1682D4?style=flat-square)](#tempo-de-leitura)
[![plugin: Claude Code](https://img.shields.io/badge/plugin-Claude%20Code-1682D4?style=flat-square)](#instalar)

</div>
Expand Down Expand Up @@ -137,7 +137,7 @@ ele, o Claude pergunta antes de baixar, pelo Nix, o

O tempo depende da rede. Da segunda vez em diante, o Nix reusa o store.

![De onde vem o .pdf: o to-pdf.sh usa pandoc e xelatex se houver; senão baixa pelo Nix o picasso (commit 4bc03e5, depois do v0.2.0), cujo labs/ptbr-pdf compila o crate to-pdf 0.1.0, com pulldown-cmark 0.13.4, typst 0.15.1 e typst-as-lib 0.17.0 e 6 fontes embutidas.](docs/img/pdf-dependencias.png)
![De onde vem o .pdf: o to-pdf.sh usa pandoc e xelatex se houver; senão baixa pelo Nix o picasso no commit que o to-pdf.sh fixa (PICASSO_REV), cujo labs/ptbr-pdf compila o crate to-pdf 0.1.0, com pulldown-cmark 0.13.4, typst 0.15.1 e typst-as-lib 0.17.0 e 6 fontes embutidas.](docs/img/pdf-dependencias.png)

<details open>
<summary>Como ler esta figura</summary>
Expand Down Expand Up @@ -244,7 +244,9 @@ Cada figura é uma página do Archify, publicada no site:

E o grafo do código deste repositório, gerado a cada build do site pelo `code-graph` do
[h0ffmann/picasso](https://github.com/h0ffmann/picasso) (tree-sitter, sem modelo):
[Grafo do código](https://h0ffmann.github.io/ptbr-writer/grafo/graph.html).
[Grafo do código](https://h0ffmann.github.io/ptbr-writer/grafo/graph.html). Os nós que usam o picasso
levam ao [grafo do picasso](https://h0ffmann.github.io/ptbr-writer/grafo/picasso.html), gerado do
submódulo `forks/picasso` no mesmo commit dos outros pins.

## roadmap

Expand Down
2 changes: 1 addition & 1 deletion docs/archify/figures.lock
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
em-um-minuto b8bc47a4ea50570f-2ab3cae
pdf-dependencias 9db6831c94ee53df-2ab3cae
pdf-dependencias c949ff7ec1fc57ad-2ab3cae
2 changes: 1 addition & 1 deletion docs/archify/pdf-dependencias.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"col": 1,
"type": "backend",
"label": "picasso (main)",
"sublabel": "commit 4bc03e5",
"sublabel": "o commit de PICASSO_REV",
"width": 150
},
{
Expand Down
Binary file modified docs/img/pdf-dependencias.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
{
devShells.site = pkgs.mkShell {
inputsFrom = [ gleam-website.devShells.${system}.default ];
packages = [ code-graph.packages.${system}.default ];
packages = [ code-graph.packages.${system}.default pkgs.jq ];
};
devShells.default = pkgs.mkShell {
packages = with pkgs; [
Expand Down
7 changes: 6 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ fmt:
just --fmt --unstable

# Build the site into site/dist/ in picasso's gleam-website toolchain: content, tests, prerender.
site: figure-init
site: figure-init picasso-init
nix develop --no-update-lock-file .#site --command just --justfile site/justfile --working-directory site ci

# Build the site and serve it on http://localhost:8000.
Expand Down Expand Up @@ -117,6 +117,11 @@ saramago-check:
done
echo "saramago-check: ok"

# The pinned picasso (forks/picasso), whose code graph the site publishes beside this repo's: once per clone.
picasso-init:
git submodule update --init forks/picasso
@echo "picasso-init: $(git -C forks/picasso rev-parse --short HEAD)"

# The pinned Archify (vendor/archify, sparse to archify/): once per clone. Not part of the plugin.
figure-init:
git submodule update --init --depth 1 vendor/archify
Expand Down
2 changes: 1 addition & 1 deletion plugins/ptbr-writer/bin/tools.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
rev=4bc03e520ff73d92cd0a11983362fa6962c9cf95
rev=45fb3409446263f259d56e4decefb23e48e9090d
lab=labs/ptbr-tools
# sha256 size path
35f848fe44dabd967998b71a60632b91651fa97573a1a7113f619bfcc3023f2a 570112 plugins/ptbr-writer/bin/linux-x86_64/ptbr
Expand Down
2 changes: 1 addition & 1 deletion plugins/ptbr-writer/scripts/to-pdf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# to-pdf.sh [--download] texto.md [saida.pdf]
set -euo pipefail

PICASSO_REV=4bc03e520ff73d92cd0a11983362fa6962c9cf95
PICASSO_REV=45fb3409446263f259d56e4decefb23e48e9090d
SIZE="~14 MiB (72 MiB on disk)" # labs/ptbr-pdf at PICASSO_REV, x86_64-linux: scripts/pdf-bench.sh
download=false
[ "${1-}" = --download ] && { download=true; shift; }
Expand Down
11 changes: 8 additions & 3 deletions site/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@ build: content
# Each docs/archify/<slug>.json as figuras/<slug>.html (Archify's `render`: node only, the page inlines its template) and its PNG.
mkdir -p dist/figuras
for src in ../docs/archify/*.json; do slug="$(basename "$src" .json)"; ARCHIFY_UPDATE_CHECK_DISABLED=1 node ../vendor/archify/archify/bin/archify.mjs render "$(node -p "require('$PWD/$src').diagram_type")" "$src" "dist/figuras/$slug.html" --quality showcase; cp "../docs/img/$slug.png" dist/figuras/; done
# The code graph of this repository (picasso's code-graph: tree-sitter, no model), one self-contained page.
code-graph extract .. --out ../build/grafo --title ptbr-writer --exclude site/dist --exclude build
# The code graphs (picasso's code-graph: tree-sitter, no model), self-contained pages: picasso at the
# pinned forks/picasso, then this repository, whose nodes that use picasso link into picasso's page.
code-graph extract ../forks/picasso --out ../build/grafo-picasso --title picasso
code-graph extract .. --out ../build/grafo --title ptbr-writer --exclude site/dist --exclude build --link picasso=../build/grafo-picasso/graph.json@picasso.html
mkdir -p dist/grafo
cp ../build/grafo/graph.html dist/grafo/
cp ../build/grafo-picasso/graph.html dist/grafo/picasso.html
# The PDFs the plugin generated (docs/eli5/RESULTS.tsv), next to the page that links them.
mkdir -p dist/eli5
tail -n +2 ../docs/eli5/RESULTS.tsv | cut -f3 | while read -r pdf; do cp "../docs/eli5/$pdf" dist/eli5/; done
Expand All @@ -33,6 +36,8 @@ ci: content
gleam test
just build
for id in instalar uso niveis regras saida smart-note limites receitas figuras eli5 awesome roadmap; do grep -q "id=\"$id\"" dist/index.html || { echo "site: no #$id in index.html" >&2; exit 1; }; done
test -s dist/grafo/graph.html || { echo "site: no grafo/graph.html" >&2; exit 1; }
test -s dist/grafo/graph.html && test -s dist/grafo/picasso.html || { echo "site: no grafo/graph.html or grafo/picasso.html" >&2; exit 1; }
# Every picasso lab this repo pins is a node of its graph that links into picasso's page.
for lab in gleam-website code-graph ptbr-pdf ptbr-tools; do jq -e --arg l "$lab" 'any(.nodes[]; .external == "picasso" and (.href | test("labs_" + ($l | gsub("-"; "_")))))' ../build/grafo/graph.json >/dev/null || { echo "site: no link to picasso labs/$lab in the code graph" >&2; exit 1; }; done
for f in ../docs/archify/*.json; do test -s "dist/figuras/$(basename "$f" .json).html" || { echo "site: no page for $f" >&2; exit 1; }; done
tail -n +2 ../docs/eli5/RESULTS.tsv | cut -f3 | while read -r pdf; do test -s "dist/eli5/$pdf" && grep -qF "eli5/$pdf" dist/index.html || { echo "site: no ELI5 PDF or link for $pdf" >&2; exit 1; }; done
6 changes: 5 additions & 1 deletion site/src/ptbr_writer_site/app.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -499,8 +499,12 @@ fn figuras() -> Element(msg) {
html.text("grafo do código"),
]),
html.text(
" (busca, zoom e comunidades; sai do code-graph do h0ffmann/picasso).",
" (busca, zoom e comunidades; sai do code-graph do h0ffmann/picasso). os nós que usam o picasso levam ao ",
),
html.a([attribute.href("grafo/picasso.html")], [
html.text("grafo do picasso"),
]),
html.text(", no commit que este repositório fixa."),
]),
],
)
Expand Down
Loading