summaryrefslogtreecommitdiff
path: root/book
diff options
context:
space:
mode:
Diffstat (limited to 'book')
-rw-r--r--book/book.js27
-rw-r--r--book/book.typ6
-rw-r--r--book/locale/en.ini2
3 files changed, 22 insertions, 13 deletions
diff --git a/book/book.js b/book/book.js
index 094068c0..00c83426 100644
--- a/book/book.js
+++ b/book/book.js
@@ -40,17 +40,20 @@ const about = () => ({
t: "page", es: [
{ t: "text", s: tr("b.about"), color: "#000000", size: 30, font: "FreeSans" },
par("b.about.name"),
- { t: "text", s: tr("b.about.image_attrib"), color: "#000000", size: 20, font: "FreeSans" },
+ { t: "conditional", cond: "image_attribution", value: true, e: { t: "text", s: tr("b.about.image_attrib"), color: "#000000", size: 20, font: "FreeSans" } },
{
- t: "table", es: [
- [par("b.about.image_attrib.name", false, true), par("b.about.image_attrib.author", false, true)],
- [par("b.nigiri"), par_raw(plain("Ahtziri Lagarde(unsplash)"))],
- [par("b.icecream"), par_raw(plain("Markus Spiske(unsplash), adapted"))],
- [par("b.curry"), par_raw(plain("Andy Hay(unsplash), adapted"))],
- [par("b.mochi"), par_raw(plain("blackieshoot(unsplash)"))],
- [par("b.burger"), par_raw(plain("Pablo Merchán Montes(unsplash), adapted"))],
- [par("b.tomato_soup"), par_raw(plain("Julia Kicova(unsplash), adapted"))],
- ]
+ t: "conditional", cond: "image_attribution", value: true, e:
+ {
+ t: "table", es: [
+ [par("b.about.image_attrib.name", false, true), par("b.about.image_attrib.author", false, true)],
+ [par("b.nigiri"), par_raw(plain("Ahtziri Lagarde (unsplash)"))],
+ [par("b.icecream"), par_raw(plain("Markus Spiske (unsplash), adapted"))],
+ [par("b.curry"), par_raw(plain("Andy Hay (unsplash), adapted"))],
+ [par("b.mochi"), par_raw(plain("blackieshoot (unsplash)"))],
+ [par("b.burger"), par_raw(plain("Pablo Merchán Montes (unsplash), adapted"))],
+ [par("b.tomato_soup"), par_raw(plain("Julia Kicova (unsplash), adapted"))],
+ ]
+ }
}
]
})
@@ -58,9 +61,7 @@ const recipe = (n, i, th = false, extra = []) => ({
t: "page", background: n, es: [
h2(`b.${n}`, th),
par(`b.${n}.desc`, th),
- {
- t: "list", es: i.map(e => emph(`b.ingred.${e}`, th))
- },
+ { t: "list", es: i.map(e => emph(`b.ingred.${e}`, th)) },
par(`b.${n}.steps`, th),
...extra
]
diff --git a/book/book.typ b/book/book.typ
index 14e617a0..2dc7bdf5 100644
--- a/book/book.typ
+++ b/book/book.typ
@@ -5,6 +5,8 @@
#show list: set text(font: "Gluten", fill: rgb(46, 73, 0), size: 20pt)
#show heading.where(level: 2): set text(font: "Great Vibes", size: 40pt)
+#let document_flags = ("image_attribution",)
+
#let load_locale(name) = {
read("locale/"+name+".ini")
.split("\n")
@@ -51,6 +53,10 @@
#par(..elem.es.map(element))
] else if elem.t == "table" [
#table(columns: elem.es.at(0).len(), ..elem.es.flatten().map(element))
+ ] else if elem.t == "conditional" [
+ #if (elem.cond in document_flags) == elem.value [
+ #element(elem.e)
+ ]
] else [
#elem
]
diff --git a/book/locale/en.ini b/book/locale/en.ini
index 3933dc8a..303c6786 100644
--- a/book/locale/en.ini
+++ b/book/locale/en.ini
@@ -1,5 +1,7 @@
[hurrycurry]
b.about.image_attrib=Background image attribution
+b.about.image_attrib.name=Name
+b.about.image_attrib.author=Author
b.about.name=The Hurry Curry! recipe book.
b.about=About this book
b.bun.desc=The most saturating meal of them all. Best enjoyed with a tomato soup.