Skip to content

Commit

Permalink
MARKDOWNBuilder: support listnum
Browse files Browse the repository at this point in the history
  • Loading branch information
takahashim committed Jun 29, 2019
1 parent 27be16e commit 35d4462
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/review/markdownbuilder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ def list_body(_id, lines, _lang)
puts '```'
end

def listnum_body(lines, _lang)
lines.each_with_index do |line, i|
puts((i + 1).to_s.rjust(2) + ": #{detab(line)}")
end
puts '```'
end

def ul_begin
blank if @ul_indent == 0
@ul_indent += 1
Expand Down
17 changes: 17 additions & 0 deletions test/test_markdownbuilder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,23 @@ def test_list_lang
EOS
end

def test_listnum
def @chapter.list(_id)
Book::ListIndex::Item.new('test', 1)
end
actual = compile_block("//listnum[test][this is @<b>{test}<&>_]{\nfoo\nbar\n\tbuz\n//}\n")
expected = <<-EOS
リスト1.1 this is **test**<&>_
```
1: foo
2: bar
3: buz
```
EOS
assert_equal expected, actual
end

def test_emlist_lang
actual = compile_block(<<-EOS)
//emlist[caption][ruby]{
Expand Down

0 comments on commit 35d4462

Please sign in to comment.