Skip to content

Commit

Permalink
Add an argument to TSpan
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanUkhov committed Feb 23, 2024
1 parent 73333f9 commit d225096
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/node/element/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,6 @@ implement! {
#[doc = "A [`textPath`](https://www.w3.org/TR/SVG/text.html#TextPathElement) element."]
struct TextPath

#[doc = "A [`tspan`](https://www.w3.org/TR/SVG/text.html#TextElement) element."]
struct TSpan

#[doc = "A [`use`](https://www.w3.org/TR/SVG/struct.html#UseElement) element."]
struct Use
}
Expand Down Expand Up @@ -373,7 +370,7 @@ macro_rules! implement {

implement! {
#[doc = "A [`text`](https://www.w3.org/TR/SVG/text.html#TextElement) element."]
struct Text [] [T: Into<String>] [inner, content: T] {
struct Text [is_bareable] [T: Into<String>] [inner, content: T] {
inner.append(crate::node::Text::new(content));
}

Expand All @@ -382,6 +379,11 @@ implement! {
inner.append(crate::node::Text::new(content));
}

#[doc = "A [`tspan`](https://www.w3.org/TR/SVG/text.html#TextElement) element."]
struct TSpan [] [T: Into<String>] [inner, content: T] {
inner.append(crate::node::Text::new(content));
}

#[doc = "An [`svg`](https://www.w3.org/TR/SVG/struct.html#SVGElement) element."]
struct SVG [is_bareable] [] [inner] {
inner.assign("xmlns", "http://www.w3.org/2000/svg");
Expand Down Expand Up @@ -421,11 +423,11 @@ mod tests {

assert_eq!(
one.to_string(),
"<g>\n<text>foo</text>\n<text>bar</text>\n</g>",
"<g>\n<text>\nfoo\n</text>\n<text>\nbar\n</text>\n</g>",
);
assert_eq!(
two.to_string(),
"<g>\n<text>foo</text>\n<text>buz</text>\n</g>",
"<g>\n<text>\nfoo\n</text>\n<text>\nbuz\n</text>\n</g>",
);
}

Expand Down

0 comments on commit d225096

Please sign in to comment.