add note template
parent
cd3c5dac83
commit
061cbb6a49
|
|
@ -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 <at> 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
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 313 KiB |
57
lib.typ
57
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)
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in New Issue