aboutsummaryrefslogtreecommitdiff
path: root/src/emitter.rs
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2021-12-03 09:47:09 +0100
committerMartin Fischer <martin@push-f.com>2021-12-05 02:52:36 +0100
commit9f2b33c046b859007bba854b7a39f5110ab8dac3 (patch)
tree4648e59943e0bf32773aa5d4e0b1211e8039f886 /src/emitter.rs
parentf9639d724e1a6f1e8edaeafa78c2c3d8b43640a3 (diff)
spans: slightly refactor DefaultEmitter
Diffstat (limited to 'src/emitter.rs')
-rw-r--r--src/emitter.rs12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/emitter.rs b/src/emitter.rs
index b47dc20..8f9e56d 100644
--- a/src/emitter.rs
+++ b/src/emitter.rs
@@ -184,7 +184,7 @@ pub struct DefaultEmitter<R, S> {
current_characters: String,
current_token: Option<Token<S>>,
last_start_tag: String,
- current_attribute: Option<(String, String)>,
+ current_attribute: Option<(String, Attribute<S>)>,
seen_attributes: BTreeSet<String>,
emitted_tokens: VecDeque<Token<S>>,
reader: PhantomData<R>,
@@ -220,11 +220,7 @@ impl<R> DefaultEmitter<R, ()> {
.and_modify(|_| {
error = Some(Error::DuplicateAttribute);
})
- .or_insert(Attribute {
- value: v,
- name_span: (),
- value_span: (),
- });
+ .or_insert(v);
if let Some(e) = error {
self.emit_error(e);
@@ -383,13 +379,13 @@ impl<R> Emitter<R> for DefaultEmitter<R, ()> {
fn init_attribute_name(&mut self, _reader: &R) {
self.flush_current_attribute();
- self.current_attribute = Some((String::new(), String::new()));
+ self.current_attribute = Some((String::new(), Attribute::default()));
}
fn push_attribute_name(&mut self, s: &str) {
self.current_attribute.as_mut().unwrap().0.push_str(s);
}
fn push_attribute_value(&mut self, s: &str) {
- self.current_attribute.as_mut().unwrap().1.push_str(s);
+ self.current_attribute.as_mut().unwrap().1.value.push_str(s);
}
fn set_doctype_public_identifier(&mut self, value: &str) {
if let Some(Token::Doctype(Doctype {