add template selection
parent
60a3671a68
commit
cd3c5dac83
10
README.md
10
README.md
|
|
@ -59,6 +59,7 @@ a -- b;
|
||||||
b -- c;
|
b -- c;
|
||||||
c -- a;
|
c -- a;
|
||||||
\```
|
\```
|
||||||
|
```
|
||||||
|
|
||||||
```
|
```
|
||||||
\```pintora
|
\```pintora
|
||||||
|
|
@ -76,7 +77,6 @@ mindmap
|
||||||
*** DOT Diagram
|
*** DOT Diagram
|
||||||
\```
|
\```
|
||||||
```
|
```
|
||||||
```
|
|
||||||
|
|
||||||
### Todo
|
### Todo
|
||||||
|
|
||||||
|
|
@ -98,6 +98,14 @@ To hid todos, you can add this line at the top of the document:
|
||||||
#show-todos.update(_ => false)
|
#show-todos.update(_ => false)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Templates
|
||||||
|
|
||||||
|
Parameters can be passed to the template depending on the usage. The `doc_type` parameter indicate the specific template to use:
|
||||||
|
|
||||||
|
```
|
||||||
|
#show: notes-template.with(doc_type: "research_journal", keywords: ("ipsum",))
|
||||||
|
```
|
||||||
|
|
||||||
## TODO:
|
## TODO:
|
||||||
|
|
||||||
- biblio
|
- biblio
|
||||||
|
|
|
||||||
38
lib.typ
38
lib.typ
|
|
@ -23,7 +23,29 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#let notes-template(keywords: (), doc) = {
|
#let note_header(title: "Notes", ..args) = {
|
||||||
|
[ = #title ]
|
||||||
|
}
|
||||||
|
|
||||||
|
#let research_journal_header(title: "Research Journal", ..args) = {
|
||||||
|
show link: underline
|
||||||
|
show heading.where(level: 2): it => {
|
||||||
|
it
|
||||||
|
v(5pt, weak: true)
|
||||||
|
line(length: 100%)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setup level3 headings
|
||||||
|
show heading.where(level: 3): it => {
|
||||||
|
block(smallcaps(it.body))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set Make title
|
||||||
|
align(center, text(size: 20pt, font: "Indie Flower", title))
|
||||||
|
v(2em)
|
||||||
|
}
|
||||||
|
|
||||||
|
#let notes-template(title: none, doc_type: none, keywords: (), doc) = {
|
||||||
show raw.where(lang: "dot-render"): it => gviz.render-image(it.text)
|
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: "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 + "}")
|
show raw.where(lang: "digraphTB"): it => gviz.render-image("digraph mygraph { rankdir=\"TB\";" + it.text + "}")
|
||||||
|
|
@ -42,6 +64,20 @@
|
||||||
rest
|
rest
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let args = (:)
|
||||||
|
for (arg, val) in ("title": title, "keywords": keywords) {
|
||||||
|
if val != none {
|
||||||
|
args.insert(arg, val)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if doc_type == "notes" {
|
||||||
|
note_header(..args)
|
||||||
|
} else if doc_type == "research_journal" {
|
||||||
|
research_journal_header(..args)
|
||||||
|
} else {
|
||||||
|
assert.eq(doc_type, none, message: "unknown document type: " + doc_type)
|
||||||
|
}
|
||||||
|
|
||||||
doc
|
doc
|
||||||
|
|
||||||
todos()
|
todos()
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#import "@local/notes:0.0.1": *
|
#import "@local/notes:0.0.1": *
|
||||||
#show: notes-template
|
#show: notes-template.with(doc_type: "research_journal", keywords: ("ipsum",))
|
||||||
|
|
||||||
```dot-render
|
```dot-render
|
||||||
digraph mygraph {
|
digraph mygraph {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue