From 1a141c19df43aecf36afd69be0c3d9df739be1fc Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Wed, 21 Feb 2024 09:34:34 +0100 Subject: [PATCH] nix: Add postgrest-docs-render to render latex documents --- docs/_diagrams/README.md | 5 +---- nix/tools/docs.nix | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/docs/_diagrams/README.md b/docs/_diagrams/README.md index 7014ae378..90be8f2e6 100644 --- a/docs/_diagrams/README.md +++ b/docs/_diagrams/README.md @@ -17,10 +17,7 @@ The schema structure diagram is done with LaTeX. You can use a GUI like https:// Then use this command to generate the png file. ```bash -pdflatex --shell-escape -halt-on-error db.tex - -## and move it to the static folder(it's not easy to do it in one go with the pdflatex) -mv db.png ../_static/ +postgrest-docs-render ``` LaTeX is used because it's a tweakable plain text format. diff --git a/nix/tools/docs.nix b/nix/tools/docs.nix index c2c18728f..100abd916 100644 --- a/nix/tools/docs.nix +++ b/nix/tools/docs.nix @@ -2,8 +2,10 @@ , aspellDicts , buildToolbox , checkedShellScript +, imagemagick , python3 , python3Packages +, texlive , writers }: let @@ -56,6 +58,19 @@ let fi ''; + render = + checkedShellScript + { + name = "postgrest-docs-render"; + docs = "Render the diagrams."; + workingDir = "/docs/_diagrams"; + withTmpDir = true; + } + '' + ${texlive.combined.scheme-full}/bin/pdflatex -halt-on-error -output-directory="$tmpdir" db.tex + ${imagemagick}/bin/convert -density 300 "$tmpdir/db.pdf" ../_static/db.png + ''; + server = writers.writePython3 "postgrest-docs-server" @@ -165,6 +180,7 @@ buildToolbox check dictcheck linkcheck + render serve spellcheck ];