pub enum Type {
Show 25 variants
Presence,
None,
NoneEmpty,
NoneUndefined,
Auto,
TrueFalse,
YesNo,
OnOff,
HorizontalDir,
Str,
Char,
Int,
NonNegativeInt,
PositiveInt,
Float,
PositiveFloat,
Datetime,
Duration,
Color,
IconSize,
ImageCandidate,
SourceSize,
Strings(usize, usize),
Union(&'static [Type]),
List(&'static Type, char, bool),
}Expand description
Defines how an attribute maps to Typst types.
Each variant’s documentation describes which Typst type is accepted and into what kind of HTML attribute string it is converted.
Variants§
Presence
bool → attribute is present or absent.
None
none → "none".
NoneEmpty
none → "".
NoneUndefined
none → "undefined".
Auto
auto → "auto".
TrueFalse
boolean → "true" or "false".
YesNo
boolean → "yes" or "no".
OnOff
boolean → "on" or "off".
HorizontalDir
ltr or rtl → "ltr" or "rtl".
Str
string → string.
Char
char → string.
Int
int → stringified int.
NonNegativeInt
int >= 0 → stringified int.
PositiveInt
int > 0 → stringified int.
Float
float → stringified float.
PositiveFloat
float > 0 → stringified float.
Datetime
datetime → stringified datetime.
Duration
duration → stringified duration.
Color
color → stringified CSS color.
IconSize
array (w, h) of two int >= 0 → "{w}x{h}".
ImageCandidate
dictionary with keys src (string) and optionally width (int) or
density (positive float) → "{src}" plus optionally space-separated
"{width}w" or {density}d.
SourceSize
dictionary with keys condition (string) and size (length) →
"({condition}) {size}"
Strings(usize, usize)
For Strings(a, b), any of the strings in ATTR_STRINGS[a, b] →
string.
Union(&'static [Type])
Any of the listed types → the respective output.
List(&'static Type, char, bool)
An array of the listed type, or, if the bool is true, the listed type itself as a shorthand → a string containing the respective outputs separated by the char.