The words Under construction in black text on a yellow background with diagonal black stipes surrounding it
I'm in the process of moving my site. It's still a work in progress. Please excuse the mess and broken links.

Setup HTML Escaping For Files With A Different Extension In Minijinja

TODO: Pull subtitle into page object

This is a draft with just the code snippet.

More details coming when I can get to them.

Code
use minijinja::AutoEscape;

fn create_env(path: &str) -> Environment<'static> {
    let mut env = Environment::new();
    env.set_source(Source::from_path(path));
    env.set_auto_escape_callback(|name| {
    if matches!(name.rsplit('.').next().unwrap_or(""), "html" | "jinja") {
        AutoEscape::Html
    } else {
        AutoEscape::None
    }
});
    env
}

Debugging Stuff

I'm moving stuff around right now. All this below is helping me figure out where to put stuff

        -- title

Setup HTML Escaping For Files With A Different Extension In Minijinja

-- note

This is a draft with just the code snippet.

More details coming when I can get to them.

-- code
-- rust

use minijinja::AutoEscape;

fn create_env(path: &str) -> Environment<'static> {
    let mut env = Environment::new();
    env.set_source(Source::from_path(path));
    env.set_auto_escape_callback(|name| {
    if matches!(name.rsplit('.').next().unwrap_or(""), "html" | "jinja") {
        AutoEscape::Html
    } else {
        AutoEscape::None
    }
});
    env
}



-- blurb

-- categories
-- Rust 
-- Minijinja
-- Neopolitan

-- metadata
-- date: 2023-04-15 11:50:42
-- id: 2ot9jpkd
-- site: aws
-- type: post
-- status: published