From b33da2a8810788bcd0452ae2cfee4d9828b39d99 Mon Sep 17 00:00:00 2001 From: dogeystamp Date: Sun, 23 Jul 2023 20:01:36 -0400 Subject: [PATCH] formatter/typst.py: add placeholder label for section references --- formatter/typst.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/formatter/typst.py b/formatter/typst.py index 044f954..8f3c9c5 100644 --- a/formatter/typst.py +++ b/formatter/typst.py @@ -19,19 +19,21 @@ def format_pdf_link(ref: PDFReference) -> str: format_path = str(ref.filepath.absolute()) params = {} + default_label = "" match ref: case PDFPage(): params["page"] = ref.page case PDFSection(): params["section"] = ref.title + default_label = ref.title case _ as obj: assert_never(obj) if relative: - return f'#lref("{format_path}?{urlencode(params)}", pdfref: true)[]' + return f'#lref("{format_path}?{urlencode(params)}", pdfref: true)[{default_label}]' else: - return f'#link("pdfref://{format_path}?{urlencode(params)}")[]' + return f'#link("pdfref://{format_path}?{urlencode(params)}")[{default_label}]' def ref(ref: Reference) -> str: """Formats a Reference."""