Add Rel attr
This commit is contained in:
parent
7290a23c85
commit
ec7bc571b1
2 changed files with 67 additions and 0 deletions
|
|
@ -17,6 +17,10 @@ A dependency update to an incompatible version is considered a breaking change.
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- `html::attr::Rel`
|
||||||
|
|
||||||
## v0.1.2 - 2024-12-14
|
## v0.1.2 - 2024-12-14
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
||||||
|
|
@ -107,6 +107,35 @@ macro_rules! attr_enum {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
(
|
||||||
|
$name:ident as $article:ident $actual:expr, separated by $separator:expr;
|
||||||
|
at $url:expr;
|
||||||
|
$( $valname:ident => $valstr:expr, )*
|
||||||
|
) => {
|
||||||
|
#[doc = concat!("Create (or append to) ", stringify!($article), " `", $actual, "` attribute")]
|
||||||
|
#[doc = concat!("(", $url, ").")]
|
||||||
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
|
pub enum $name {
|
||||||
|
$(
|
||||||
|
#[doc = concat!("The value `", stringify!($valstr), "`.")]
|
||||||
|
$valname,
|
||||||
|
)*
|
||||||
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for $name {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
match self {
|
||||||
|
$( Self::$valname => $valstr.fmt(f), )*
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ElementComponent for $name {
|
||||||
|
fn add_to_element(self, element: &mut Element) {
|
||||||
|
Attr::append($actual, self, $separator).add_to_element(element);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////
|
////////////////
|
||||||
|
|
@ -757,6 +786,40 @@ attr_enum! {
|
||||||
UnsafeUrl => "unsafe-url",
|
UnsafeUrl => "unsafe-url",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
attr_enum! {
|
||||||
|
Rel as a "rel", separated by " ";
|
||||||
|
at url!(normal, "rel");
|
||||||
|
Alternate => "alternate",
|
||||||
|
Author => "author",
|
||||||
|
Bookmark => "bookmark",
|
||||||
|
Canonical => "canonical",
|
||||||
|
DnsPrefetch => "dns-prefetch",
|
||||||
|
External => "external",
|
||||||
|
Expect => "expect",
|
||||||
|
Help => "help",
|
||||||
|
Icon => "icon",
|
||||||
|
License => "license",
|
||||||
|
Manifest => "manifest",
|
||||||
|
Me => "me",
|
||||||
|
Modulepreload => "modulepreload",
|
||||||
|
Next => "next",
|
||||||
|
Nofollow => "nofollow",
|
||||||
|
Noopener => "noopener",
|
||||||
|
Noreferrer => "noreferrer",
|
||||||
|
Opener => "opener",
|
||||||
|
Pingback => "pingback",
|
||||||
|
Preconnect => "preconnect",
|
||||||
|
Prefetch => "prefetch",
|
||||||
|
Preload => "preload",
|
||||||
|
Prerender => "prerender",
|
||||||
|
Prev => "prev",
|
||||||
|
PrivacyPolicy => "privacy-policy",
|
||||||
|
Search => "search",
|
||||||
|
Stylesheet => "stylesheet",
|
||||||
|
Tag => "tag",
|
||||||
|
TermsOfService => "terms-of-service",
|
||||||
|
}
|
||||||
|
|
||||||
attr_append! {
|
attr_append! {
|
||||||
rel as a "rel", separated by " ";
|
rel as a "rel", separated by " ";
|
||||||
at url!(normal, "rel");
|
at url!(normal, "rel");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue