Call the HR
This commit is contained in:
@@ -47,5 +47,7 @@ main :: proc() {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
[&1] Ordered list item 2 not included
|
[&1] Ordered list item 2 not included
|
||||||
[&named] This is the definition for a named footnote
|
[&named] This is the definition for a named footnote
|
||||||
|
|||||||
@@ -210,6 +210,9 @@ print_html :: proc(token: ^Token) {
|
|||||||
fmt.printf("<code>%s</code>", code)
|
fmt.printf("<code>%s</code>", code)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case TokenType.HorizontalRule:
|
||||||
|
fmt.print("<hr>\n")
|
||||||
|
|
||||||
case TokenType.BreakLine:
|
case TokenType.BreakLine:
|
||||||
fmt.print("<br>\n")
|
fmt.print("<br>\n")
|
||||||
|
|
||||||
|
|||||||
@@ -63,6 +63,8 @@ print_token :: proc(token: ^Token, depth: int = 0) {
|
|||||||
type_str = "CodeBlock"
|
type_str = "CodeBlock"
|
||||||
case TokenType.InlineCode:
|
case TokenType.InlineCode:
|
||||||
type_str = "InlineCode"
|
type_str = "InlineCode"
|
||||||
|
case TokenType.HorizontalRule:
|
||||||
|
type_str = "HorizontalRule"
|
||||||
}
|
}
|
||||||
|
|
||||||
value_str := ""
|
value_str := ""
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ TokenType :: enum {
|
|||||||
FootnoteRef,
|
FootnoteRef,
|
||||||
CodeBlock,
|
CodeBlock,
|
||||||
InlineCode,
|
InlineCode,
|
||||||
|
HorizontalRule,
|
||||||
}
|
}
|
||||||
|
|
||||||
TokenValue :: union {
|
TokenValue :: union {
|
||||||
@@ -407,6 +408,27 @@ parse :: proc(lines: []string, allocator := context.allocator) -> Token {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(line) >= 3 {
|
||||||
|
is_hr := true
|
||||||
|
ch := line[0]
|
||||||
|
if ch == '-' || ch == '_' || ch == '=' {
|
||||||
|
for i := 1; i < len(line); i += 1 {
|
||||||
|
if line[i] != ch {
|
||||||
|
is_hr = false
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
is_hr = false
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_hr {
|
||||||
|
push_token(&root, TokenType.HorizontalRule, nil)
|
||||||
|
current_token = &root
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if len(line) == 0 {
|
if len(line) == 0 {
|
||||||
current_token = &root
|
current_token = &root
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user