INNER CODE UNIT · Rust

format_localized

str4d/rage · rage/build.rs:44

fn format_localized(content: String) -> Vec<Inline> {
    if let Some((l, r)) = content.split_once(" _") {
        Some(Inline::Roman(l.into()))
            .into_iter()
            .chain(r.split(" _").flat_map(|s| {
                let (l, r) = s
                    .split_once("_ ")
                    .expect("italics should always be terminated");
                [
                    Inline::Roman(" ".into()),
                    Inline::Italic(l.into()),
                    Inline::Roman(format!(" {r}")),
                ]
            }))
            .collect()
    } else {
        vec![Inline::Roman(content)]
    }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…