Merge pull request #17 from axodotdev/0.3.0

0.3.0
This commit is contained in:
ashley williams 2023-01-02 14:49:26 -06:00 committed by GitHub
commit f8308cca78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 141 additions and 17 deletions

View File

@ -1,5 +1,45 @@
# Changelog # Changelog
## 0.3.0 - 2023-01-02
### 🎁 Features
- **✨ More robust `aria` type checking - [SaraVieira], [I2]/[PR12], [I3]/[PR11]**
`aria-sort` and `aria-orientation` now offer more robust type checking following the guidelines of MDN you can see in their pages:
- [`aria-sort`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-sort)
- [`aria-orientation`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-orientation)
[I2]: https://github.com/axodotdev/axohtml/issues/2
[PR12]: https://github.com/axodotdev/axohtml/pull/12
[I3]: https://github.com/axodotdev/axohtml/issues/3
[PR11]: https://github.com/axodotdev/axohtml/pull/11
- **✨ Add twitter SEO tag support - [SaraVieira], [PR17]**
Add support for meta tags used for twitter cards as showed in [their docs](https://developer.twitter.com/en/docs/twitter-for-websites/cards/overview/markup)
[PR17]: https://github.com/axodotdev/axohtml/pull/17
### 🛠️ Fixes
- **✨ Data Attributes now work with more than one hyphen - [SaraVieira], [PR10]**
Our support for `data` attributes was limited in the way that it only supported one hyphen in said attributes, well, no more, use as many hyphens as your heart pleases
[PR10]: https://github.com/axodotdev/axohtml/pull/10
- **✨ Allow `script` tags in HTML - [SaraVieira], [PR10]**
We now allow you to add script tags in the HTML after the body as the HTML standards also allow
- **✨ Allow unescaped text in`script`- [SaraVieira], [PR14]**
Until now we were escaping the text passed down to the `script` tag and in the `script` tag is the only place we are sure we don't want to escape that so that's fixed and you can add `script` tags with unescaped text inside
[PR14]: https://github.com/axodotdev/axohtml/pull/14
## 0.2.0 - 2022-12-19 ## 0.2.0 - 2022-12-19
### 🎁 Features ### 🎁 Features
@ -20,15 +60,15 @@
If you ask the internet why `meta` tags have a `property` attribute that If you ask the internet why `meta` tags have a `property` attribute that
isn't in the spec, you won't get great answers. Although not formally isn't in the spec, you won't get great answers. Although not formally
specified in HTML5, `property` attributes in `meta` tags are important for specified in HTML5, `property` attributes in `meta` tags are important for
SEO and [the Open Graph Protocol]. They *are* documented in [RDFa] which is SEO and [the Open Graph Protocol]. They _are_ documented in [RDFa] which is
a formal W3C recommendation. a formal W3C recommendation.
It is outside the scope of this project to standardize standards bodies. We It is outside the scope of this project to standardize standards bodies. We
needed to support the `property` attribute, and so we did. needed to support the `property` attribute, and so we did.
[SaraVieira]: https://github.com/SaraVieira [saravieira]: https://github.com/SaraVieira
[the Open Graph Protocol]: https://ogp.me/ [the open graph protocol]: https://ogp.me/
[RDFa]: https://en.wikipedia.org/wiki/RDFa [rdfa]: https://en.wikipedia.org/wiki/RDFa
## 0.1.0 - 2022-12-16 ## 0.1.0 - 2022-12-16

View File

@ -1,6 +1,6 @@
[package] [package]
name = "axohtml-macros" name = "axohtml-macros"
version = "0.2.0" version = "0.3.0"
edition = "2018" edition = "2018"
authors = ["Axo Developer Co <hello@axo.dev>", "Bodil Stokke <bodil@bodil.org>"] authors = ["Axo Developer Co <hello@axo.dev>", "Bodil Stokke <bodil@bodil.org>"]
build = "build.rs" build = "build.rs"

View File

@ -1,6 +1,6 @@
[package] [package]
name = "axohtml" name = "axohtml"
version = "0.2.0" version = "0.3.0"
edition = "2021" edition = "2021"
authors = ["Axo Developer Co <hello@axo.dev>", "Bodil Stokke <bodil@bodil.org>"] authors = ["Axo Developer Co <hello@axo.dev>", "Bodil Stokke <bodil@bodil.org>"]
license = "MPL-2.0+" license = "MPL-2.0+"

View File

@ -499,3 +499,16 @@ fn test_js() {
assert_eq!("<script>console.log('sup')</script>", frag.to_string()); assert_eq!("<script>console.log('sup')</script>", frag.to_string());
} }
#[test]
fn test_twitter_cards() {
use crate as axohtml;
use crate::{dom::DOMTree, html};
let frag: DOMTree<String> = html!(<meta name="twitter:card" content="summary_large_image"/>);
assert_eq!(
"<meta content=\"summary_large_image\" name=\"twitter:card\"/>",
frag.to_string()
);
}

