Skip to main content

substitute

Function substitute 

Source
pub fn substitute(
    template: &str,
    section: impl Fn(&str) -> Option<String>,
) -> String
Expand description

Fill a template in, asking section for each name it holds.

A placeholder naming no section is left exactly as it was written: the vocabulary is checked where a spec is read, so one arriving here is text an author meant literally.

Every section a template names is optional in practice — most commands have no arguments, most have no examples — so a template is written with the separators a full page wants and the empty sections are what [collapse_blank_runs] then takes back out.