From 25342bd4b3853685e91b33de49120315f953d7ba Mon Sep 17 00:00:00 2001 From: Jean-Marie Mineau Date: Wed, 25 Jun 2025 11:52:01 +0200 Subject: [PATCH] add commit in draft --- README.md | 2 ++ lib/general.typ | 9 +++++++++ lib/matisse-thesis.typ | 9 +++++++-- lib/todos.typ | 2 +- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1a17a8a..2cf4a52 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,8 @@ ln -s $(pwd) ~/.local/share/typst/packages/local/template-thesis-matisse/0.0.1 To generate a new project, run `typst init @local/template-thesis-matisse ` +In draft mode, you can call typst with `--input commit=$(git rev-parse --short HEAD)` to display the current commit. + ## Reference - Inspired by [the thesis of Timothe Albouy](https://github.com/TimotheAlbouy/talb-thesis/tree/main), some code might be copied from it. diff --git a/lib/general.typ b/lib/general.typ index 07b03a4..a3d98c0 100644 --- a/lib/general.typ +++ b/lib/general.typ @@ -18,3 +18,12 @@ body ) ]) + +#let highlight(fill: luma(230), content) = { + block( + inset: 8pt, + radius: 4pt, + fill: fill, + content + ) +} diff --git a/lib/matisse-thesis.typ b/lib/matisse-thesis.typ index 903ad4b..8c9e559 100644 --- a/lib/matisse-thesis.typ +++ b/lib/matisse-thesis.typ @@ -36,7 +36,12 @@ ) = { assert-etablissements(university) - if draft { + if draft { + [== DRAFT - #title-en] + // if typst was called with `--input commit=$(git rev-parse --short HEAD)`, add the current commit: + if "commit" in sys.inputs { + [Current version: commit #sys.inputs.commit \ \ ] + } todos() } else { show-todos.update(false) @@ -90,7 +95,7 @@ // display last level-2 heading (current page included) let header-content = hydra(2, use-last: true, display: (_, it) => { - if it.numbering == none [_ #it.body _ ] + if it.numbering == none [_ #it.body _] else { let nb = counter(heading).at(it.location()) let nb-fmt = numbering( diff --git a/lib/todos.typ b/lib/todos.typ index fd6934b..6e879b2 100644 --- a/lib/todos.typ +++ b/lib/todos.typ @@ -23,7 +23,7 @@ #let todos() = context { if (todo-list.final().len() != 0) and (show-todos.get()) { - pagebreak(weak: true) + //pagebreak(weak: true) text(size: 2em, weight: "bold", fill:red)[TO-DOs] for t in todo-list.final() { let l = label(t.first())