diff --git a/docs/_diagrams/README.md b/docs/_diagrams/README.md index 5bc8abe10..1142b48c1 100644 --- a/docs/_diagrams/README.md +++ b/docs/_diagrams/README.md @@ -10,34 +10,6 @@ You can go download erd from https://github.com/BurntSushi/erd/releases and then The fonts used belong to the GNU FreeFont family. You can download them here: http://ftp.gnu.org/gnu/freefont/ -## LaTeX - -The schema structure diagram is done with LaTeX. You can use a GUI like https://www.mathcha.io/editor to create the .tex file. - -Then use this command to generate the png file. - -```bash -postgrest-docs-render -``` - -LaTeX is used because it's a tweakable plain text format. - -You can install the full latex suite with `nix`: - -``` -nix-env -iA texlive.combined.scheme-full -``` - -To tweak the file with a live reload environment use: - -```bash -# open the pdf(zathura used as an example) -zathura db.pdf & - -# live reload with entr -echo db.tex | entr pdflatex --shell-escape -halt-on-error db.tex -``` - ## UML The UML diagrams are created with https://plantuml.com/. diff --git a/docs/_diagrams/db.tex b/docs/_diagrams/db.tex deleted file mode 100644 index ed33c8c67..000000000 --- a/docs/_diagrams/db.tex +++ /dev/null @@ -1,71 +0,0 @@ -\documentclass[convert]{standalone} -\usepackage{amsmath} -\usepackage{tikz} -\usepackage{mathdots} -\usepackage{yhmath} -\usepackage{cancel} -\usepackage{color} -\usepackage{siunitx} -\usepackage{array} -\usepackage{multirow} -\usepackage{amssymb} -\usepackage{gensymb} -\usepackage{tabularx} -\usepackage{booktabs} -\usetikzlibrary{fadings} -\usetikzlibrary{patterns} -\usetikzlibrary{shadows.blur} -\usetikzlibrary{shapes} - -\begin{document} - -\newcommand\customScale{0.35} - -\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1, scale=\customScale, every node/.style={scale=\customScale}] - -%Shape: Can [id:dp7234864758664346] -\draw [fill={rgb, 255:red, 47; green, 97; blue, 144 } ,fill opacity=1 ] (497.5,51.5) -- (497.5,255.5) .. controls (497.5,275.66) and (423.18,292) .. (331.5,292) .. controls (239.82,292) and (165.5,275.66) .. (165.5,255.5) -- (165.5,51.5) .. controls (165.5,31.34) and (239.82,15) .. (331.5,15) .. controls (423.18,15) and (497.5,31.34) .. (497.5,51.5) .. controls (497.5,71.66) and (423.18,88) .. (331.5,88) .. controls (239.82,88) and (165.5,71.66) .. (165.5,51.5) ; -%Shape: Rectangle [id:dp7384065579958246] -\draw [fill={rgb, 255:red, 236; green, 227; blue, 227 } ,fill opacity=1 ] (189,115) -- (252.5,115) -- (252.5,155) -- (189,155) -- cycle ; -%Shape: Rectangle [id:dp24763906430298177] -\draw [fill={rgb, 255:red, 236; green, 227; blue, 227 } ,fill opacity=1 ] (292,118) -- (362,118) -- (362,158) -- (292,158) -- cycle ; -%Shape: Rectangle [id:dp3775601612537265] -\draw [fill={rgb, 255:red, 236; green, 227; blue, 227 } ,fill opacity=1 ] (397,114) -- (467,114) -- (467,154) -- (397,154) -- cycle ; -%Shape: Rectangle [id:dp7071457022893852] -\draw [fill={rgb, 255:red, 248; green, 231; blue, 28 } ,fill opacity=1 ] (269,199) -- (397.5,199) -- (397.5,273) -- (269,273) -- cycle ; -%Straight Lines [id:da8846759047437789] -\draw (268,234) -- (226.44,155.77) ; -\draw [shift={(225.5,154)}, rotate = 422.02] [color={rgb, 255:red, 0; green, 0; blue, 0 } ][line width=0.75] (10.93,-3.29) .. controls (6.95,-1.4) and (3.31,-0.3) .. (0,0) .. controls (3.31,0.3) and (6.95,1.4) .. (10.93,3.29) ; -%Straight Lines [id:da6908444738113828] -\draw (309.5,198) -- (307.6,161) ; -\draw [shift={(307.5,159)}, rotate = 447.06] [color={rgb, 255:red, 0; green, 0; blue, 0 } ][line width=0.75] (10.93,-3.29) .. controls (6.95,-1.4) and (3.31,-0.3) .. (0,0) .. controls (3.31,0.3) and (6.95,1.4) .. (10.93,3.29) ; -%Straight Lines [id:da7168757864413169] -\draw (398.5,233) -- (431.72,154.84) ; -\draw [shift={(432.5,153)}, rotate = 473.03] [color={rgb, 255:red, 0; green, 0; blue, 0 } ][line width=0.75] (10.93,-3.29) .. controls (6.95,-1.4) and (3.31,-0.3) .. (0,0) .. controls (3.31,0.3) and (6.95,1.4) .. (10.93,3.29) ; -%Up Down Arrow [id:dp14059754167108496] -\draw [fill={rgb, 255:red, 126; green, 211; blue, 33 } ,fill opacity=1 ] (312.5,288.5) -- (330,273) -- (347.5,288.5) -- (338.75,288.5) -- (338.75,319.5) -- (347.5,319.5) -- (330,335) -- (312.5,319.5) -- (321.25,319.5) -- (321.25,288.5) -- cycle ; - -% Text Node -\draw (201,129) node [anchor=north west][inner sep=0.75pt] [align=left] {tables}; -% Text Node -\draw (307,130) node [anchor=north west][inner sep=0.75pt] [align=left ] {tables}; -% Text Node -\draw (414,127) node [anchor=north west][inner sep=0.75pt] [align=left] {tables}; -% Text Node -\draw (300,203) node [anchor=north west][inner sep=0.75pt] [color={rgb, 255:red, 0; green, 0; blue, 0 } ,opacity=1 ] [align=center] { \\ views \\ + \\ \ \ functions}; - -% Text Node -\draw (322,178) node [anchor=north west][inner sep=0.75pt] [color={rgb, 255:red, 255; green, 255; blue, 255 } ,opacity=1 ] [align=left] {\large\textbf{api}}; -% Text Node -\draw (190,97) node [anchor=north west][inner sep=0.75pt] [color={rgb, 255:red, 255; green, 255; blue, 255 } ,opacity=1 ] [align=left] {\large\textbf{internal}}; -% Text Node -\draw (300,99) node [anchor=north west][inner sep=0.75pt] [color={rgb, 255:red, 255; green, 255; blue, 255 } ,opacity=1 ] [align=left] {\large\textbf{private}}; -% Text Node -\draw (417,101) node [anchor=north west][inner sep=0.75pt] [color={rgb, 255:red, 255; green, 255; blue, 255 } ,opacity=1 ] [align=left] {\large\textbf{core}}; -% Text Node -\draw (358,306) node [anchor=north west][inner sep=0.75pt] [align=left] {REST}; - -\end{tikzpicture} - - -\end{document} diff --git a/nix/tools/docs.nix b/nix/tools/docs.nix index 929da5017..fdfd60847 100644 --- a/nix/tools/docs.nix +++ b/nix/tools/docs.nix @@ -2,10 +2,8 @@ , aspellDicts , buildToolbox , checkedShellScript -, imagemagick , python3 , python3Packages -, texlive , writers , plantuml }: @@ -61,35 +59,13 @@ let ''; render = - let - pdflatex = texlive.combine { - inherit (texlive) - amsmath - booktabs - cancel - gensymb - mathdots - multirow - pgf - pgf-blur - scheme-basic - siunitx - standalone - yhmath - ; - }; - in checkedShellScript { name = "postgrest-docs-render"; docs = "Render the diagrams."; workingDir = "/docs/_diagrams"; - withTmpDir = true; } '' - ${pdflatex}/bin/pdflatex -halt-on-error -output-directory="$tmpdir" db.tex - ${imagemagick}/bin/convert -density 300 "$tmpdir/db.pdf" ../_static/db.png - ${plantuml}/bin/plantuml -tsvg uml/*.uml -o ../../_static ${plantuml}/bin/plantuml -tsvg -darkmode uml/dark/*.uml -o ../../../_static '';