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
|
|
@ -295,7 +295,8 @@ mod tests_support {
|
|||
pub fn render(markdown: &str) -> String {
|
||||
let doc = parse::markdown(markdown).unwrap();
|
||||
let settings = PageSettings::default();
|
||||
let ctx = RenderCtx { url: "/x", title: "T", settings: &settings, width: None };
|
||||
let ctx =
|
||||
RenderCtx { url: "/x", title: "T", settings: &settings, width: None, mews_hosts: None };
|
||||
let out = Gemtext.render(&doc, &ctx).unwrap();
|
||||
String::from_utf8(out.body).unwrap()
|
||||
}
|
||||
|
|
@ -398,7 +399,8 @@ mod tests {
|
|||
// Pagination is a WML concern; a Gemini client scrolls one document.
|
||||
let doc = parse::markdown("a\n\nb\n").unwrap();
|
||||
let settings = PageSettings::default();
|
||||
let ctx = RenderCtx { url: "/x", title: "T", settings: &settings, width: None };
|
||||
let ctx =
|
||||
RenderCtx { url: "/x", title: "T", settings: &settings, width: None, mews_hosts: None };
|
||||
let plain = String::from_utf8(Gemtext.render(&doc, &ctx).unwrap().body).unwrap();
|
||||
assert_eq!(plain, "a\n\nb\n");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue