Add meta title element
This commit is contained in:
parent
4d3e2cc775
commit
5410e73e11
1 changed files with 26 additions and 0 deletions
|
@ -82,3 +82,29 @@ impl<T: AsRef<str>, U: AsRef<str>> Render for Meta<T, U> {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Generate <title> element.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// # #![feature(plugin)]
|
||||
/// # #![plugin(maud_macros)]
|
||||
/// # extern crate maud;
|
||||
/// # extern crate maud_extras;
|
||||
/// # use maud_extras::*;
|
||||
/// # fn main() {
|
||||
/// let markup = html! { (Title("Maud")) };
|
||||
/// assert_eq!(markup.into_string(),
|
||||
/// r#"<title>Maud</title>"#);
|
||||
/// # }
|
||||
/// ```
|
||||
pub struct Title<T: AsRef<str>>(pub T);
|
||||
|
||||
impl<T: AsRef<str>> Render for Title<T> {
|
||||
fn render(&self) -> Markup {
|
||||
html! {
|
||||
title (self.0.as_ref())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue