From 93ddb288029ae3f4a54c72d122bbd81040f37d16 Mon Sep 17 00:00:00 2001 From: LordBaryhobal Date: Wed, 24 Jun 2026 15:53:52 +0200 Subject: [PATCH] docs: setup user manual --- assets/icon.svg | 117 ++++++++++++++++++++++++++++++++++++++++++++++ docs/manual.typ | 27 +++++++++++ docs/template.typ | 96 +++++++++++++++++++++++++++++++++++++ 3 files changed, 240 insertions(+) create mode 100644 assets/icon.svg create mode 100644 docs/manual.typ create mode 100644 docs/template.typ diff --git a/assets/icon.svg b/assets/icon.svg new file mode 100644 index 0000000..56c81fa --- /dev/null +++ b/assets/icon.svg @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/manual.typ b/docs/manual.typ new file mode 100644 index 0000000..5919e48 --- /dev/null +++ b/docs/manual.typ @@ -0,0 +1,27 @@ +#import "template.typ": TODO, project + +#let midas-version = toml("../pyproject.toml").project.version +#let head-ref = read("../.git/HEAD").split(":").at(1).trim() +#let commit-hash = read("../.git/" + head-ref).slice(0, 8) + +#show: project.with( + title: [Midas User Manual], + author: "Louis Heredero", + version: midas-version, + hash: commit-hash, + icon-path: path("../assets/icon.svg"), +) + += Introduction + +#TODO + += Installation + +#TODO + += Quick Start + +This chapter will give you the keys to quickly start using Midas in your project. + +#TODO diff --git a/docs/template.typ b/docs/template.typ new file mode 100644 index 0000000..78589f0 --- /dev/null +++ b/docs/template.typ @@ -0,0 +1,96 @@ +#import "@preview/modpattern:0.2.0": modpattern + +#let TODO = block( + width: 6em, + height: 3em, + stroke: red, + fill: modpattern( + size: (10pt, 10pt), + line( + start: (0%, 0%), + end: (100%, 100%), + stroke: gray.transparentize(60%) + 2pt, + ), + ), + align( + center + horizon, + text(fill: red, size: 1.5em)[*TODO*], + ), +) + +#let _render-header(version, hash) = { + let last-heading = query(heading.where(level: 1).before(here())).last(default: none) + let next-heading = query(heading.where(level: 1).after(here())).first(default: none) + + let current-heading = if next-heading != none and next-heading.location().page() == here().page() { + next-heading + } else if last-heading != none { + last-heading + } else { none } + + let chapter = if current-heading != none { + let body = current-heading.body + if current-heading.numbering != none { + let num = counter(heading).display(current-heading.numbering, at: current-heading.location()) + body = [#num #body] + } + body + } else [] + + grid( + columns: (1fr, auto, 1fr), + align: (left, center, right), + document.title, [v#version - #hash], chapter, + ) +} + +#let project( + title: none, + author: none, + version: "0.0.1", + hash: "abcdefgh", + icon-path: none, + doc, +) = { + assert(title != none, message: "Please provide a title") + + set document( + title: title, + author: author, + ) + set text( + font: "Source Sans 3", + ) + + show std.title: set text(size: 1.5em) + + show heading.where(level: 1): it => { + pagebreak() + it + } + + set page( + header: context if counter(page).get().first() != 1 { _render-header(version, hash) }, + footer: context if counter(page).get().first() != 1 and page.numbering != none { + align(center, counter(page).display(page.numbering, both: true)) + }, + numbering: "1 / 1", + ) + + // Title page + align(center)[ + #std.title() + + v#version - #hash + + #if icon-path != none { + v(1cm) + image(icon-path) + } + ] + + outline() + show heading.where(level: 1): set heading(numbering: "I.") + + doc +}