allow the last attribute in a component to contain formatting (#504)
This commit is contained in:
1 parent
15e9aa1958
commit
4a8a7dd5f4
1 file changed
+9
-7
@@ -234,13 +234,15 @@ impl Parse for ComponentField {
|
|||||||
let content = ContentField::ManExpr(input.parse()?);
|
let content = ContentField::ManExpr(input.parse()?);
|
||||||
return Ok(Self { name, content });
|
return Ok(Self { name, content });
|
||||||
}
|
}
|
||||||
|
if input.peek(LitStr) {
|
||||||
if input.peek(LitStr) && input.peek2(Token![,]) {
|
let forked = input.fork();
|
||||||
let t: LitStr = input.fork().parse()?;
|
let t: LitStr = forked.parse()?;
|
||||||
|
// the string literal must either be the end of the input or a followed by a comma
|
||||||
if is_literal_foramtted(&t) {
|
if forked.is_empty() || forked.peek(Token![,]) {
|
||||||
let content = ContentField::Formatted(input.parse()?);
|
if is_literal_foramtted(&t) {
|
||||||
return Ok(Self { name, content });
|
let content = ContentField::Formatted(input.parse()?);
|
||||||
|
return Ok(Self { name, content });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user