mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:17:36 +00:00
LibMarkdown: Add blockquote support to LineIterator
This patch adds contexts to line iterator for nesting list items and blockquotes. It also incidentally makes the api for LineIterator simpler, and will make it easier to add other containers in the future.
This commit is contained in:
parent
4b091a7cc2
commit
2227a80f34
3 changed files with 79 additions and 32 deletions
|
@ -121,16 +121,14 @@ OwnPtr<List> List::parse(LineIterator& lines)
|
|||
|
||||
is_tight = is_tight && !has_trailing_blank_lines;
|
||||
|
||||
size_t saved_indent = lines.indent();
|
||||
lines.set_indent(saved_indent + offset);
|
||||
lines.ignore_next_prefix();
|
||||
lines.push_context(LineIterator::Context::list_item(offset));
|
||||
|
||||
auto list_item = ContainerBlock::parse(lines);
|
||||
is_tight = is_tight && !list_item->has_blank_lines();
|
||||
has_trailing_blank_lines = has_trailing_blank_lines || list_item->has_trailing_blank_lines();
|
||||
items.append(move(list_item));
|
||||
|
||||
lines.set_indent(saved_indent);
|
||||
lines.pop_context();
|
||||
|
||||
first = false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue