Skip to main content

document_on

Function document_on 

Source
pub fn document_on(
    title: &str,
    root: &[(&str, String)],
    head: Vec<El>,
    body: El,
) -> String
Expand description

A whole page whose root element carries root’s attributes besides its language: the theme contract, where a script written for the site reads it from <html> as the site’s pages carry it.

use majordomus_cli::cockpit::html::{document_on, el};
let page = document_on("t", &[("data-theme-key", "a\"b".into())], vec![], el("body"));
assert!(page.contains("<html lang=\"en\" data-theme-key=\"a&quot;b\">"), "{page}");