From aa25e084d2b5ad667ba29d62b70d9a8ee6ab67d5 Mon Sep 17 00:00:00 2001 From: Joshua Potter Date: Thu, 14 Dec 2023 15:27:12 -0700 Subject: [PATCH] Update index and add pdflatex generation script. --- DocGen4/Output/Index.lean | 65 +++++++++++++++++++++++++++++++++++++-- lakefile.lean | 9 ++++++ run_pdflatex.sh | 19 ++++++++++++ 3 files changed, 90 insertions(+), 3 deletions(-) create mode 100755 run_pdflatex.sh diff --git a/DocGen4/Output/Index.lean b/DocGen4/Output/Index.lean index afa4eb5..f12b0fa 100644 --- a/DocGen4/Output/Index.lean +++ b/DocGen4/Output/Index.lean @@ -15,9 +15,68 @@ def index : BaseHtmlM Html := do templateExtends (baseHtml "Index") <| pure <|
-

Welcome to the documentation page

- -- Temporary comment until the lake issue is resolved - -- for commit {s!"{← getProjectCommit} "} +

Bookshelf

+

+ A study of the books listed below. Most proofs are conducted in LaTeX. + Where feasible, theorems are also formally proven in + Lean. +

+ +

In Progress

+ + +

Complete

+ + +

Pending

+ + +

Legend

+

+ A color/symbol code is used on generated PDF headers to indicate their + status: +

+

This was built using Lean 4 at commit {Lean.githash}

diff --git a/lakefile.lean b/lakefile.lean index a062dcc..9366362 100644 --- a/lakefile.lean +++ b/lakefile.lean @@ -160,6 +160,15 @@ library_facet docs (lib) : FilePath := do coreJob.bindAsync fun _ coreInputTrace => do exeJob.bindAsync fun exeFile exeTrace => do moduleJobs.bindSync fun _ inputTrace => do + logInfo "Converting TeX to PDF" + let some docGen4 ← findPackage? `«doc-gen4» + | error "no doc-gen4 package found in workspace" + let pdfLatex := docGen4.srcDir / "run_pdflatex.sh" + let buildDir := (←getWorkspace).root.buildDir + proc { + cmd := pdfLatex.toString + args := #[buildDir.toString] + } let depTrace := mixTraceArray #[inputTrace, exeTrace, coreInputTrace] let trace ← buildFileUnlessUpToDate dataFile depTrace do logInfo "Documentation indexing" diff --git a/run_pdflatex.sh b/run_pdflatex.sh new file mode 100755 index 0000000..b46f9cf --- /dev/null +++ b/run_pdflatex.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +if ! command -v pdflatex > /dev/null; then + >&2 echo 'pdflatex was not found in the current $PATH.' + exit 1 +fi + +BUILD_DIR="$1" + +# We run this command twice to allow any cross-references to resolve correctly. +# https://tex.stackexchange.com/questions/41539/does-hyperref-work-between-two-files +TEX_FILES=$(find . -name ".tex" -not -path "*preamble.tex") +for _ in {1..2}; do + for f in $TEX_FILES; do + REL_DIR=$(dirname "$f") + REL_BASE=$(basename -s ".tex" "$1") + cp "$REL_DIR/$REL_BASE.pdf" "$BUILD_DIR/doc/$REL_DIR/" + done +done