feat: fixed width areas

This commit is contained in:
PoiScript 2019-01-21 23:04:35 +08:00
parent 918b14de52
commit 19f7bacf55
5 changed files with 17 additions and 1 deletions

View file

@ -70,6 +70,7 @@ pub enum Element<'a> {
},
Rule,
Comment(&'a str),
FixedWidth(&'a str),
List {
ident: usize,
ordered: bool,
@ -178,6 +179,14 @@ impl<'a> Element<'a> {
}
}
if bytes[pos] == b':' && bytes.get(pos + 1).map(|&b| b == b' ').unwrap_or(false) {
let eol = src[pos..]
.find('\n')
.map(|i| i + pos + 1)
.unwrap_or_else(|| src.len());
ret!(Element::FixedWidth(&src[pos + 1..eol]), eol);
}
if bytes[pos] == b'#' && bytes.get(pos + 1).filter(|&&b| b == b'+').is_some() {
if let Some((name, args, contents_beg, cont_end, end)) =
Block::parse(&src[pos..])