Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -284,14 +284,17 @@ function render_typst_css_property_processing()
Table = function(tab)
_warnings = new_table()
local tabstyle = tab.attributes['style']
local has_typst_text = false
if tabstyle ~= nil then
for clause in tabstyle:gmatch('([^;]+)') do
local k, v = to_kv(clause)
if k == 'font-family' then
tab.attributes['typst:text:font'] = translate_string_list(v)
has_typst_text = true
end
if k == 'font-size' then
tab.attributes['typst:text:size'] = _quarto.format.typst.css.translate_length(v, _warnings)
has_typst_text = true
end
end
end
Expand All @@ -311,7 +314,13 @@ function render_typst_css_property_processing()
end
aggregate_warnings()
_warnings = nil
return tab
if not has_typst_text then return tab end
-- Create Div wrapper and return false to prevent processing its contents
return pandoc.Div({
pandoc.RawBlock("typst", "#["),
tab,
pandoc.RawBlock("typst", "]")
}), false
end,
Div = function(div)
_warnings = new_table()
Expand Down
2 changes: 1 addition & 1 deletion src/resources/filters/quarto-post/typst.lua
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,4 @@ function render_typst_fixups()
})
end,
}
end
end
23 changes: 23 additions & 0 deletions tests/docs/smoke-all/2024/10/23/spilled-font-size.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
format: typst
_quarto:
tests:
typst:
ensurePdfRegexMatches:
-
- 'Paragraph text before is 11pt'
- 'Paragraph text after is 11pt'
-
- 'Paragraph text after is 6pt'

---

Paragraph text before is `#context text.size`{=typst}.

```{=html}
<table style="font-size: 8px;">
<tr><td>A</td><td>B</td></tr>
</table>
```

Paragraph text after is `#context text.size`{=typst}.
Loading