diff --git a/README.md b/README.md index 2c92bca..a6c4e19 100644 --- a/README.md +++ b/README.md @@ -106,6 +106,12 @@ Parameters can be passed to the template depending on the usage. The `doc_type` #show: notes-template.with(doc_type: "research_journal", keywords: ("ipsum",)) ``` +## LICENSE + +This template is licensed under AGPLv3 or later, except for the content of the `img` directory, which is proprietary en protected by copyright laws. + +If you find the need to use this code under a more permissive license, contact `histausse protonmail.com` and explain your use-case, we may grant you part of the code under another license. (Request for commercial use outside of what is allowed by the AGPL will most likely not be granted: the price to use this code is to keep it free). + ## TODO: - biblio diff --git a/img/pains-perdus.png b/img/pains-perdus.png new file mode 100644 index 0000000..c554619 Binary files /dev/null and b/img/pains-perdus.png differ diff --git a/img/pirat.png b/img/pirat.png new file mode 100644 index 0000000..123679b Binary files /dev/null and b/img/pirat.png differ diff --git a/lib.typ b/lib.typ index 77ff945..e3ce67d 100644 --- a/lib.typ +++ b/lib.typ @@ -23,8 +23,36 @@ } } -#let note_header(title: "Notes", ..args) = { - [ = #title ] +#let logos = ( + "pirat": image("img/pirat.png", width: 30mm), + "pains-perdus": image("img/pains-perdus.png", width: 25mm), +) + +#let note_header(title: [ Notes ], authors: (), date: datetime.today(), logo: none, ..args) = { + align(center, text(size: 20pt, title)) + if logo != none { + context { + place( + top+left, + dy: -page.margin*0.8, + dx: -page.margin*0.8, + logos.at(logo) + ) + } + } + place(top+right, date.display()) + if authors != () { + align(center)[ + //By: + #v(16pt, weak: true) + #for author in authors { + author + v(16pt, weak: true) + } + ] + } + + outline(indent: 2em, fill: none) } #let research_journal_header(title: "Research Journal", ..args) = { @@ -45,7 +73,15 @@ v(2em) } -#let notes-template(title: none, doc_type: none, keywords: (), doc) = { +#let notes-template( + title: none, + doc_type: none, + keywords: (), + authors: none, + date: none, + logo: none, + doc) = { + set document(title: title) show raw.where(lang: "dot-render"): it => gviz.render-image(it.text) show raw.where(lang: "digraphLR"): it => gviz.render-image("digraph mygraph { rankdir=\"LR\";" + it.text + "}") show raw.where(lang: "digraphTB"): it => gviz.render-image("digraph mygraph { rankdir=\"TB\";" + it.text + "}") @@ -65,12 +101,25 @@ } let args = (:) - for (arg, val) in ("title": title, "keywords": keywords) { + for (arg, val) in ( + "title": title, + "keywords": keywords, + "authors": authors, + "date": date, + "logo": logo, + ) { if val != none { args.insert(arg, val) } } + + set page( + height: auto, + margin: 25mm, + ) if doc_type == "notes" + if doc_type == "notes" { + // TODO: import from file instead? note_header(..args) } else if doc_type == "research_journal" { research_journal_header(..args) diff --git a/template/main.typ b/template/main.typ index 19dd830..418415e 100644 --- a/template/main.typ +++ b/template/main.typ @@ -1,5 +1,19 @@ #import "@local/notes:0.0.1": * -#show: notes-template.with(doc_type: "research_journal", keywords: ("ipsum",)) +#show: notes-template.with( + doc_type: "notes", + title: [ On the Usefullness of Notetaking ], + authors: ( + [ Jane Doe ], + [ Jack Dow ] + ), + logo: "pains-perdus", + date: datetime( + year: 2024, + month: 1, + day: 1, + ), + keywords: () +) ```dot-render digraph mygraph {