diff options
author | Martin Fischer <martin@push-f.com> | 2023-08-16 08:51:29 +0200 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2023-08-19 13:41:55 +0200 |
commit | 0f460c2e77f450a2bac68eec97b2c62aa33c0495 (patch) | |
tree | c3c1592cebd140476fe05add4794548c9435942b /src/emitter.rs | |
parent | a48ddc21a26f394e077e7bd80ef96b2c281e7730 (diff) |
chore: move Attribute to attr module
This is done separately so that the following commit has a cleaner diff.
Diffstat (limited to 'src/emitter.rs')
-rw-r--r-- | src/emitter.rs | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/src/emitter.rs b/src/emitter.rs index fcfb251..d3258e2 100644 --- a/src/emitter.rs +++ b/src/emitter.rs @@ -179,7 +179,7 @@ pub trait Emitter<O> { pub struct DefaultEmitter<O = NoopOffset> { current_characters: String, current_token: Option<Token<O>>, - current_attribute: Option<(String, Attribute<O>)>, + current_attribute: Option<(String, crate::attr::Attribute<O>)>, seen_attributes: BTreeSet<String>, emitted_tokens: VecDeque<Token<O>>, attr_in_end_tag_span: Option<Range<O>>, @@ -380,7 +380,7 @@ impl<O: Offset> Emitter<O> for DefaultEmitter<O> { self.flush_current_attribute(); self.current_attribute = Some(( String::new(), - Attribute { + crate::attr::Attribute { name_span: offset..offset, value: String::new(), value_span: Range::default(), @@ -461,7 +461,7 @@ pub struct StartTag<O> { /// /// Duplicate attributes are ignored after the first one as per WHATWG spec. Implement your own /// [`Emitter`] to tweak this behavior. - pub attributes: BTreeMap<String, Attribute<O>>, + pub attributes: BTreeMap<String, crate::attr::Attribute<O>>, /// The source code span of the tag. pub span: Range<O>, @@ -475,19 +475,6 @@ impl<O: Offset> StartTag<O> { } } -/// A HTML attribute value (plus spans). -#[derive(Debug, Eq, PartialEq)] -pub struct Attribute<O> { - /// The value of the attribute. - pub value: String, - - /// The source code span of the attribute name. - pub name_span: Range<O>, - - /// The source code span of the attribute value. - pub value_span: Range<O>, -} - /// A HTML end/close tag, such as `</p>` or `</a>`. #[derive(Debug, Eq, PartialEq)] pub struct EndTag<O> { |