File tree Expand file tree Collapse file tree 7 files changed +70
-0
lines changed
tests/docs/smoke-all/brand/test-01 Expand file tree Collapse file tree 7 files changed +70
-0
lines changed Original file line number Diff line number Diff line change @@ -38,11 +38,38 @@ export const defaultColorNames: BrandNamedThemeColor[] = [
3838// "monospace",
3939// ];
4040
41+ type ProcessedBrandData = {
42+ color : Record < string , string > ;
43+ // typography: Record<string, ???>;
44+ // logo: Record<string, string>; // paths
45+ } ;
46+
4147export class Brand {
4248 data : BrandJson ;
49+ processedData : ProcessedBrandData ;
4350
4451 constructor ( readonly brand : BrandJson ) {
4552 this . data = brand ;
53+ this . processedData = this . processData ( brand ) ;
54+ }
55+
56+ processData ( data : BrandJson ) : ProcessedBrandData {
57+ const color : Record < string , string > = { } ;
58+ for ( const colorName of Object . keys ( data . color ?. with ?? { } ) ) {
59+ color [ colorName ] = this . getColor ( colorName ) ;
60+ }
61+ for ( const colorName of Object . keys ( data . color ?? { } ) ) {
62+ if ( colorName === "with" ) {
63+ continue ;
64+ }
65+ color [ colorName ] = this . getColor ( colorName ) ;
66+ }
67+
68+ return {
69+ color,
70+ // typography,
71+ // logo,
72+ } ;
4673 }
4774
4875 // semantics of name resolution for colors, logo and fonts are:
Original file line number Diff line number Diff line change 1+ /.quarto /
Original file line number Diff line number Diff line change 1+ color :
2+ with :
3+ red : " #ff0000"
4+ primary : red
Original file line number Diff line number Diff line change 1+ project :
2+ type : website
3+
4+ website :
5+ title : " test-01"
6+ navbar :
7+ left :
8+ - href : index.qmd
9+ text : Home
10+ - about.qmd
11+
12+ format :
13+ html :
14+ css : styles.css
15+ toc : true
Original file line number Diff line number Diff line change 1+ ---
2+ title : " test-01"
3+ format : dashboard
4+ ---
5+
6+ This is a Quarto website.
7+
8+ To learn more about Quarto websites visit < https://quarto.org/docs/websites > .
Original file line number Diff line number Diff line change 1+ ---
2+ title : " test-01"
3+ filters :
4+ - test_brand.lua
5+ ---
6+
7+ This is a Quarto website.
8+
9+ To learn more about Quarto websites visit < https://quarto.org/docs/websites > .
Original file line number Diff line number Diff line change 1+ local brand = require (" modules/brand/brand" )
2+
3+ function Pandoc (doc )
4+ assert (brand .get_color (" primary" ) == " #FF0000" )
5+ return doc
6+ end
You can’t perform that action at this time.
0 commit comments