View File

@ -252,6 +252,53 @@ pub enum Metadata {
Robots, Robots,
#[strum(to_string = "viewport")] #[strum(to_string = "viewport")]
Viewport, Viewport,
// Twitter Social meta card tags -> https://developer.twitter.com/en/docs/twitter-for-websites/cards/overview/markup
#[strum(to_string = "twitter:card")]
TwitterCard,
#[strum(to_string = "twitter:site:id")]
TwitterSiteId,
#[strum(to_string = "twitter:site")]
TwitterSite,
#[strum(to_string = "twitter:creator:id")]
TwitterCreatorId,
#[strum(to_string = "twitter:creator")]
TwitterCreator,
#[strum(to_string = "twitter:description")]
TwitterDescription,
#[strum(to_string = "twitter:title")]
TwitterTitle,
#[strum(to_string = "twitter:image:alt")]
TwitterImageAlt,
#[strum(to_string = "twitter:image")]
TwitterImage,
#[strum(to_string = "twitter:player:width")]
TwitterPlayerWidth,
#[strum(to_string = "twitter:player:height")]
TwitterPlayerHeight,
#[strum(to_string = "twitter:player:stream")]
TwitterPlayerStream,
#[strum(to_string = "twitter:player")]
TwitterPlayer,
#[strum(to_string = "twitter:app:name:phone")]
TwitterAppNamePhone,
#[strum(to_string = "twitter:app:name:iphone")]
TwitterAppNameIphone,
#[strum(to_string = "twitter:app:id:iphone")]
TwitterAppIdIphone,
#[strum(to_string = "twitter:app:url:iphone")]
TwitterAppUrlIphone,
#[strum(to_string = "twitter:app:name:ipad")]
TwitterAppNameIpad,
#[strum(to_string = "twitter:app:id:ipad")]
TwitterAppIdIpad,
#[strum(to_string = "twitter:app:url:ipad")]
TwitterAppUrlIpad,
#[strum(to_string = "twitter:app:name:googleplay")]
TwitterAppNameGooglePlay,
#[strum(to_string = "twitter:app:id:googleplay")]
TwitterAppIdGooglePlay,
#[strum(to_string = "twitter:app:url:googleplay")]
TwitterAppUrlGooglePlay,
} }
#[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, IntoStaticStr)] #[derive(EnumString, Display, PartialEq, Eq, PartialOrd, Ord, AsRefStr, IntoStaticStr)]
@ -262,10 +309,24 @@ pub enum MetadataProperties {
Type, Type,
#[strum(to_string = "og:image")] #[strum(to_string = "og:image")]
Image, Image,
#[strum(to_string = "og:image:alt")]
ImageAlt,
#[strum(to_string = "og:image:type")]
ImageType,
#[strum(to_string = "og:image:width")]
ImageWidth,
#[strum(to_string = "og:image:height")]
ImageHeight,
#[strum(to_string = "og:image:secure_url")]
ImageSecureUrl,
#[strum(to_string = "og:url")] #[strum(to_string = "og:url")]
Homepage, Homepage,
#[strum(to_string = "og:audio")] #[strum(to_string = "og:audio")]
Audio, Audio,
#[strum(to_string = "og:audio:type")]
AudioType,
#[strum(to_string = "og:audio:secure_url")]
AudioSecureUrl,
#[strum(to_string = "og:description")] #[strum(to_string = "og:description")]
Description, Description,
#[strum(to_string = "og:determiner")] #[strum(to_string = "og:determiner")]
@ -276,6 +337,16 @@ pub enum MetadataProperties {
ParentSiteName, ParentSiteName,
#[strum(to_string = "og:video")] #[strum(to_string = "og:video")]
Video, Video,
#[strum(to_string = "og:video:alt")]
VideoAlt,
#[strum(to_string = "og:video:type")]
VideoType,
#[strum(to_string = "og:video:width")]
VideoWidth,
#[strum(to_string = "og:video:height")]
VideoHeight,
#[strum(to_string = "og:video:secure_url")]
VideoSecureUrl,
#[strum(to_string = "og:locale:alternate")] #[strum(to_string = "og:locale:alternate")]
ExtraLocales, ExtraLocales,
} }