Unordered lists
This commit is contained in:
@@ -11,6 +11,9 @@ TokenType :: enum {
|
||||
Paragraph,
|
||||
Root,
|
||||
Blockquote,
|
||||
UnorderedList,
|
||||
OrderedList,
|
||||
ListItem,
|
||||
}
|
||||
|
||||
TokenValue :: union {
|
||||
@@ -79,6 +82,16 @@ parse :: proc(lines: []string, allocator := context.allocator) -> Token {
|
||||
continue
|
||||
}
|
||||
|
||||
if strings.has_prefix(text, ". ") || strings.has_prefix(text, "- ") {
|
||||
if current_token.type != TokenType.UnorderedList {
|
||||
current_token = push_token(&root, TokenType.UnorderedList, nil)
|
||||
}
|
||||
current_token = push_token(current_token, TokenType.ListItem, nil)
|
||||
push_token(current_token, TokenType.Text, text[2:])
|
||||
current_token = current_token.parent
|
||||
continue
|
||||
}
|
||||
|
||||
// LAST-CASE SCENARIO: NORMAL TEXT
|
||||
|
||||
if current_token.parent == nil {
|
||||
|
||||
Reference in New Issue
Block a user