Skip to content

Commit

Permalink
Update to rustc 1.21.0-nightly (f25c2283b 2017-08-15)
Browse files Browse the repository at this point in the history
Closes #99
  • Loading branch information
lambda-fairy authored and ernestas-poskus committed Aug 23, 2017
1 parent 594af15 commit 3269d7b
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
## [Unreleased]

- [Fixed] Allow braces in the boolean expression for a toggled class
- [Fixed] Update to rustc 1.21.0-nightly (f25c2283b 2017-08-15)
[#99](https://github.com/lfairy/maud/issues/99)

## [0.17.1] - 2017-08-11

Expand Down
31 changes: 31 additions & 0 deletions maud_extras/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,34 @@ impl<T: AsRef<str>, U: AsRef<str>> Render for MetaProperty<T, U> {
}
}
}

/// Generate a `<meta robots>` element.
///
/// # Example
///
/// ```rust
/// # #![feature(proc_macro)]
/// # extern crate maud;
/// # extern crate maud_extras;
/// # use maud::html;
/// # use maud_extras::*;
/// # fn main() {
/// let markup = html! { (MetaRobots { index: true, follow: false }) };
/// assert_eq!(markup.into_string(),
/// r#"<meta name="robots" content="index,nofollow">"#);
/// # }
/// ```
pub struct MetaRobots {
pub index: bool,
pub follow: bool,
}

impl Render for MetaRobots {
fn render(&self) -> Markup {
let index = if self.index { "index" } else { "noindex" };
let follow = if self.follow { "follow" } else { "nofollow" };
html! {
meta name="robots" content=(format!("{},{}", index, follow)) /
}
}
}
2 changes: 1 addition & 1 deletion maud_lints/src/doctype.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Doctype {
if s.as_str().eq_ignore_ascii_case("<!doctype html>");
// ... and the callee is `maud::PreEscaped`
if let ExprPath(ref qpath) = path_expr.node;
let def_id = cx.tables.qpath_def(qpath, path_expr.id).def_id();
let def_id = cx.tables.qpath_def(qpath, path_expr.hir_id).def_id();
if match_def_path(cx, def_id, &["maud", "PreEscaped", "{{constructor}}"]);
then {
cx.struct_span_lint(MAUD_DOCTYPE, expr.span,
Expand Down

0 comments on commit 3269d7b

Please sign in to comment.