feat: Nix: render examples using LeanInk+Alectryon
This commit is contained in:
parent
282147631f
commit
bef34e30e7
4 changed files with 18 additions and 7 deletions
2
.github/workflows/nix-ci.yml
vendored
2
.github/workflows/nix-ci.yml
vendored
|
|
@ -92,7 +92,7 @@ jobs:
|
|||
nix build $NIX_BUILD_ARGS .#test -o push-test
|
||||
- name: Build manual
|
||||
run: |
|
||||
nix build $NIX_BUILD_ARGS --update-input lean --no-write-lock-file ./doc#lean-mdbook ./doc#test -o push-doc
|
||||
nix build $NIX_BUILD_ARGS --update-input lean --no-write-lock-file ./doc#{lean-mdbook,leanInk,alectryon,test} -o push-doc
|
||||
nix build $NIX_BUILD_ARGS --update-input lean --no-write-lock-file ./doc
|
||||
if: matrix.name == 'Nix Linux'
|
||||
- name: Push to Cachix
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ Unreleased
|
|||
|
||||
* Add cross-compiled [aarch64 Linux](https://github.com/leanprover/lean4/pull/1066) and [aarch64 macOS](https://github.com/leanprover/lean4/pull/1076) releases.
|
||||
|
||||
* [Added tutorial-like examples to our documentation](https://github.com/leanprover/lean4/tree/master/doc/examples). They will be soon rendered using LeanInk+Alectryon.
|
||||
* [Add tutorial-like examples to our documentation](https://github.com/leanprover/lean4/tree/master/doc/examples), rendered using LeanInk+Alectryon.
|
||||
|
||||
v4.0.0-m4 (23 March 2022)
|
||||
---------
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
Examples
|
||||
========
|
||||
|
||||
- [A Certified Type Checker](https://github.com/leanprover/lean4/blob/master/doc/examples/tc.lean)
|
||||
- [The Well-Typed Interpreter](https://github.com/leanprover/lean4/blob/master/doc/examples/interp.lean)
|
||||
- [Dependent de Bruijn Indices](https://github.com/leanprover/lean4/blob/master/doc/examples/deBruijn.lean)
|
||||
- [Parametric Higher-Order Abstract Syntax](https://github.com/leanprover/lean4/blob/master/doc/examples/phoas.lean)
|
||||
- [A Certified Type Checker](examples/tc.lean.html)
|
||||
- [The Well-Typed Interpreter](examples/interp.lean.html)
|
||||
- [Dependent de Bruijn Indices](examples/deBruijn.lean.html)
|
||||
- [Parametric Higher-Order Abstract Syntax](examples/phoas.lean.html)
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
});
|
||||
doCheck = false;
|
||||
});
|
||||
doc = stdenv.mkDerivation {
|
||||
book = stdenv.mkDerivation {
|
||||
name ="lean-doc";
|
||||
src = doc-src;
|
||||
buildInputs = [ lean-mdbook ];
|
||||
|
|
@ -69,6 +69,17 @@
|
|||
(with python3Packages; [ pygments dominate beautifulsoup4 docutils ]);
|
||||
doCheck = false;
|
||||
};
|
||||
examples = let
|
||||
renderLean = name: file: runCommandNoCC "${name}.html" { buildInputs = [ alectryon ]; } ''
|
||||
mkdir -p $out/examples
|
||||
alectryon --frontend lean4+rst ${file} -o $out/examples/${name}.html
|
||||
'';
|
||||
ents = builtins.readDir ./examples;
|
||||
inputs = lib.filterAttrs (n: t: t == "regular") ents;
|
||||
outputs = lib.mapAttrs (n: _: renderLean n ./examples/${n}) inputs;
|
||||
in
|
||||
outputs // symlinkJoin { name = "examples"; paths = lib.attrValues outputs; };
|
||||
doc = symlinkJoin { name = "doc"; paths = [ book examples ]; };
|
||||
};
|
||||
defaultPackage = self.packages.${system}.doc;
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue