Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i18n for typst #9829

Closed
wants to merge 5 commits into from
Closed
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
2 changes: 1 addition & 1 deletion src/resources/filters/customnodes/floatreftarget.lua
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,7 @@ end, function(float)
-- luacov: enable
end
local kind = "quarto-float-" .. ref
local supplement = info.name
local supplement = titleString('fig', info.name)
-- FIXME: custom numbering doesn't work yet
-- local numbering = ""
-- if float.parent_id then
Expand Down
2 changes: 1 addition & 1 deletion src/resources/filters/customnodes/theorem.lua
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ local function ensure_typst_theorems(reftype)
letted_typst_theorem[reftype] = true
local theorem_type = theorem_types[reftype]
quarto.doc.include_text("in-header", "#let " .. theorem_type.env .. " = thmbox(\"" ..
theorem_type.env .. "\", \"" .. theorem_type.title .. "\")")
theorem_type.env .. "\", \"" .. titleString(reftype, theorem_type.title) .. "\")")
end
end

Expand Down
2 changes: 1 addition & 1 deletion src/resources/filters/layout/pandoc3_figure.lua
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ function render_pandoc3_figure()
caption = figure.caption.long[1],
kind = "quarto-float-fig",
caption_location = crossref.categories.by_ref_type["fig"].caption_location,
supplement = "Figure",
supplement = titleString('fig', 'Figure'),
})
end
}
Expand Down
6 changes: 3 additions & 3 deletions src/resources/filters/layout/typst.lua
Copy link
Contributor Author

Choose a reason for hiding this comment

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

commit message is incorrect, this affects the parent title of a panel with non-cross-referenceable figures (that are nevertheless rendered as cross-referenced, with counter continuing in them)

Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ end, function(layout)
return float.content
-- luacov: enable
end
local supplement = info.name
local supplement = titleString(ref, info.name)

-- typst output currently only supports a single grid
-- as output, so no rows of varying columns, etc.
Expand Down Expand Up @@ -133,12 +133,12 @@ end, function(layout)
_quarto.format.typst.as_typst_content(cells)
}, false))
else
result:insert(make_typst_figure {
result:extend(make_typst_figure {
content = cells,
caption_location = caption_location,
caption = layout.float.caption_long,
kind = kind,
supplement = info.prefix,
supplement = titleString(ref, info.prefix),
numbering = info.numbering,
identifier = layout.float.identifier
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@

if abstract != none {
block(inset: 2em)[
#text(weight: "semibold")[Abstract] #h(1em) #abstract
#text(weight: "semibold")[$labels.abstract$] #h(1em) #abstract
]
}

Expand Down
56 changes: 56 additions & 0 deletions tests/docs/smoke-all/typst/typst-i18n.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
title: "Typst internationalization"
lang: es
abstract: Escribo algo.
format:
typst:
keep-typ: true
_quarto:
tests:
typst:
ensureTypstFileRegexMatches:
- ['Resumen', 'Nota', 'Conjetura']
- []
ensurePdfRegexMatches:
- ['Figura 1', 'Figura 2', 'Figura 3', 'Figura 4', 'Figura 5', 'Figura 6']
- ['Figure 1', 'Figure 2', 'Figure 3', 'Figure 4', 'Figure 5', 'Figure 6']
---

![Marcador]({{< placeholder 300 >}}){#fig-marcador}

![Marcador desconocido]({{< placeholder 300 >}})

::: {#fig-panel layout-ncol=2}

![Marcador]({{< placeholder 200 >}}){#fig-layout-a}

![Marcador]({{< placeholder 200 >}}){#fig-layout-b}

Panels

:::

::: {#fig-panel2 layout-ncol=2}

![Marcador]({{< placeholder 200 >}})

![Marcador]({{< placeholder 200 >}})

Panels

:::


::: {.callout-note}

Información

:::

::: {#cnj-redondo}

# Redondo

El mundo es redondo.

:::
Loading