+9
-7
@@ -135,12 +135,12 @@ use_civilytics_theme <- function(path = ".", force = FALSE) {
|
||||
.copy_pkg_file(file.path("quarto/latex", f), file.path("latex", f), path, force)
|
||||
}
|
||||
|
||||
# Typst
|
||||
.copy_pkg_file(
|
||||
"quarto/typst/civilytics-typst.typ",
|
||||
"typst/civilytics-typst.typ",
|
||||
path, force
|
||||
)
|
||||
# Typst — shipped as template-partials so Quarto keeps its Skylighting
|
||||
# definitions and syntax-highlighted code blocks render (see issue #12)
|
||||
typst_files <- c("typst-template.typ", "typst-show.typ")
|
||||
for (f in typst_files) {
|
||||
.copy_pkg_file(file.path("quarto/typst", f), file.path("typst", f), path, force)
|
||||
}
|
||||
|
||||
# Logos — for _brand.yml (expects assets/logo/)
|
||||
.copy_logos("assets/logo", path, force)
|
||||
@@ -158,7 +158,9 @@ use_civilytics_theme <- function(path = ".", force = FALSE) {
|
||||
message(" include-in-header: latex/civilytics.tex")
|
||||
message(" include-before-body: latex/civilytics-title.tex")
|
||||
message(" typst:")
|
||||
message(" template: typst/civilytics-typst.typ")
|
||||
message(" template-partials:")
|
||||
message(" - typst/typst-template.typ")
|
||||
message(" - typst/typst-show.typ")
|
||||
message("---")
|
||||
message("\nSee examples/report.qmd for a complete example.")
|
||||
invisible(NULL)
|
||||
|
||||
@@ -19,7 +19,9 @@ format:
|
||||
toc: true
|
||||
toc-location: right
|
||||
typst:
|
||||
template: ../typst/civilytics-typst.typ
|
||||
template-partials:
|
||||
- ../typst/typst-template.typ
|
||||
- ../typst/typst-show.typ
|
||||
pdf:
|
||||
include-in-header: ../latex/civilytics.tex
|
||||
include-before-body: ../latex/civilytics-title.tex
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
// Civilytics — Typst show/entry partial for Quarto (typst-show.typ).
|
||||
// Pairs with typst-template.typ. Quarto appends the rendered document body
|
||||
// after this partial, so this file intentionally ends with the show rule and
|
||||
// no trailing body token. (Do not write that token in a comment here: Quarto
|
||||
// interpolates its template variables even inside comments.)
|
||||
// Title/subtitle/date are wrapped in [ ] so arbitrary text (including words
|
||||
// that are Typst keywords like "for"/"in") is treated as content, not code.
|
||||
// See civilyticsR issue #12.
|
||||
#show: doc => civilytics(
|
||||
title: [$title$],
|
||||
$if(subtitle)$subtitle: [$subtitle$],$endif$
|
||||
$if(by-author)$authors: ($for(by-author)$"$it.name.literal$",$endfor$),$endif$
|
||||
$if(date)$date: [$date$],$endif$
|
||||
$if(abstract)$abstract: [$abstract$],$endif$
|
||||
toc: $if(toc)$true$else$false$endif$,
|
||||
doc
|
||||
)
|
||||
@@ -1,9 +1,15 @@
|
||||
// =============================================================
|
||||
// Civilytics — Typst template for Quarto PDF
|
||||
// Civilytics — Typst template partial for Quarto PDF (typst-template.typ).
|
||||
// Shipped as a Quarto template-partial (paired with typst-show.typ) rather
|
||||
// than a full `template:` so Quarto keeps its own `definitions` partial —
|
||||
// which defines Skylighting/token functions needed for syntax-highlighted
|
||||
// code blocks. See civilyticsR issue #12.
|
||||
// Usage in YAML:
|
||||
// format:
|
||||
// typst:
|
||||
// template: quarto/typst/civilytics-typst.typ
|
||||
// template-partials:
|
||||
// - quarto/typst/typst-template.typ
|
||||
// - quarto/typst/typst-show.typ
|
||||
// =============================================================
|
||||
|
||||
#let paper-bg = rgb("#FAF7F2")
|
||||
@@ -229,19 +235,3 @@
|
||||
|
||||
doc
|
||||
}
|
||||
|
||||
// Quarto entry point
|
||||
// Title/subtitle/date are wrapped in [ ] so arbitrary text (incl. words that
|
||||
// are Typst keywords like "for"/"in") is treated as content, not code.
|
||||
// See civilyticsR issue #12.
|
||||
#show: doc => civilytics(
|
||||
title: [$title$],
|
||||
$if(subtitle)$subtitle: [$subtitle$],$endif$
|
||||
$if(by-author)$authors: ($for(by-author)$"$it.name.literal$",$endfor$),$endif$
|
||||
$if(date)$date: [$date$],$endif$
|
||||
$if(abstract)$abstract: [$abstract$],$endif$
|
||||
toc: $if(toc)$true$else$false$endif$,
|
||||
doc
|
||||
)
|
||||
|
||||
$body$
|
||||
Reference in New Issue
Block a user