Skip to content

Commit

Permalink
add hgroup
Browse files Browse the repository at this point in the history
fix #14
  • Loading branch information
jcornaz committed Dec 21, 2024
1 parent 2884727 commit 5585dc0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

* `attr::style` attribute
* `attr::minlength_u16` and `attr::maxlength_u16` attributes
* `elt::hgroup` element


## [1.5.0] - 2024-12-16
Expand Down
8 changes: 8 additions & 0 deletions src/elt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,14 @@ pub fn body(
Element::new("body", attributes, children)
}

/// `<hgroup>`
pub fn hgroup(
attributes: impl IntoIterator<Item = Attribute>,
children: impl IntoIterator<Item = Element>,
) -> Element {
Element::new("hgroup", attributes, children)
}

/// `<h1>`
pub fn h1(
attributes: impl IntoIterator<Item = Attribute>,
Expand Down
1 change: 1 addition & 0 deletions tests/render_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ fn should_render_attribute(#[case] attr: Attribute, #[case] expected: &str) {
#[case(elt::head([attr::id("foo")], [elt::text("hello")]), "<head id=\"foo\">hello</head>")]
#[case(elt::title([("foo", "bar").into()], "hello"), "<title foo=\"bar\">hello</title>")]
#[case(elt::body([attr::id("foo")], [elt::text("hello")]), "<body id=\"foo\">hello</body>")]
#[case(elt::hgroup([attr::id("foo")], [elt::text("hello")]), "<hgroup id=\"foo\">hello</hgroup>")]
#[case(elt::h1([attr::id("foo")], [elt::text("hello")]), "<h1 id=\"foo\">hello</h1>")]
#[case(elt::h2([attr::id("foo")], [elt::text("hello")]), "<h2 id=\"foo\">hello</h2>")]
#[case(elt::h3([attr::id("foo")], [elt::text("hello")]), "<h3 id=\"foo\">hello</h3>")]
Expand Down

0 comments on commit 5585dc0

Please sign in to comment.