feat: let a site render its xhtmlmp/html output as a Mews Profile page
A new mews_profile site setting switches the XHTML-MP 1.2 doctype, the conformance marker, the viewport tag and the default stylesheet link, and drops raw HTML passthrough and off-site or data: images that the profile's permitted-element list cannot vouch for.
This commit is contained in:
parent
1b47145522
commit
c9bde15f5c
9 changed files with 357 additions and 70 deletions
|
|
@ -58,7 +58,8 @@ mod tests {
|
|||
/// assertions read as the content itself.
|
||||
fn render_with(settings: &PageSettings, width: u16, markdown: &str) -> String {
|
||||
let doc = parse::markdown(markdown).unwrap();
|
||||
let ctx = RenderCtx { url: "/x", title: "T", settings, width: Some(width) };
|
||||
let ctx =
|
||||
RenderCtx { url: "/x", title: "T", settings, width: Some(width), mews_hosts: None };
|
||||
String::from_utf8(Text.render(&doc, &ctx).unwrap().body).unwrap()
|
||||
}
|
||||
|
||||
|
|
@ -213,7 +214,8 @@ mod tests {
|
|||
/// `parse::document`, which needs a file, so the unit tests build them.
|
||||
fn render_blocks(settings: &PageSettings, width: u16, blocks: Vec<Block>) -> String {
|
||||
let doc = Doc { blocks, first_h1: None };
|
||||
let ctx = RenderCtx { url: "/x", title: "T", settings, width: Some(width) };
|
||||
let ctx =
|
||||
RenderCtx { url: "/x", title: "T", settings, width: Some(width), mews_hosts: None };
|
||||
String::from_utf8(Text.render(&doc, &ctx).unwrap().body).unwrap()
|
||||
}
|
||||
|
||||
|
|
@ -267,7 +269,13 @@ mod separation_tests {
|
|||
fn render(markdown: &str) -> String {
|
||||
let doc = parse::markdown(markdown).unwrap();
|
||||
let settings = PageSettings { margin_left: 0, margin_right: 0, ..Default::default() };
|
||||
let ctx = RenderCtx { url: "/x", title: "T", settings: &settings, width: Some(40) };
|
||||
let ctx = RenderCtx {
|
||||
url: "/x",
|
||||
title: "T",
|
||||
settings: &settings,
|
||||
width: Some(40),
|
||||
mews_hosts: None,
|
||||
};
|
||||
String::from_utf8(Text.render(&doc, &ctx).unwrap().body).unwrap()
|
||||
}
|
||||
|
||||
|
|
@ -299,7 +307,8 @@ mod optional_feature_tests {
|
|||
|
||||
fn render_with(settings: &PageSettings, width: u16, markdown: &str) -> String {
|
||||
let doc = parse::markdown(markdown).unwrap();
|
||||
let ctx = RenderCtx { url: "/x", title: "T", settings, width: Some(width) };
|
||||
let ctx =
|
||||
RenderCtx { url: "/x", title: "T", settings, width: Some(width), mews_hosts: None };
|
||||
String::from_utf8(Text.render(&doc, &ctx).unwrap().body).unwrap()
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue