1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//! Render an iterator of values as a separated (e.g. comma-separated) list,
//! without the element type having to know anything about HTML.
use ;
use ;
/// Render the items of `iter` into HTML, separated by `sep`.
///
/// Each item is rendered through its [`Display`](std::fmt::Display) impl and
/// HTML-escaped, so the element type only needs `Display` — it does **not**
/// need to implement [`IntoHtml`]. The separator is written verbatim: it is
/// treated as trusted, developer-provided structure, exactly like the static
/// parts of a template (so the *data* is escaped, the *structure* is not).
///
/// This is the idiomatic way to build a CSV-style attribute value (or body)
/// straight from an iterator, instead of pre-joining into a `String`:
///
/// ```ignore
/// use rama_http::protocols::html::*;
///
/// // any `Display` iterator works; here: a list of language tags
/// let langs = ["en", "fr", "de"];
/// let tag = meta!("http-equiv" = "Content-Language", content = join_display(langs, ", "));
/// assert_eq!(
/// tag.into_string(),
/// r#"<meta http-equiv="Content-Language" content="en, fr, de">"#,
/// );
/// ```
/// A [`fmt::Write`] that HTML-escapes everything written through it into the
/// wrapped buffer. Escaping per write is correct because every escapable byte
/// is a single ASCII byte, so chunk boundaries never split one.
;