From 9a91092ce49627dbde52d9ded4538a23fbcfce4c Mon Sep 17 00:00:00 2001 From: Carlos Scheidegger Date: Mon, 28 Oct 2024 10:15:54 -0700 Subject: [PATCH 1/2] lua,brand - support shortcut syntax for typography family declarations --- src/resources/filters/modules/brand/brand.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/resources/filters/modules/brand/brand.lua b/src/resources/filters/modules/brand/brand.lua index ddb2d5b1e71..5e8611e13f0 100644 --- a/src/resources/filters/modules/brand/brand.lua +++ b/src/resources/filters/modules/brand/brand.lua @@ -32,6 +32,9 @@ local function get_typography(fontName) if not brand then return nil end local typography = brand.typography and brand.typography[fontName] if not typography then return nil end + if type(typography) == 'string' then + typography = { family = typography } + end local typsted = {} for k, v in pairs(typography) do if k == 'color' or k == 'background-color' then From a97fcc04173aabb751c0a866bfbbdffc94bfd118 Mon Sep 17 00:00:00 2001 From: Carlos Scheidegger Date: Mon, 28 Oct 2024 10:16:26 -0700 Subject: [PATCH 2/2] regression test --- .../28/brand-typography-family-string/_brand.yml | 11 +++++++++++ .../28/brand-typography-family-string/test.qmd | 16 ++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 tests/docs/smoke-all/2024/10/28/brand-typography-family-string/_brand.yml create mode 100644 tests/docs/smoke-all/2024/10/28/brand-typography-family-string/test.qmd diff --git a/tests/docs/smoke-all/2024/10/28/brand-typography-family-string/_brand.yml b/tests/docs/smoke-all/2024/10/28/brand-typography-family-string/_brand.yml new file mode 100644 index 00000000000..46c12f093b1 --- /dev/null +++ b/tests/docs/smoke-all/2024/10/28/brand-typography-family-string/_brand.yml @@ -0,0 +1,11 @@ +color: + palette: + white: "#eeddcc" + black: "#112233" + foreground: black + background: white +typography: + fonts: + - family: "Roboto Slab" + source: google + base: "Roboto Slab" \ No newline at end of file diff --git a/tests/docs/smoke-all/2024/10/28/brand-typography-family-string/test.qmd b/tests/docs/smoke-all/2024/10/28/brand-typography-family-string/test.qmd new file mode 100644 index 00000000000..5c14fb97e78 --- /dev/null +++ b/tests/docs/smoke-all/2024/10/28/brand-typography-family-string/test.qmd @@ -0,0 +1,16 @@ +--- +format: typst +title: Hello +--- + +## This is a section + +This is a paragraph. + +## This is another section + +This is another paragraph. + +``` +some code. +``` \ No newline at end of file