Skip to content

Commit 9d12835

Browse files
committed
fix(typst): keep title-only proofs and style the unnumbered prefix
1 parent e9e0ae4 commit 9d12835

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

‎src/resources/filters/customnodes/proof.lua‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,10 @@ end, function(proof_tbl)
168168
elseif _quarto.format.isJatsOutput() then
169169
el = jatsTheorem(el, nil, name )
170170
elseif _quarto.format.isTypstOutput() then
171+
-- a block holding only a title still needs its frame, so that its label
172+
-- exists for references; theorems do the same
171173
if #el.content == 0 then
172-
warn("Proof block has no content; skipping")
173-
return pandoc.Null()
174+
el.content = pandoc.Blocks({pandoc.Para({pandoc.Str '\u{a0}'})})
174175
end
175176
ensure_typst_proofs(proof.env)
176177
local preamble = pandoc.Plain({pandoc.RawInline("typst", "#" .. proof.env .. "(")})
@@ -180,8 +181,8 @@ end, function(proof_tbl)
180181
-- `number: auto`, and its prefix would keep a space before the empty
181182
-- number, so an unnumbered block pins both
182183
preamble.content:insert(pandoc.RawInline("typst",
183-
'number: "", get-prefix: (..args) => ' ..
184-
_quarto.modules.theorems.typst_string(envTitle(proof.env, proof.title))))
184+
'number: "", get-prefix: (..args) => text(weight: "bold", ' ..
185+
_quarto.modules.theorems.typst_string(envTitle(proof.env, proof.title)) .. ')'))
185186
end
186187
if name and #name > 0 then
187188
if not numbered then

‎src/resources/filters/modules/theorems.lua‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ end
103103

104104
local function ensure_frame(env_name, title, render_code)
105105
if typst_theorem_like_frames[env_name] then
106-
return false
106+
return
107107
end
108108

109109
typst_theorem_like_frames[env_name] = true
@@ -116,13 +116,10 @@ local function ensure_frame(env_name, title, render_code)
116116
render_code ..
117117
")")
118118
quarto.doc.include_text("in-header", "#show: show-" .. env_name)
119-
return true
120119
end
121120

122121
return {
123-
appearance = appearance,
124122
ensure_appearance_imports = ensure_appearance_imports,
125-
ensure_simple_render = ensure_simple_render,
126123
ensure_frame = ensure_frame,
127124
render_code = render_code,
128125
typst_string = typst_string,

0 commit comments

Comments
 (0)