aboutsummaryrefslogtreecommitdiff
path: root/src/emitter.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/emitter.rs')
-rw-r--r--src/emitter.rs21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/emitter.rs b/src/emitter.rs
index 20bcba4..d37c8f8 100644
--- a/src/emitter.rs
+++ b/src/emitter.rs
@@ -213,7 +213,11 @@ impl<R> DefaultEmitter<R, ()> {
.and_modify(|_| {
error = Some(Error::DuplicateAttribute);
})
- .or_insert(v);
+ .or_insert(Attribute {
+ value: v,
+ name_span: (),
+ value_span: (),
+ });
if let Some(e) = error {
self.emit_error(e);
@@ -444,7 +448,7 @@ pub struct StartTag<S> {
///
/// Duplicate attributes are ignored after the first one as per WHATWG spec. Implement your own
/// [`Emitter`] to tweak this behavior.
- pub attributes: BTreeMap<String, String>,
+ pub attributes: BTreeMap<String, Attribute<S>>,
/// The source code span of the tag name.
pub name_span: S,
@@ -467,6 +471,19 @@ impl<S> StartTag<S> {
}
}
+/// A HTML attribute value (plus spans).
+#[derive(Debug, Default, Eq, PartialEq)]
+pub struct Attribute<S> {
+ /// The value of the attribute.
+ pub value: String,
+
+ /// The source code span of the attribute name.
+ pub name_span: S,
+
+ /// The source code span of the attribute value.
+ pub value_span: S,
+}
+
/// A HTML end/close tag, such as `</p>` or `</a>`.
#[derive(Debug, Default, Eq, PartialEq)]
pub struct EndTag<S> {