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
63
64
65
//! hemplate: facade crate for the hemplate template language.
//!
//! `hemplate-runtime` is always available. The default `host` feature exposes
//! AST/build APIs, while the independent `derive` feature exposes
//! `#[derive(Hemplate)]`. Constrained targets can disable defaults and enable
//! only `derive`, keeping parser and Tree-sitter dependencies host-only.
//!
//! Dynamic native HTML Boolean attributes require a `bool`: false omits the
//! attribute, true emits its name. Strings such as `"false"` are not accepted.
//! Global HTML Booleans also apply to custom and unknown HTML elements.
//!
//! HTML `+hidden` is different: it binds an enumerated attribute using
//! [`HiddenAttribute`]. Boolean false omits it, true emits its name, and string
//! states (including `"until-found"` and `"false"`) remain escaped values.
//! References forward these semantics. Generic templates must require
//! `HiddenAttribute`, not just `Display`. Foreign content keeps ordinary escaped
//! value interpolation; ambiguous namespaces reject Boolean and `+hidden`
//! bindings. Use ordinary `hidden="{+ value +}"` for purely textual values there.
//!
//! Escaping protects text, not attributes the browser reads as code. A plain
//! value interpolated into `on*`, `style`, `srcdoc`, a script or stylesheet URL,
//! or as the whole value of a URL attribute does not compile; use
//! [`Url::parse`], a type implementing the context's trait ([`UrlValue`],
//! [`ScriptValue`], ...), or an explicit [`Trusted`] value. Fixed text that
//! settles a URL's destination (`href="/users/{+ id +}"`) takes plain values.
//! See the repository README, "Untrusted values and attribute contexts".
//!
//! ```compile_fail
//! use hemplate::Hemplate;
//! // templates/boolean_attrs.heml includes <input +checked="self.enabled">.
//! #[derive(Hemplate)]
//! struct BooleanAttrs {
//! enabled: &'static str,
//! value: &'static str,
//! hidden: bool,
//! }
//! impl BooleanAttrs {
//! fn next_hidden(&self) -> &bool { &self.hidden }
//! }
//! ```
//!
//! A generic `Display` bound cannot silently stringify a Boolean hidden value:
//!
//! ```compile_fail,E0277
//! use hemplate::{HiddenAttribute, HiddenValue};
//! fn hidden_state<T: core::fmt::Display>(value: &T) -> HiddenValue<'_> {
//! HiddenAttribute::hidden_value(value)
//! }
//! ```
/// Stable runtime path used by derive-generated code.
pub use *;
pub use ;
pub use Hemplate;