Skip to content

Commit c7c4d8e

Browse files
committed
rename *_utf_8 to *_utf8
1 parent 8dc04bb commit c7c4d8e

File tree

4 files changed

+24
-1
lines changed

4 files changed

+24
-1
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,18 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
77

88
## [Unreleased]
99

10+
### Deprecated
11+
12+
* `attr::charset_utf_8()` and `elt::meta_charset_utf_8()`
13+
(renamed to `attr::charset_utf8()` and `elt::meta_charset_utf8()`)
14+
1015
### Added
1116

1217
* `attr::none()` for conditional rendering of an attribute
1318
* implement `Default` for `Element` and `Attribute`
1419
* `attr::disabled()` and `attr::autofocus()`
20+
* `attr::charset_utf8()` and `elt::meta_charset_utf8()`
21+
1522

1623
## [1.4.0] - 2024-12-13
1724

src/attr.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,16 @@ pub fn charset(charset: impl Into<Cow<'static, str>>) -> Attribute {
267267
}
268268

269269
/// Alias for `charset("UTF-8")`
270+
#[deprecated(since = "1.5.0", note = "renamed to 'meta_charset_utf8'")]
270271
pub fn charset_utf_8() -> Attribute {
271272
charset("UTF-8")
272273
}
273274

275+
/// Alias for `charset("UTF-8")`
276+
pub fn charset_utf8() -> Attribute {
277+
charset("UTF-8")
278+
}
279+
274280
/// `name` attribute
275281
pub fn name(name: impl Into<Cow<'static, str>>) -> Attribute {
276282
Attribute::new("name", name)

src/elt.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,17 @@ pub fn meta(attributes: impl IntoIterator<Item = Attribute>) -> Element {
5050
Element::new_void("meta", attributes)
5151
}
5252

53-
/// `<meta name="viewport" content="width=device-width, initial-scale=1.0">`
53+
/// `<meta charset="UFT-8">`
54+
#[deprecated(since = "1.5.0", note = "renamed to 'meta_charset_utf8'")]
5455
pub fn meta_charset_utf_8() -> Element {
5556
raw("<meta charset=\"UTF-8\">")
5657
}
5758

59+
/// `<meta charset="UFT-8">`
60+
pub fn meta_charset_utf8() -> Element {
61+
raw("<meta charset=\"UTF-8\">")
62+
}
63+
5864
/// `<meta name="viewport" content="width=device-width, initial-scale=1.0">`
5965
pub fn meta_viewport() -> Element {
6066
raw("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">")

tests/render_spec.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ fn should_render_html_document() {
6969
#[case(attr::target(AnchorTarget::Parent), "target=\"_parent\"")]
7070
#[case(attr::target(AnchorTarget::Frame("myframe".into())), "target=\"myframe\"")]
7171
#[case(attr::charset("foobar"), "charset=\"foobar\"")]
72+
#[allow(deprecated)]
7273
#[case(attr::charset_utf_8(), "charset=\"UTF-8\"")]
74+
#[case(attr::charset_utf8(), "charset=\"UTF-8\"")]
7375
#[case(attr::name("hello"), "name=\"hello\"")]
7476
#[case(attr::content("bla"), "content=\"bla\"")]
7577
#[case(attr::alt("bla"), "alt=\"bla\"")]
@@ -121,7 +123,9 @@ fn should_render_attribute(#[case] attr: Attribute, #[case] expected: &str) {
121123
#[case(elt::script([("foo", "bar").into()], "alert('hello');"), "<script foo=\"bar\">alert('hello');</script>")]
122124
#[case(elt::script_empty([attr::src("/foo.js")]), "<script src=\"/foo.js\"></script>")]
123125
#[case(elt::meta([("foo", "bar").into()]), "<meta foo=\"bar\">")]
126+
#[allow(deprecated)]
124127
#[case(elt::meta_charset_utf_8(), "<meta charset=\"UTF-8\">")]
128+
#[case(elt::meta_charset_utf8(), "<meta charset=\"UTF-8\">")]
125129
#[case(
126130
elt::meta_viewport(),
127131
"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">"

0 commit comments

Comments
 (0)