refactor(parser): skip the document beginnings

This commit is contained in:
Orhun Parmaksız 2021-10-07 21:32:13 +03:00
parent 8650c29273
commit 7435c1c7a6
No known key found for this signature in database
GPG key ID: F83424824B3E4B90

View file

@ -30,6 +30,11 @@ impl<'a> TryFrom<Pair<'a, Rule>> for Title<'a> {
// set the actual title
if let Some(value) = pair.as_str().lines().next() {
if value.chars().all(|v| v == '=') {
return Err(ErrorImpl::ParseError(String::from(
"document beginning found",
)));
}
title.value = value;
} else {
return Err(ErrorImpl::ParseError(String::from("invalid title")));