From ecfd8deece332f6ebc180b77da61e761bbf358e0 Mon Sep 17 00:00:00 2001 From: Quinn Dougherty Date: Tue, 12 Apr 2022 17:22:11 -0400 Subject: [PATCH] scaffolding in place for properties.pdf --- packages/squiggle-lang/.gitignore | 1 + .../squiggle-lang/__tests__/docs/README.md | 15 +++++++++ .../squiggle-lang/__tests__/docs/default.nix | 33 +++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 packages/squiggle-lang/__tests__/docs/README.md create mode 100644 packages/squiggle-lang/__tests__/docs/default.nix diff --git a/packages/squiggle-lang/.gitignore b/packages/squiggle-lang/.gitignore index 8375bb3b..82bd762d 100644 --- a/packages/squiggle-lang/.gitignore +++ b/packages/squiggle-lang/.gitignore @@ -19,3 +19,4 @@ yarn-error.log dist *.coverage _coverage +result diff --git a/packages/squiggle-lang/__tests__/docs/README.md b/packages/squiggle-lang/__tests__/docs/README.md new file mode 100644 index 00000000..7af8e264 --- /dev/null +++ b/packages/squiggle-lang/__tests__/docs/README.md @@ -0,0 +1,15 @@ +# Properties + +Using `nix`. Where `o` is `open` on OSX and `xdg-open` on linux, +```sh +nix-build +o result/properties.pdf +``` +Without `nix`, you can install `pandoc` yourself and run +```sh +pandoc --from markdown --to latex --out properties.pdf --pdf-engine xelatex properties.md +``` + +## _Details_ + +The `properties.pdf` document is _normative and aspirational_. It does not document tests as they exist in the codebase, but somewhat represents how we think squiggle ought to be tested. \ No newline at end of file diff --git a/packages/squiggle-lang/__tests__/docs/default.nix b/packages/squiggle-lang/__tests__/docs/default.nix new file mode 100644 index 00000000..5a18efd3 --- /dev/null +++ b/packages/squiggle-lang/__tests__/docs/default.nix @@ -0,0 +1,33 @@ +{ chan ? "a7ecde854aee5c4c7cd6177f54a99d2c1ff28a31" # 21.11 +, pkgs ? import (builtins.fetchTarball { url = "https://github.com/NixOS/nixpkgs/archive/${chan}.tar.gz"; }) {} +}: +# Style sheets https://github.com/citation-style-language/styles/ +with pkgs; +let deps = [ +# (texlive.combine +# { inherit (texlive) +# scheme-small thmtools datetime xpatch fmtcount; +# } +# ) + haskellPackages.pandoc + ]; +in + stdenv.mkDerivation { + name = "render_squiggle_properties"; + src = ./.; + buildInputs = deps; + buildPhase = '' + echo rendering... + pandoc \ + --from markdown \ + --to latex \ + --out properties.pdf \ + --pdf-engine xelatex \ + properties.md \ + echo rendered. + ''; + installPhase = '' + mkdir -p $out + cp properties.pdf $out/properties.pdf + ''; + }