aboutsummaryrefslogtreecommitdiff
path: root/src/emitter.rs
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2021-11-30 18:39:22 +0100
committerMartin Fischer <martin@push-f.com>2021-12-05 02:52:36 +0100
commitfff865a98aa288930d6e363f03ad57570e429e92 (patch)
treea0cf87f5cb3eb7d285ea4085a3d322a655b27758 /src/emitter.rs
parent76408590349f7f132c1dfeb9db3fb1dea964227c (diff)
spans: support attribute values
Diffstat (limited to 'src/emitter.rs')
-rw-r--r--src/emitter.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/emitter.rs b/src/emitter.rs
index d37c8f8..1ab01f0 100644
--- a/src/emitter.rs
+++ b/src/emitter.rs
@@ -66,7 +66,7 @@ pub trait Emitter<R> {
/// Emit the _current token_, assuming it is a tag.
///
/// Also get the current attribute and append it to the to-be-emitted tag. See docstring for
- /// [`Emitter::init_attribute`] for how duplicates should be handled.
+ /// [`Emitter::init_attribute_name`] for how duplicates should be handled.
///
/// If a start tag is emitted, update the _last start tag_.
///
@@ -129,7 +129,12 @@ pub trait Emitter<R> {
/// emitted.
///
/// If the current token is no tag at all, this method may panic.
- fn init_attribute(&mut self, reader: &R);
+ fn init_attribute_name(&mut self, reader: &R);
+
+ /// Called before the first push_attribute_value call.
+ ///
+ /// If there is no current attribute, this method may panic.
+ fn init_attribute_value(&mut self, #[allow(unused_variables)] reader: &R) {}
/// Append a string to the current attribute's name.
///
@@ -369,7 +374,7 @@ impl<R> Emitter<R> for DefaultEmitter<R, ()> {
}));
}
- fn init_attribute(&mut self, _reader: &R) {
+ fn init_attribute_name(&mut self, _reader: &R) {
self.flush_current_attribute();
self.current_attribute = Some((String::new(), String::new()));
}