Use syn instead of literalext (#174)
This commit is contained in:
parent
ee74c3ec49
commit
e302ba57e0
2 changed files with 8 additions and 6 deletions
maud_macros
|
@ -11,7 +11,7 @@ description = "Compile-time HTML templates."
|
|||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
literalext = { version = "0.1", default-features = false, features = ["proc-macro"] }
|
||||
syn = "0.15.34"
|
||||
matches = "0.1.6"
|
||||
maud_htmlescape = { version = "0.17.0", path = "../maud_htmlescape" }
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ use proc_macro::{
|
|||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
|
||||
use literalext::LiteralExt;
|
||||
use syn::{LitStr, parse_str};
|
||||
|
||||
use crate::ast;
|
||||
use crate::ParseResult;
|
||||
|
@ -191,10 +191,12 @@ impl Parser {
|
|||
|
||||
/// Parses and renders a literal string.
|
||||
fn literal(&mut self, lit: &Literal) -> ParseResult<ast::Markup> {
|
||||
let content = lit.parse_string().unwrap_or_else(|| {
|
||||
lit.span().error("expected string").emit();
|
||||
String::new() // Insert a dummy value
|
||||
});
|
||||
let content = parse_str::<LitStr>(&lit.to_string())
|
||||
.map(|l| l.value())
|
||||
.unwrap_or_else(|_| {
|
||||
lit.span().error("expected string").emit();
|
||||
String::new() // Insert a dummy value
|
||||
});
|
||||
Ok(ast::Markup::Literal {
|
||||
content,
|
||||
span: lit.span(),
|
||||
|
|
Loading…
Add table
Reference in a new issue