Rust 2018
This commit is contained in:
parent
65874efb98
commit
39f543c819
13 changed files with 14 additions and 30 deletions
maud
maud_htmlescape
maud_macros
|
@ -1,16 +1,15 @@
|
||||||
[package]
|
[package]
|
||||||
|
|
||||||
name = "maud"
|
name = "maud"
|
||||||
# When releasing a new version, please update html_root_url in src/lib.rs
|
# When releasing a new version, please update html_root_url in src/lib.rs
|
||||||
version = "0.20.0"
|
version = "0.20.0"
|
||||||
authors = ["Chris Wong <lambda.fairy@gmail.com>"]
|
authors = ["Chris Wong <lambda.fairy@gmail.com>"]
|
||||||
|
|
||||||
license = "MIT/Apache-2.0"
|
license = "MIT/Apache-2.0"
|
||||||
documentation = "https://docs.rs/maud/"
|
documentation = "https://docs.rs/maud/"
|
||||||
homepage = "https://maud.lambda.xyz/"
|
homepage = "https://maud.lambda.xyz/"
|
||||||
repository = "https://github.com/lfairy/maud"
|
repository = "https://github.com/lfairy/maud"
|
||||||
description = "Compile-time HTML templates."
|
description = "Compile-time HTML templates."
|
||||||
categories = ["template-engine"]
|
categories = ["template-engine"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
maud_htmlescape = { version = "0.17.0", path = "../maud_htmlescape" }
|
maud_htmlescape = { version = "0.17.0", path = "../maud_htmlescape" }
|
||||||
|
|
|
@ -13,9 +13,6 @@
|
||||||
#[cfg(feature = "iron")] extern crate iron;
|
#[cfg(feature = "iron")] extern crate iron;
|
||||||
#[cfg(feature = "rocket")] extern crate rocket;
|
#[cfg(feature = "rocket")] extern crate rocket;
|
||||||
|
|
||||||
extern crate maud_htmlescape;
|
|
||||||
extern crate maud_macros;
|
|
||||||
|
|
||||||
use std::fmt::{self, Write};
|
use std::fmt::{self, Write};
|
||||||
|
|
||||||
pub use maud_macros::{html, html_debug};
|
pub use maud_macros::{html, html_debug};
|
||||||
|
@ -159,7 +156,7 @@ mod iron_support {
|
||||||
use iron::modifier::{Modifier, Set};
|
use iron::modifier::{Modifier, Set};
|
||||||
use iron::modifiers::Header;
|
use iron::modifiers::Header;
|
||||||
use iron::response::{Response, WriteBody};
|
use iron::response::{Response, WriteBody};
|
||||||
use PreEscaped;
|
use crate::PreEscaped;
|
||||||
|
|
||||||
impl Modifier<Response> for PreEscaped<String> {
|
impl Modifier<Response> for PreEscaped<String> {
|
||||||
fn modify(self, response: &mut Response) {
|
fn modify(self, response: &mut Response) {
|
||||||
|
@ -182,7 +179,7 @@ mod rocket_support {
|
||||||
use rocket::request::Request;
|
use rocket::request::Request;
|
||||||
use rocket::response::{Responder, Response};
|
use rocket::response::{Responder, Response};
|
||||||
use std::io::Cursor;
|
use std::io::Cursor;
|
||||||
use PreEscaped;
|
use crate::PreEscaped;
|
||||||
|
|
||||||
impl Responder<'static> for PreEscaped<String> {
|
impl Responder<'static> for PreEscaped<String> {
|
||||||
fn respond_to(self, _: &Request) -> Result<Response<'static>, Status> {
|
fn respond_to(self, _: &Request) -> Result<Response<'static>, Status> {
|
||||||
|
@ -196,7 +193,7 @@ mod rocket_support {
|
||||||
|
|
||||||
#[cfg(feature = "actix-web")]
|
#[cfg(feature = "actix-web")]
|
||||||
mod actix_support {
|
mod actix_support {
|
||||||
use PreEscaped;
|
use crate::PreEscaped;
|
||||||
use actix_web::{Responder, HttpResponse, HttpRequest, Error};
|
use actix_web::{Responder, HttpResponse, HttpRequest, Error};
|
||||||
|
|
||||||
impl Responder for PreEscaped<String> {
|
impl Responder for PreEscaped<String> {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#![feature(proc_macro_hygiene)]
|
#![feature(proc_macro_hygiene)]
|
||||||
|
|
||||||
extern crate maud;
|
|
||||||
|
|
||||||
use maud::{Markup, html};
|
use maud::{Markup, html};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#![feature(proc_macro_hygiene)]
|
#![feature(proc_macro_hygiene)]
|
||||||
|
|
||||||
extern crate maud;
|
|
||||||
|
|
||||||
use maud::html;
|
use maud::html;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -194,7 +192,7 @@ fn let_lexical_scope() {
|
||||||
#[test]
|
#[test]
|
||||||
fn let_type_ascription() {
|
fn let_type_ascription() {
|
||||||
let s = html! {
|
let s = html! {
|
||||||
@let mut x: Box<Iterator<Item=u32>> = Box::new(vec![42].into_iter());
|
@let mut x: Box<dyn Iterator<Item=u32>> = Box::new(vec![42].into_iter());
|
||||||
"I have " (x.next().unwrap()) " cupcakes!"
|
"I have " (x.next().unwrap()) " cupcakes!"
|
||||||
}.into_string();
|
}.into_string();
|
||||||
assert_eq!(s, "I have 42 cupcakes!");
|
assert_eq!(s, "I have 42 cupcakes!");
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
#![feature(proc_macro_hygiene)]
|
#![feature(proc_macro_hygiene)]
|
||||||
|
|
||||||
extern crate maud;
|
use maud::{self, html};
|
||||||
|
|
||||||
use maud::html;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn issue_13() {
|
fn issue_13() {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#![feature(proc_macro_hygiene)]
|
#![feature(proc_macro_hygiene)]
|
||||||
|
|
||||||
extern crate maud;
|
|
||||||
|
|
||||||
use maud::html;
|
use maud::html;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
extern crate compiletest_rs;
|
use compiletest_rs;
|
||||||
|
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,14 @@
|
||||||
[package]
|
[package]
|
||||||
|
|
||||||
name = "maud_htmlescape"
|
name = "maud_htmlescape"
|
||||||
# When releasing a new version, please update html_root_url in lib.rs
|
# When releasing a new version, please update html_root_url in lib.rs
|
||||||
version = "0.17.0"
|
version = "0.17.0"
|
||||||
authors = ["Chris Wong <lambda.fairy@gmail.com>"]
|
authors = ["Chris Wong <lambda.fairy@gmail.com>"]
|
||||||
|
|
||||||
license = "MIT/Apache-2.0"
|
license = "MIT/Apache-2.0"
|
||||||
documentation = "https://docs.rs/maud_htmlescape/"
|
documentation = "https://docs.rs/maud_htmlescape/"
|
||||||
homepage = "https://maud.lambda.xyz/"
|
homepage = "https://maud.lambda.xyz/"
|
||||||
repository = "https://github.com/lfairy/maud"
|
repository = "https://github.com/lfairy/maud"
|
||||||
description = "Internal support code used by Maud."
|
description = "Internal support code used by Maud."
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "lib.rs"
|
path = "lib.rs"
|
||||||
|
|
|
@ -57,7 +57,7 @@ impl<'a> fmt::Write for Escaper<'a> {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use std::fmt::Write;
|
use std::fmt::Write;
|
||||||
use Escaper;
|
use crate::Escaper;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn it_works() {
|
fn it_works() {
|
||||||
|
|
|
@ -1,15 +1,14 @@
|
||||||
[package]
|
[package]
|
||||||
|
|
||||||
name = "maud_macros"
|
name = "maud_macros"
|
||||||
# When releasing a new version, please update html_root_url in src/lib.rs
|
# When releasing a new version, please update html_root_url in src/lib.rs
|
||||||
version = "0.20.0"
|
version = "0.20.0"
|
||||||
authors = ["Chris Wong <lambda.fairy@gmail.com>"]
|
authors = ["Chris Wong <lambda.fairy@gmail.com>"]
|
||||||
|
|
||||||
license = "MIT/Apache-2.0"
|
license = "MIT/Apache-2.0"
|
||||||
documentation = "https://docs.rs/maud_macros/"
|
documentation = "https://docs.rs/maud_macros/"
|
||||||
homepage = "https://maud.lambda.xyz/"
|
homepage = "https://maud.lambda.xyz/"
|
||||||
repository = "https://github.com/lfairy/maud"
|
repository = "https://github.com/lfairy/maud"
|
||||||
description = "Compile-time HTML templates."
|
description = "Compile-time HTML templates."
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
literalext = { version = "0.1", default-features = false, features = ["proc-macro"] }
|
literalext = { version = "0.1", default-features = false, features = ["proc-macro"] }
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
use matches::matches;
|
||||||
use maud_htmlescape::Escaper;
|
use maud_htmlescape::Escaper;
|
||||||
use proc_macro::{
|
use proc_macro::{
|
||||||
Delimiter,
|
Delimiter,
|
||||||
|
@ -10,7 +11,7 @@ use proc_macro::{
|
||||||
TokenTree,
|
TokenTree,
|
||||||
};
|
};
|
||||||
|
|
||||||
use ast::*;
|
use crate::ast::*;
|
||||||
|
|
||||||
pub fn generate(markups: Vec<Markup>, output_ident: TokenTree) -> TokenStream {
|
pub fn generate(markups: Vec<Markup>, output_ident: TokenTree) -> TokenStream {
|
||||||
let mut build = Builder::new(output_ident.clone());
|
let mut build = Builder::new(output_ident.clone());
|
||||||
|
|
|
@ -10,9 +10,6 @@
|
||||||
// lifetimes outweighs the marginal gains from explicit borrowing
|
// lifetimes outweighs the marginal gains from explicit borrowing
|
||||||
#![allow(clippy::needless_pass_by_value)]
|
#![allow(clippy::needless_pass_by_value)]
|
||||||
|
|
||||||
extern crate literalext;
|
|
||||||
#[macro_use] extern crate matches;
|
|
||||||
extern crate maud_htmlescape;
|
|
||||||
extern crate proc_macro;
|
extern crate proc_macro;
|
||||||
|
|
||||||
mod ast;
|
mod ast;
|
||||||
|
|
|
@ -11,8 +11,8 @@ use std::mem;
|
||||||
|
|
||||||
use literalext::LiteralExt;
|
use literalext::LiteralExt;
|
||||||
|
|
||||||
use ast;
|
use crate::ast;
|
||||||
use ParseResult;
|
use crate::ParseResult;
|
||||||
|
|
||||||
pub fn parse(input: TokenStream) -> ParseResult<Vec<ast::Markup>> {
|
pub fn parse(input: TokenStream) -> ParseResult<Vec<ast::Markup>> {
|
||||||
Parser::new(input).markups()
|
Parser::new(input).markups()
|
||||||
|
|
Loading…
Add table
Reference in a new issue