Skip to content

Commit

Permalink
be more pedantic about numbered lists
Browse files Browse the repository at this point in the history
  • Loading branch information
ttytm committed Apr 15, 2024
1 parent 5e4ed28 commit 61b0b7b
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions cmd/tools/vdoc/html.v
Original file line number Diff line number Diff line change
Expand Up @@ -521,13 +521,10 @@ fn doc_node_html(dn doc.DocNode, link string, head bool, include_examples bool,
if l_trimmed.starts_with('```') {
is_codeblock = !is_codeblock
}
is_list := if l_trimmed.len > 1 {
list := l_trimmed[0] in [`*`, `-`] && l_trimmed[1] == ` `
num_list := l_trimmed[0].is_digit() && l_trimmed[1] == `.`
list || num_list
} else {
false
}
// -> if l_trimmed.len > 1 && (is_ul || is_ol)
is_list := l_trimmed.len > 1 && ((l_trimmed[1] == ` ` && l_trimmed[0] in [`*`, `-`])
|| (l.len > 2 && l_trimmed[2] == ` ` && l_trimmed[1] == `.`
&& l_trimmed[0].is_digit()))
if !is_codeblock && l != '' && nl != '' && !is_list
&& !nl.trim_left('\x01').trim_space().starts_with('```') {
merged_lines << '${l} ${nl}'
Expand Down

0 comments on commit 61b0b7b

Please sign in to comment.