Skip to content

Commit d8d4ec6

Browse files
committed
fix ol start number
1 parent 4f43f20 commit d8d4ec6

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

Parser.js

Lines changed: 11 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Parser.coffee

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -834,10 +834,16 @@ class Parser
834834
html = ''
835835
[space, type] = value
836836
rows = []
837+
suffix = ''
837838
last = 0
838839

839-
for line in lines
840+
for line, key in lines
840841
if matches = line.match new RegExp "^(\\s{#{space}})((?:[0-9]+\\.?)|\\-|\\+|\\*)(\\s+)(.*)$"
842+
if type is 'ol' and key is 0
843+
start = parseInt matches[2]
844+
845+
suffix = ' start="' + start + '"' if start != 1
846+
841847
rows.push [matches[4]]
842848
last = rows.length - 1
843849
else
@@ -847,7 +853,7 @@ class Parser
847853
html += '<li>' + (@parse (row.join "\n"), yes, start) + '</li>'
848854
start += row.length
849855

850-
"<#{type}>#{html}</#{type}>"
856+
"<#{type}#{suffix}>#{html}</#{type}>"
851857

852858

853859
parseTable: (lines, value, start) ->

0 commit comments

Comments
 (0)