mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2025-01-18 22:52:50 +00:00
Add numbered lists
This commit is contained in:
parent
3620c6e9b5
commit
a58baa64c3
@ -107,6 +107,8 @@ func geminiLineToAST(line string, state *GemLexerState, ast *[]Line) {
|
||||
goto preformattedState
|
||||
case "list":
|
||||
goto listState
|
||||
case "number":
|
||||
goto numberState
|
||||
default:
|
||||
goto normalState
|
||||
}
|
||||
@ -146,6 +148,22 @@ listState:
|
||||
}
|
||||
return
|
||||
|
||||
numberState:
|
||||
switch {
|
||||
case startsWith("*. "):
|
||||
state.buf += fmt.Sprintf("\t<li>%s</li>\n", ParagraphToHtml(line[2:]))
|
||||
case startsWith("```"):
|
||||
state.where = "pre"
|
||||
addLine(state.buf + "</ol>")
|
||||
state.id++
|
||||
state.buf = fmt.Sprintf("<pre id='%d' alt='%s' class='codeblock'><code>", state.id, strings.TrimPrefix(line, "```"))
|
||||
default:
|
||||
state.where = ""
|
||||
addLine(state.buf + "</ol>")
|
||||
goto normalState
|
||||
}
|
||||
return
|
||||
|
||||
normalState:
|
||||
state.id++
|
||||
switch {
|
||||
@ -157,6 +175,10 @@ normalState:
|
||||
state.where = "list"
|
||||
state.buf = fmt.Sprintf("<ul id='%d'>\n", state.id)
|
||||
goto listState
|
||||
case startsWith("*. "):
|
||||
state.where = "number"
|
||||
state.buf = fmt.Sprintf("<ol id='%d'>\n", state.id)
|
||||
goto numberState
|
||||
|
||||
case startsWith("###### "):
|
||||
addLine(fmt.Sprintf(
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit a54be905923b10524d74435fb62dbdd9a0aac06a
|
||||
Subproject commit 9fa5334ee958c02fbb327c002bf646e648a5a1be
|
Loading…
Reference in New Issue
Block a user