Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions _extensions/naif-report/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# NAIF report Quarto format

This Quarto extension exposes the NAIF Typst report template as the custom format
`naif-report-typst`.

## Use

```yaml
format:
naif-report-typst:
toc: true
number-sections: true
```

Common report metadata:

- `title`
- `subtitle`
- `authors`
- `date`
- `report-version`
- `abstract`
- `keywords`
- `doc-category`
- `compact-mode`
- `logo-path`

Render reports with the repository-managed Quarto command:

```bash
uv run quarto render path/to/report.qmd
```
14 changes: 14 additions & 0 deletions _extensions/naif-report/_extension.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
title: NAIF Report
author: NAIF team
version: "0.1.0"
quarto-required: ">=1.9.18"
contributes:
formats:
typst:
doc-category: "NAIF report"
website: "https://eth-library.github.io/naif/"
toc: true
number-sections: true
template-partials:
- typst-template.typ
- typst-show.typ
Comment on lines +5 to +14
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The extension config contributes settings under formats.typst, but the documentation and example report use the custom format name naif-report-typst. As written, format: naif-report-typst: will not be registered by this extension (unless Quarto implicitly aliases it), so the example render will fail. Align these by either defining the format under formats.naif-report-typst (and inheriting from Typst) or updating the docs/examples to use format: typst:.

Copilot uses AI. Check for mistakes.
70 changes: 70 additions & 0 deletions _extensions/naif-report/typst-show.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#show: doc => naif-report(
$if(doc-category)$
doc-category: [$doc-category$],
$endif$
$if(title)$
title: [$title$],
$endif$
$if(subtitle)$
subtitle: [$subtitle$],
$endif$
$if(by-author)$
authors: (
$for(by-author)$
$if(it.name.literal)$
(
name: [$it.name.literal$],
affiliation: [$for(it.affiliations)$$it.name$$sep$, $endfor$],
email: [$it.email$],
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

email is passed as Typst content (email: [$it.email$]), but the template later uses it in string concatenation ("mailto:" + email). In Typst, content is not a string, so this will likely error at render time. Pass email as a string value instead (e.g. email: "$it.email$") or adjust the template to convert content to a string before concatenation.

Suggested change
email: [$it.email$],
email: "$it.email$",

Copilot uses AI. Check for mistakes.
),
$endif$
$endfor$
),
$endif$
$if(date)$
date: [$date$],
$endif$
$if(report-version)$
version: [$report-version$],
$elseif(version)$
version: [$version$],
$endif$
$if(abstract)$
abstract: [$abstract$],
$endif$
$if(keywords)$
keywords: ($for(keywords)$"$it$"$sep$, $endfor$),
$endif$
$if(lang)$
language: "$lang$",
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The template passes Quarto’s project lang through to Typst (language: "$lang$"). In this repo _quarto.yml sets lang: en-UK, which is a non-standard BCP47 tag (typically en-GB). If Typst validates language tags, this can break rendering. Consider either omitting language unless explicitly set for the report, or normalising common values (e.g. mapping en-UKen-GB).

Suggested change
language: "$lang$",
language: if "$lang$" == "en-UK" { "en-GB" } else { "$lang$" },

Copilot uses AI. Check for mistakes.
$endif$
$if(logo-path)$
logo: image("$logo-path$"),
$endif$
$if(mainfont)$
font-stack: ("$mainfont$", "Barlow", "Inter", "Arial", "Helvetica"),
$endif$
$if(codefont)$
mono-font-stack: ("$codefont$", "Menlo", "DejaVu Sans Mono"),
$endif$
$if(website)$
website: "$website$",
$endif$
$if(toc)$
show-outline: true,
$else$
show-outline: false,
$endif$
$if(compact-mode)$
compact-mode: true,
$else$
compact-mode: false,
$endif$
$if(section-numbering)$
number-headings: true,
heading-numbering: "$section-numbering$",
$else$
number-headings: false,
$endif$
doc,
)
Loading
Loading