mirror of
https://github.com/danog/blackfriday.git
synced 2024-11-26 20:14:43 +01:00
fixed ordered lists
This commit is contained in:
parent
f565f32504
commit
cb7b546677
19
markdown.go
19
markdown.go
@ -144,6 +144,10 @@ func parse_block(ob *bytes.Buffer, rndr *render, data []byte) {
|
||||
data = data[parse_list(ob, rndr, data, 0):]
|
||||
continue
|
||||
}
|
||||
if prefix_oli(data) > 0 {
|
||||
data = data[parse_list(ob, rndr, data, MKD_LIST_ORDERED):]
|
||||
continue
|
||||
}
|
||||
|
||||
data = data[parse_paragraph(ob, rndr, data):]
|
||||
}
|
||||
@ -198,7 +202,8 @@ func is_headerline(data []byte) int {
|
||||
|
||||
// test of level 1 header
|
||||
if data[i] == '=' {
|
||||
for i = 1; i < len(data) && data[i] == '='; i++ {}
|
||||
for i = 1; i < len(data) && data[i] == '='; i++ {
|
||||
}
|
||||
for i < len(data) && (data[i] == ' ' || data[i] == '\t') {
|
||||
i++
|
||||
}
|
||||
@ -211,7 +216,8 @@ func is_headerline(data []byte) int {
|
||||
|
||||
// test of level 2 header
|
||||
if data[i] == '-' {
|
||||
for i = 1; i < len(data) && data[i] == '-'; i++ {}
|
||||
for i = 1; i < len(data) && data[i] == '-'; i++ {
|
||||
}
|
||||
for i < len(data) && (data[i] == ' ' || data[i] == '\t') {
|
||||
i++
|
||||
}
|
||||
@ -867,7 +873,7 @@ func prefix_oli(data []byte) int {
|
||||
func parse_list(ob *bytes.Buffer, rndr *render, data []byte, flags int) int {
|
||||
work := bytes.NewBuffer(nil)
|
||||
|
||||
i, j, flags := 0, 0, 0
|
||||
i, j := 0, 0
|
||||
for i < len(data) {
|
||||
j, flags = parse_listitem(work, rndr, data[i:], flags)
|
||||
i += j
|
||||
@ -1016,7 +1022,8 @@ func parse_paragraph(ob *bytes.Buffer, rndr *render, data []byte) int {
|
||||
i, end, level := 0, 0, 0
|
||||
|
||||
for i < len(data) {
|
||||
for end = i + 1; end < len(data) && data[end-1] != '\n'; end++ {}
|
||||
for end = i + 1; end < len(data) && data[end-1] != '\n'; end++ {
|
||||
}
|
||||
|
||||
if is_empty(data[i:]) > 0 {
|
||||
break
|
||||
@ -1025,7 +1032,7 @@ func parse_paragraph(ob *bytes.Buffer, rndr *render, data []byte) int {
|
||||
break
|
||||
}
|
||||
|
||||
if rndr.ext_flags & MKDEXT_LAX_HTML_BLOCKS != 0 {
|
||||
if rndr.ext_flags&MKDEXT_LAX_HTML_BLOCKS != 0 {
|
||||
if data[i] == '<' && rndr.mk.blockhtml != nil && parse_htmlblock(ob, rndr, data[i:], false) > 0 {
|
||||
end = i
|
||||
break
|
||||
@ -1301,7 +1308,7 @@ func rndr_paragraph(ob *bytes.Buffer, text []byte, opaque interface{}) {
|
||||
}
|
||||
|
||||
ob.WriteString("<p>")
|
||||
if options.flags & HTML_HARD_WRAP != 0 {
|
||||
if options.flags&HTML_HARD_WRAP != 0 {
|
||||
for i < len(text) {
|
||||
org := i
|
||||
for i < len(text) && text[i] != '\n' {
|
||||
|
Loading…
Reference in New Issue
Block a user