Skip to content

Commit

Permalink
Merge pull request #1336 from kmuto/markdown-listnum
Browse files Browse the repository at this point in the history
MARKDOWNBuilder: support listnum
  • Loading branch information
takahashim authored Jun 29, 2019
2 parents 27be16e + b47f6c6 commit 6cefc94
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
2 changes: 2 additions & 0 deletions NEWS.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
* 箇条書きや文献リストで複数行の英単語が連結されてしまうのを回避しました (ただし PDFMaker のみ) ([#1312])
* 空の表があったときにエラーを出すようにしました ([#1325])
* いくつかのテスト対象を追加しました ([#1327], [#1328])
* MARKDOWNBuilder: ``//listnum``に対応しました ([#1336])

## ドキュメント
* 見出しのレベルの説明の誤りを修正しました ([#1309])
Expand Down Expand Up @@ -70,6 +71,7 @@
[#1325]: https://github.com/kmuto/review/issues/1325
[#1327]: https://github.com/kmuto/review/issues/1327
[#1328]: https://github.com/kmuto/review/pull/1328
[#1336]: https://github.com/kmuto/review/pull/1336

# Version 3.1.0

Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
* avoid multi-lined English words being combined without a space in bullets and bibliographic list (only in PDFMaker, at this time) ([#1312])
* raise an error when table is empty ([#1325])
* add some tests ([#1327], [#1328])
* MARKDOWNBilder: support `//listnum` ([#1336])

## Docs
* fixed the description about header levels ([#1309])
Expand Down Expand Up @@ -70,6 +71,7 @@
[#1325]: https://github.com/kmuto/review/issues/1325
[#1327]: https://github.com/kmuto/review/issues/1327
[#1328]: https://github.com/kmuto/review/pull/1328
[#1336]: https://github.com/kmuto/review/pull/1336

# Version 3.1.0
## Breaking Changes
Expand Down
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 6cefc94

Please sign in to comment.