mirror of
https://0xacab.org/anarsec/anarsec.guide.git
synced 2025-07-23 23:01:04 -04:00
python and typst script
This commit is contained in:
parent
da5f497ec1
commit
be05046783
19 changed files with 2223 additions and 0 deletions
111
layout/anarsec_article.typ
Normal file
111
layout/anarsec_article.typ
Normal file
|
@ -0,0 +1,111 @@
|
|||
#let anarsec_article(
|
||||
title: none,
|
||||
frontimage: none,
|
||||
backimage: none,
|
||||
lastediteddate: none,
|
||||
description: none,
|
||||
content
|
||||
) = {
|
||||
// format links
|
||||
show link: it => {
|
||||
it.body
|
||||
if type(it.dest) == "string" {
|
||||
if it.dest.starts-with("https://") {
|
||||
footnote[#it.dest.trim("https://", at: start)]
|
||||
}
|
||||
else if it.dest.starts-with("/glossary#") or it.dest.starts-with("/glossary/#") {
|
||||
locate(location => {
|
||||
let elements = query(label(it.dest.trim("/glossary#", at: start).trim("/glossary/#", at: start)), location)
|
||||
text[#super[†]]
|
||||
})
|
||||
}
|
||||
else if it.dest.starts-with("/") {
|
||||
footnote({text[anarsec.guide] + it.dest})
|
||||
}
|
||||
}
|
||||
else if type(it.dest) == "label" {
|
||||
locate(location => {
|
||||
let elements = query(it.dest, location)
|
||||
text[ (#emph(elements.first().body))]
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// format lists
|
||||
set list(marker: ([•], [--]))
|
||||
|
||||
// front cover
|
||||
page()[
|
||||
#set align(center + horizon)
|
||||
|
||||
#image(frontimage)
|
||||
|
||||
#text(25pt, title)
|
||||
]
|
||||
|
||||
// inside cover
|
||||
page()[
|
||||
#set align(center + bottom)
|
||||
|
||||
#text()[This version of the zine was last edited on #lastediteddate. Visit anarsec.guide to see whether it has been updated since.]
|
||||
|
||||
#text()[This dagger symbol #super[†] on a word means that there is a glossary entry for it. Ai ferri corti.]
|
||||
]
|
||||
|
||||
// table of contents
|
||||
page()[
|
||||
#outline(indent: 20pt, depth: 3)
|
||||
]
|
||||
|
||||
// content
|
||||
set page(numbering: "1")
|
||||
set align(left)
|
||||
|
||||
pagebreak(weak: true)
|
||||
|
||||
show heading.where(level: 1): it => {
|
||||
pagebreak(weak: true)
|
||||
block(width: 100%)[
|
||||
#set align(center)
|
||||
#set text(26pt)
|
||||
#smallcaps(it.body)
|
||||
#v(10pt)
|
||||
]
|
||||
}
|
||||
show heading.where(level: 2): it => block(width: 100%)[
|
||||
#set text(19pt)
|
||||
#text(it.body)
|
||||
#v(10pt)
|
||||
]
|
||||
show heading.where(level: 3): it => block(width: 100%)[
|
||||
#set text(14pt, weight: "bold")
|
||||
#text(it.body)
|
||||
#v(10pt)
|
||||
]
|
||||
|
||||
content
|
||||
|
||||
set page(numbering: none)
|
||||
|
||||
// back cover
|
||||
page()[
|
||||
#text()[
|
||||
#set align(center + horizon)
|
||||
|
||||
#block(width: 100%, align(left, par(justify: true, description)))
|
||||
|
||||
#image(height: 250pt, backimage)
|
||||
]
|
||||
]
|
||||
}
|
||||
|
||||
// blockquote function ; TODO: remove when typst has a native blockquote function (see https://github.com/typst/typst/issues/105)
|
||||
#let blockquote(
|
||||
content
|
||||
) = align(center)[
|
||||
#block(width: 92%, fill: rgb(230, 230, 230), radius: 4pt, inset: 8pt)[
|
||||
#align(left)[
|
||||
#text(content)
|
||||
]
|
||||
]
|
||||
]
|
Loading…
Add table
Add a link
Reference in a new issue