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

implement brand yaml logo for dashboard, revealjs #11445

Closed
wants to merge 1 commit 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
38 changes: 38 additions & 0 deletions src/resources/filters/quarto-post/dashboard.lua
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,44 @@ function render_dashboard()
return doc
end
end
}, {
-- todo: dark mode
Meta = function(meta)
local logo = meta.logo
local resolved
if logo then
local which
if pandoc.utils.type(logo) == 'Inlines' then
which = logo[1].text
local brandLogo = _quarto.modules.brand.get_logo(logo[1].text)
resolved = brandLogo and brandLogo.light
elseif type(logo) == 'table' then
local brandLogo = _quarto.modules.brand.get_logo(logo.path[1].text)
if brandLogo then
resolved = brandLogo.light
if logo.alt then
resolved.alt = logo.alt
end
else
resolved = {
path = logo.path,
alt = logo.alt
}
end
end
else
logo = _quarto.modules.brand.get_logo('small')
or _quarto.modules.brand.get_logo('medium')
or _quarto.modules.brand.get_logo('large')
resolved = logo and logo.light
end
if resolved then
meta.logo = resolved.path
meta['logo-alt'] = resolved.alt
end

return meta
end
}
}
end
26 changes: 26 additions & 0 deletions tests/docs/smoke-all/brand/dashboard-logo/choose-logo-resource.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
title: brand and base logo
format:
dashboard: default
brand:
logo:
images:
quarto:
path: quarto.png
alt: quarto logo
posit:
path: posit-logo-2024.svg
alt: posit logo
medium: quarto
large: posit
logo: large
_quarto:
tests:
dashboard:
ensureFileRegexMatches:
-
- '<img src="posit-logo-2024\.svg" alt="posit logo"'
- []
---

{{< lipsum 4 >}}
25 changes: 25 additions & 0 deletions tests/docs/smoke-all/brand/dashboard-logo/default-logo.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
title: brand and base logo
format:
dashboard: default
brand:
logo:
images:
quarto:
path: quarto.png
alt: quarto logo
posit:
path: posit-logo-2024.svg
alt: posit logo
medium: quarto
large: posit
_quarto:
tests:
dashboard:
ensureFileRegexMatches:
-
- '<img src="quarto\.png" alt="quarto logo"'
- []
---

{{< lipsum 4 >}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
title: brand and base logo
format:
dashboard: default
brand:
logo:
images:
quarto:
path: quarto.png
alt: quarto logo
posit:
path: posit-logo-2024.svg
alt: posit logo
medium: quarto
large: posit
logo:
path: posit-logo-2024.svg
alt: posit logo
_quarto:
tests:
dashboard:
ensureFileRegexMatches:
-
- '<img src="posit-logo-2024\.svg" alt="posit logo"'
- []
---

{{< lipsum 4 >}}
26 changes: 26 additions & 0 deletions tests/docs/smoke-all/brand/dashboard-logo/override-logo-path.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
title: brand and base logo
format:
dashboard: default
brand:
logo:
images:
quarto:
path: quarto.png
alt: quarto logo
posit:
path: posit-logo-2024.svg
alt: posit logo
medium: quarto
large: posit
logo: posit-logo-2024.svg
_quarto:
tests:
dashboard:
ensureFileRegexMatches:
-
- '<img src="posit-logo-2024\.svg" alt=""'
- []
---

{{< lipsum 4 >}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
title: brand and base logo
format:
dashboard: default
brand:
logo:
images:
quarto:
path: quarto.png
alt: quarto logo
posit:
path: posit-logo-2024.svg
alt: posit logo
medium: quarto
large: posit
logo:
path: large
alt: logo of posit
_quarto:
tests:
dashboard:
ensureFileRegexMatches:
-
- '<img src="posit-logo-2024\.svg" alt="logo of posit"'
- []
---

{{< lipsum 4 >}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: brand and base logo
format:
dashboard: default
brand:
logo:
images:
quarto:
path: quarto.png
alt: quarto logo
posit:
path: posit-logo-2024.svg
alt: posit logo
medium: quarto
large: posit
logo:
path: large
_quarto:
tests:
dashboard:
ensureFileRegexMatches:
-
- '<img src="posit-logo-2024\.svg" alt="posit logo"'
- []
---

{{< lipsum 4 >}}
17 changes: 17 additions & 0 deletions tests/docs/smoke-all/brand/dashboard-logo/posit-logo-2024.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading