mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2025-01-31 11:29:09 +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
|
goto preformattedState
|
||||||
case "list":
|
case "list":
|
||||||
goto listState
|
goto listState
|
||||||
|
case "number":
|
||||||
|
goto numberState
|
||||||
default:
|
default:
|
||||||
goto normalState
|
goto normalState
|
||||||
}
|
}
|
||||||
@ -146,6 +148,22 @@ listState:
|
|||||||
}
|
}
|
||||||
return
|
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:
|
normalState:
|
||||||
state.id++
|
state.id++
|
||||||
switch {
|
switch {
|
||||||
@ -157,6 +175,10 @@ normalState:
|
|||||||
state.where = "list"
|
state.where = "list"
|
||||||
state.buf = fmt.Sprintf("<ul id='%d'>\n", state.id)
|
state.buf = fmt.Sprintf("<ul id='%d'>\n", state.id)
|
||||||
goto listState
|
goto listState
|
||||||
|
case startsWith("*. "):
|
||||||
|
state.where = "number"
|
||||||
|
state.buf = fmt.Sprintf("<ol id='%d'>\n", state.id)
|
||||||
|
goto numberState
|
||||||
|
|
||||||
case startsWith("###### "):
|
case startsWith("###### "):
|
||||||
addLine(fmt.Sprintf(
|
addLine(fmt.Sprintf(
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit a54be905923b10524d74435fb62dbdd9a0aac06a
|
Subproject commit 9fa5334ee958c02fbb327c002bf646e648a5a1be
|
Loading…
Reference in New Issue
Block a user