Use syn instead of literalext ()

This commit is contained in:
Malthe Borch 2019-05-18 03:44:43 +00:00 committed by Chris Wong
parent ee74c3ec49
commit e302ba57e0
2 changed files with 8 additions and 6 deletions
maud_macros

View file

@ -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" }

View file

@ -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,7 +191,9 @@ 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(|| {
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
});