diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a5c9f9..8a43da7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,11 +7,18 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] +### Deprecated + +* `attr::charset_utf_8()` and `elt::meta_charset_utf_8()` + (renamed to `attr::charset_utf8()` and `elt::meta_charset_utf8()`) + ### Added * `attr::none()` for conditional rendering of an attribute * implement `Default` for `Element` and `Attribute` * `attr::disabled()` and `attr::autofocus()` +* `attr::charset_utf8()` and `elt::meta_charset_utf8()` + ## [1.4.0] - 2024-12-13 diff --git a/src/attr.rs b/src/attr.rs index a31f44b..f7d0428 100644 --- a/src/attr.rs +++ b/src/attr.rs @@ -267,10 +267,16 @@ pub fn charset(charset: impl Into>) -> Attribute { } /// Alias for `charset("UTF-8")` +#[deprecated(since = "1.5.0", note = "renamed to 'meta_charset_utf8'")] pub fn charset_utf_8() -> Attribute { charset("UTF-8") } +/// Alias for `charset("UTF-8")` +pub fn charset_utf8() -> Attribute { + charset("UTF-8") +} + /// `name` attribute pub fn name(name: impl Into>) -> Attribute { Attribute::new("name", name) diff --git a/src/elt.rs b/src/elt.rs index 9a4ac1a..c6860fb 100644 --- a/src/elt.rs +++ b/src/elt.rs @@ -50,11 +50,17 @@ pub fn meta(attributes: impl IntoIterator) -> Element { Element::new_void("meta", attributes) } -/// `` +/// `` +#[deprecated(since = "1.5.0", note = "renamed to 'meta_charset_utf8'")] pub fn meta_charset_utf_8() -> Element { raw("") } +/// `` +pub fn meta_charset_utf8() -> Element { + raw("") +} + /// `` pub fn meta_viewport() -> Element { raw("") diff --git a/tests/render_spec.rs b/tests/render_spec.rs index fcf69d7..abc25f0 100644 --- a/tests/render_spec.rs +++ b/tests/render_spec.rs @@ -69,7 +69,9 @@ fn should_render_html_document() { #[case(attr::target(AnchorTarget::Parent), "target=\"_parent\"")] #[case(attr::target(AnchorTarget::Frame("myframe".into())), "target=\"myframe\"")] #[case(attr::charset("foobar"), "charset=\"foobar\"")] +#[allow(deprecated)] #[case(attr::charset_utf_8(), "charset=\"UTF-8\"")] +#[case(attr::charset_utf8(), "charset=\"UTF-8\"")] #[case(attr::name("hello"), "name=\"hello\"")] #[case(attr::content("bla"), "content=\"bla\"")] #[case(attr::alt("bla"), "alt=\"bla\"")] @@ -121,7 +123,9 @@ fn should_render_attribute(#[case] attr: Attribute, #[case] expected: &str) { #[case(elt::script([("foo", "bar").into()], "alert('hello');"), "")] #[case(elt::script_empty([attr::src("/foo.js")]), "")] #[case(elt::meta([("foo", "bar").into()]), "")] +#[allow(deprecated)] #[case(elt::meta_charset_utf_8(), "")] +#[case(elt::meta_charset_utf8(), "")] #[case( elt::meta_viewport(), ""