Skip to main content

normalize_string_list

Function normalize_string_list 

Source
pub fn normalize_string_list(
    field: &str,
    values: Vec<String>,
) -> Result<Vec<String>, String>
Expand description

Canonicalize a curated string list (keywords, theme) — the write-time gate every card-writing command funnels through (like normalize_extra).

Whitespace is trimmed and duplicates dropped; an entry that is empty after trimming rejects the build loudly (it is always an authoring slip — a stray comma in a hand-written list — and an empty dcat:keyword literal would be projected as agreed-upon nothing). Sorting is canonicalization, not editing: both fields project to unordered repeated RDF properties, so no information is lost — and it keeps the card’s serialization (hence the reproducible content hash) independent of the order the entries were authored in.