///|
pub fn BrandBook::render_metadata_panel(self : BrandBook) -> String {
join_lines([
"## Metadata",
"",
"- Name: " + self.name,
"- Tagline: " + self.tagline,
"- Source: " + self.metadata.source,
"- License: " + self.metadata.license,
])
}
///|
pub fn BrandBook::render_voice_section(self : BrandBook) -> String {
join_lines([
"## Voice",
"",
"Tone: " + self.voice.tone,
"",
md_list(self.voice.writing_principles),
])
}
///|
pub fn BrandBook::render_logo_section(self : BrandBook) -> String {
join_lines([
"## Logo Usage",
"",
self.assets.to_asset_index(),
"",
"Imagery style: " + self.assets.imagery_style,
])
}
///|
pub fn BrandBook::render_color_section(self : BrandBook) -> String {
join_lines([
"## Color",
"",
self.palette.to_markdown(),
"",
self.palette.contrast_matrix_markdown(),
])
}
///|
pub fn BrandBook::render_typography_section(self : BrandBook) -> String {
join_lines([
"## Typography",
"",
self.typography.to_markdown(),
"",
self.typography_to_css_notes(),
])
}
///|
fn BrandBook::typography_to_css_notes(self : BrandBook) -> String {
let lines : Array[String] = ["### CSS usage", ""]
for step in self.typography.scale {
lines.push(
"- `--brand-type-" + step.name + "-size`: use for " + step.name + " text.",
)
}
lines.join("\n")
}
///|
pub fn BrandBook::render_component_section(self : BrandBook) -> String {
join_lines(["## Components", "", self.render_component_catalog()])
}
///|
pub fn BrandBook::render_misuse_section(self : BrandBook) -> String {
let lines : Array[String] = ["## Incorrect Usage", ""]
for rule in self.forbidden {
lines.push(rule.to_markdown())
}
lines.join("\n\n")
}
///|
pub fn BrandBook::render_full_markdown(self : BrandBook) -> String {
join_lines([
"# " + self.name,
"",
self.tagline,
"",
self.to_markdown_toc(),
"",
self.render_voice_section(),
"",
self.render_logo_section(),
"",
self.render_color_section(),
"",
self.render_typography_section(),
"",
self.render_component_section(),
"",
self.render_misuse_section(),
"",
self.to_accessibility_markdown(),
"",
self.render_metadata_panel(),
])
}
///|
pub fn BrandBook::render_section(self : BrandBook, section : String) -> String {
match normalize_identifier(section) {
"voice" => self.render_voice_section()
"logo" | "assets" => self.render_logo_section()
"color" | "palette" => self.render_color_section()
"typography" | "type" => self.render_typography_section()
"components" => self.render_component_section()
"incorrect-usage" | "misuse" => self.render_misuse_section()
"accessibility" => self.to_accessibility_markdown()
"metadata" | "source" => self.render_metadata_panel()
_ => "Unknown section: " + section
}
}