review 2.2.0 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +92 -73
  3. data/{doc/NEWS.ja.md → NEWS.ja.md} +60 -0
  4. data/{doc/NEWS.md → NEWS.md} +60 -0
  5. data/bin/review-compile +1 -1
  6. data/bin/review-epubmaker +2 -2
  7. data/bin/review-pdfmaker +2 -2
  8. data/debian/control +1 -1
  9. data/{ChangeLog → doc/ChangeLog-0.x_to_2.0} +0 -0
  10. data/doc/config.yml.sample +6 -6
  11. data/doc/format.ja.md +19 -1
  12. data/doc/format.md +28 -10
  13. data/doc/quickstart.ja.md +1 -1
  14. data/doc/quickstart.md +1 -1
  15. data/lib/epubmaker.rb +2 -1
  16. data/lib/epubmaker/content.rb +2 -1
  17. data/lib/epubmaker/epubcommon.rb +1 -0
  18. data/lib/epubmaker/epubv2.rb +2 -1
  19. data/lib/epubmaker/epubv3.rb +2 -1
  20. data/lib/epubmaker/producer.rb +2 -1
  21. data/lib/epubmaker/zip_exporter.rb +2 -2
  22. data/lib/review/book/base.rb +2 -2
  23. data/lib/review/book/index.rb +7 -3
  24. data/lib/review/builder.rb +15 -7
  25. data/lib/review/compiler.rb +4 -3
  26. data/lib/review/converter.rb +1 -1
  27. data/lib/review/epubmaker.rb +2 -2
  28. data/lib/review/ewbbuilder.rb +2 -1
  29. data/lib/review/htmlbuilder.rb +59 -9
  30. data/lib/review/idgxmlbuilder.rb +13 -5
  31. data/lib/review/latexbuilder.rb +44 -17
  32. data/lib/review/latexutils.rb +2 -2
  33. data/lib/review/makerhelper.rb +2 -2
  34. data/lib/review/markdownbuilder.rb +12 -8
  35. data/lib/review/pdfmaker.rb +1 -2
  36. data/lib/review/rstbuilder.rb +10 -4
  37. data/lib/review/sec_counter.rb +9 -3
  38. data/lib/review/topbuilder.rb +47 -5
  39. data/lib/review/version.rb +1 -1
  40. data/lib/review/webmaker.rb +1 -2
  41. data/review.gemspec +1 -1
  42. data/templates/latex/layout.tex.erb +5 -0
  43. data/test/assets/test_template.tex +5 -0
  44. data/test/test_book.rb +2 -1
  45. data/test/test_book_chapter.rb +1 -3
  46. data/test/test_epub3maker.rb +0 -2
  47. data/test/test_htmlbuilder.rb +72 -3
  48. data/test/test_idgxmlbuilder.rb +11 -2
  49. data/test/test_index.rb +0 -1
  50. data/test/test_latexbuilder.rb +96 -2
  51. data/test/test_pdfmaker.rb +0 -1
  52. data/test/test_rstbuilder.rb +5 -0
  53. data/test/test_topbuilder.rb +26 -1
  54. metadata +6 -7
@@ -4,6 +4,8 @@
4
4
  % \usepackage{fixltx2e}[2006/09/13 v1.1m]
5
5
 
6
6
  \usepackage[deluxe,uplatex]{otf}
7
+ \usepackage{caption}
8
+ \usepackage{suffix}
7
9
  \usepackage[T1]{fontenc}\usepackage{textcomp}%T1/TS1
8
10
  % \usepackage{lmodern}
9
11
  \usepackage[dvipdfmx]{graphicx}
@@ -96,6 +98,9 @@
96
98
  \newcommand{\reviewtablecaption}[1]{%
97
99
  \caption{#1}}
98
100
 
101
+ \WithSuffix\newcommand\reviewtablecaption*[1]{%
102
+ \caption*{#1}}
103
+
99
104
  \newcommand{\reviewimgtablecaption}[1]{%
100
105
  \caption{#1}\vspace{-3mm}}
101
106
 
@@ -1,4 +1,5 @@
1
1
  # encoding: utf-8
2
+
2
3
  require 'book_test_helper'
3
4
 
4
5
  class BookTest < Test::Unit::TestCase
@@ -34,7 +35,7 @@ class BookTest < Test::Unit::TestCase
34
35
  o.puts "#{test_const} = #{num}"
35
36
  end
36
37
  Book.update_rubyenv(dir)
37
- assert_equal num, Object.class_eval { const_get(test_const) }
38
+ assert_equal num, (Object.class_eval { const_get(test_const) })
38
39
  end
39
40
  ensure
40
41
  Object.class_eval { remove_const(test_const) }
@@ -39,7 +39,7 @@ class ChapterTest < Test::Unit::TestCase
39
39
  def test_open
40
40
  ch = Book::Chapter.new(nil, nil, nil, __FILE__, :io)
41
41
  assert_equal :io, ch.open
42
- assert_equal [:io], ch.open {|io| [io] }
42
+ assert_equal [:io], (ch.open {|io| [io] })
43
43
  end
44
44
 
45
45
  def test_size
@@ -189,7 +189,6 @@ E
189
189
  E
190
190
  end
191
191
 
192
-
193
192
  def test_headline_index_nullsection
194
193
  do_test_index(<<E, Book::HeadlineIndex, :headline_index, :headline, :propagate => false)
195
194
  == abc
@@ -198,7 +197,6 @@ E
198
197
  E
199
198
  end
200
199
 
201
-
202
200
  def test_column_index
203
201
  do_test_index(<<E, Book::ColumnIndex, :column_index, :column, :propagate => false)
204
202
  = dummy1
@@ -614,7 +614,6 @@ EOT
614
614
  assert_equal expect, history
615
615
  end
616
616
 
617
-
618
617
  def test_detect_mathml
619
618
  Dir.mktmpdir do |dir|
620
619
  epubmaker = ReVIEW::EPUBMaker.new
@@ -642,7 +641,6 @@ EOT
642
641
  end
643
642
  end
644
643
 
645
-
646
644
  def test_detect_mathml_ns
647
645
  Dir.mktmpdir do |dir|
648
646
  epubmaker = ReVIEW::EPUBMaker.new
@@ -365,6 +365,64 @@ class HTMLBuidlerTest < Test::Unit::TestCase
365
365
  assert_equal expected, actual
366
366
  end
367
367
 
368
+ def test_inline_imgref3
369
+ Dir.mktmpdir do |dir|
370
+ Dir.chdir(dir) do
371
+ file1 = File.join(dir, "images", "img1.png")
372
+ filet1 = File.join(dir, "images", "tbl1.png")
373
+ file2 = File.join(dir, "images", "img2.png")
374
+ re1 = File.join(dir, "sample1.re")
375
+ cat = File.join(dir, "catalog.yml")
376
+ FileUtils.mkdir_p(File.join(dir,"images"))
377
+ File.open(file1, "w"){|f| f.write("")}
378
+ File.open(filet1, "w"){|f| f.write("")}
379
+ File.open(file2, "w"){|f| f.write("")}
380
+ File.open(cat, "w"){|f| f.write("CHAPS:\n - sample1.re\n")}
381
+ File.open(re1,"w"){|f| f.write(<<EOF)}
382
+ = test
383
+
384
+ tbl1 is @<table>{tbl1}.
385
+
386
+ img2 is @<img>{img2}.
387
+
388
+ //image[img1][image 1]{
389
+ //}
390
+
391
+ //imgtable[tbl1][table 1]{
392
+ //}
393
+
394
+ //image[img2][image 2]{
395
+ //}
396
+ EOF
397
+ content = File.read(re1)
398
+ actual = compile_block(content)
399
+
400
+ expected =<<-EOS
401
+ <h1><a id="h1"></a><span class="secno">第1章 </span>test</h1>
402
+ <p>tbl1 is <span class="tableref">表1.1</span>.</p>
403
+ <p>img2 is <span class="imgref">図1.2</span>.</p>
404
+ <div id="img1" class="image">
405
+ <img src="images/img1.png" alt="image 1" />
406
+ <p class="caption">
407
+ 図1.1: image 1
408
+ </p>
409
+ </div>
410
+ <div id="tbl1" class="imgtable image">
411
+ <p class="caption">表1.1: table 1</p>
412
+ <img src="images/tbl1.png" alt="table 1" />
413
+ </div>
414
+ <div id="img2" class="image">
415
+ <img src="images/img2.png" alt="image 2" />
416
+ <p class="caption">
417
+ 図1.2: image 2
418
+ </p>
419
+ </div>
420
+ EOS
421
+
422
+ assert_equal expected, actual
423
+ end
424
+ end
425
+ end
368
426
 
369
427
  def test_quote
370
428
  actual = compile_block("//quote{\nfoo\nbar\n\nbuz\n//}\n")
@@ -507,6 +565,11 @@ class HTMLBuidlerTest < Test::Unit::TestCase
507
565
  assert_equal %Q|<dl>\n<dt>title</dt>\n<dd>body</dd>\n<dt>title2</dt>\n<dd>body2</dd>\n</dl>\n|, actual
508
566
  end
509
567
 
568
+ def test_dlist_beforeulol
569
+ actual = compile_block(" : foo\n foo.\n\npara\n\n : foo\n foo.\n\n 1. bar\n\n : foo\n foo.\n\n * bar\n")
570
+ assert_equal %Q|<dl>\n<dt>foo</dt>\n<dd>foo.</dd>\n</dl>\n<p>para</p>\n<dl>\n<dt>foo</dt>\n<dd>foo.</dd>\n</dl>\n<ol>\n<li>bar</li>\n</ol>\n<dl>\n<dt>foo</dt>\n<dd>foo.</dd>\n</dl>\n<ul>\n<li>bar</li>\n</ul>\n|, actual
571
+ end
572
+
510
573
  def test_list
511
574
  def @chapter.list(id)
512
575
  Book::ListIndex::Item.new("samplelist",1)
@@ -651,7 +714,7 @@ end
651
714
  expected = "<div id=\"samplelist\" class=\"caption-code\">\n" +
652
715
  "<p class=\"caption\">リスト1.1: this is <b>test</b>&lt;&amp;&gt;_</p>\n" +
653
716
  "<pre class=\"list language-ruby highlight\"><span class=\"k\">def</span> <span class=\"nf\">foo</span><span class=\"p\">(</span><span class=\"n\">a1</span><span class=\"p\">,</span> <span class=\"n\">a2</span><span class=\"o\">=</span><span class=\"ss\">:test</span><span class=\"p\">)</span>\n" +
654
- " <span class=\"p\">(</span><span class=\"mi\">1</span><span class=\"p\">.</span><span class=\"nf\">.</span><span class=\"mi\">3</span><span class=\"p\">).</span><span class=\"nf\">times</span><span class=\"p\">{</span><span class=\"o\">|</span><span class=\"n\">i</span><span class=\"o\">|</span> <span class=\"n\">a</span><span class=\"p\">.</span><span class=\"nf\">include?</span><span class=\"p\">(</span><span class=\"ss\">:foo</span><span class=\"p\">)}</span>\n" +
717
+ " <span class=\"p\">(</span><span class=\"mi\">1</span><span class=\"o\">..</span><span class=\"mi\">3</span><span class=\"p\">).</span><span class=\"nf\">times</span><span class=\"p\">{</span><span class=\"o\">|</span><span class=\"n\">i</span><span class=\"o\">|</span> <span class=\"n\">a</span><span class=\"p\">.</span><span class=\"nf\">include?</span><span class=\"p\">(</span><span class=\"ss\">:foo</span><span class=\"p\">)}</span>\n" +
655
718
  " <span class=\"k\">return</span> <span class=\"kp\">true</span>\n" +
656
719
  "<span class=\"k\">end</span>\n" +
657
720
  "\n" +
@@ -842,7 +905,7 @@ EOB
842
905
  @book.config["highlight"]["html"] = "rouge"
843
906
  actual = compile_block("//listnum[samplelist][this is @<b>{test}<&>_][ruby]{\ndef foo(a1, a2=:test)\n (1..3).times{|i| a.include?(:foo)}\n return true\nend\n\n//}\n")
844
907
 
845
- assert_equal "<div id=\"samplelist\" class=\"code\">\n<p class=\"caption\">リスト1.1: this is <b>test</b>&lt;&amp;&gt;_</p>\n<table class=\"highlight rouge-table\"><tbody><tr><td class=\"rouge-gutter gl\"><pre class=\"lineno\">1\n2\n3\n4\n5\n</pre></td><td class=\"rouge-code\"><pre><span class=\"k\">def</span> <span class=\"nf\">foo</span><span class=\"p\">(</span><span class=\"n\">a1</span><span class=\"p\">,</span> <span class=\"n\">a2</span><span class=\"o\">=</span><span class=\"ss\">:test</span><span class=\"p\">)</span>\n <span class=\"p\">(</span><span class=\"mi\">1</span><span class=\"p\">.</span><span class=\"nf\">.</span><span class=\"mi\">3</span><span class=\"p\">).</span><span class=\"nf\">times</span><span class=\"p\">{</span><span class=\"o\">|</span><span class=\"n\">i</span><span class=\"o\">|</span> <span class=\"n\">a</span><span class=\"p\">.</span><span class=\"nf\">include?</span><span class=\"p\">(</span><span class=\"ss\">:foo</span><span class=\"p\">)}</span>\n <span class=\"k\">return</span> <span class=\"kp\">true</span>\n<span class=\"k\">end</span>\n\n</pre></td></tr></tbody></table>\n</div>\n", actual
908
+ assert_equal "<div id=\"samplelist\" class=\"code\">\n<p class=\"caption\">リスト1.1: this is <b>test</b>&lt;&amp;&gt;_</p>\n<table class=\"highlight rouge-table\"><tbody><tr><td class=\"rouge-gutter gl\"><pre class=\"lineno\">1\n2\n3\n4\n5\n</pre></td><td class=\"rouge-code\"><pre><span class=\"k\">def</span> <span class=\"nf\">foo</span><span class=\"p\">(</span><span class=\"n\">a1</span><span class=\"p\">,</span> <span class=\"n\">a2</span><span class=\"o\">=</span><span class=\"ss\">:test</span><span class=\"p\">)</span>\n <span class=\"p\">(</span><span class=\"mi\">1</span><span class=\"o\">..</span><span class=\"mi\">3</span><span class=\"p\">).</span><span class=\"nf\">times</span><span class=\"p\">{</span><span class=\"o\">|</span><span class=\"n\">i</span><span class=\"o\">|</span> <span class=\"n\">a</span><span class=\"p\">.</span><span class=\"nf\">include?</span><span class=\"p\">(</span><span class=\"ss\">:foo</span><span class=\"p\">)}</span>\n <span class=\"k\">return</span> <span class=\"kp\">true</span>\n<span class=\"k\">end</span>\n\n</pre></td></tr></tbody></table>\n</div>\n", actual
846
909
  end
847
910
 
848
911
  def test_listnum_rouge_lang_linenum
@@ -868,7 +931,7 @@ EOB
868
931
  103
869
932
  104
870
933
  </pre></td><td class="rouge-code"><pre><span class="k">def</span> <span class="nf">foo</span><span class="p">(</span><span class="n">a1</span><span class="p">,</span> <span class="n">a2</span><span class="o">=</span><span class="ss">:test</span><span class="p">)</span>
871
- <span class="p">(</span><span class="mi">1</span><span class="p">.</span><span class="nf">.</span><span class="mi">3</span><span class="p">).</span><span class="nf">times</span><span class="p">{</span><span class="o">|</span><span class="n">i</span><span class="o">|</span> <span class="n">a</span><span class="p">.</span><span class="nf">include?</span><span class="p">(</span><span class="ss">:foo</span><span class="p">)}</span>
934
+ <span class="p">(</span><span class="mi">1</span><span class="o">..</span><span class="mi">3</span><span class="p">).</span><span class="nf">times</span><span class="p">{</span><span class="o">|</span><span class="n">i</span><span class="o">|</span> <span class="n">a</span><span class="p">.</span><span class="nf">include?</span><span class="p">(</span><span class="ss">:foo</span><span class="p">)}</span>
872
935
  <span class="k">return</span> <span class="kp">true</span>
873
936
  <span class="k">end</span>
874
937
 
@@ -1516,6 +1579,12 @@ EOS
1516
1579
  assert_equal %Q|<p><span class="tableref">表1.1</span></p>\n|, actual
1517
1580
  end
1518
1581
 
1582
+ def test_emtable
1583
+ actual = compile_block("//emtable[foo]{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n//emtable{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
1584
+ assert_equal %Q|<div class="table">\n<p class="caption">foo</p>\n<table>\n<tr><th>aaa</th><th>bbb</th></tr>\n<tr><td>ccc</td><td>ddd&lt;&gt;&amp;</td></tr>\n</table>\n</div>\n<div class="table">\n<table>\n<tr><th>aaa</th><th>bbb</th></tr>\n<tr><td>ccc</td><td>ddd&lt;&gt;&amp;</td></tr>\n</table>\n</div>\n|,
1585
+ actual
1586
+ end
1587
+
1519
1588
  def test_imgtable
1520
1589
  def @chapter.image(id)
1521
1590
  item = Book::ImageIndex::Item.new("sampleimg",1, 'sample img')
@@ -46,7 +46,6 @@ class IDGXMLBuidlerTest < Test::Unit::TestCase
46
46
  assert_equal %Q|<title id="test" aid:pstyle="h3">this is test.</title><?dtp level="3" section="this is test."?>|, actual
47
47
  end
48
48
 
49
-
50
49
  def test_headline_level3_with_secno
51
50
  @config["secnolevel"] = 3
52
51
  actual = compile_block("==={test} this is test.\n")
@@ -138,6 +137,12 @@ class IDGXMLBuidlerTest < Test::Unit::TestCase
138
137
  assert_equal %Q|<table><tbody xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/" aid:table="table" aid:trows="1" aid:tcols="1"><td xyh="1,1,0" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="28.458">A</td></tbody></table>|, actual
139
138
  end
140
139
 
140
+ def test_emtable
141
+ actual = compile_block("//emtable[foo]{\nA\n//}\n//emtable{\nA\n//}")
142
+ assert_equal %Q|<table><caption>foo</caption><tbody xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/" aid:table="table" aid:trows="1" aid:tcols="1"><td xyh="1,1,0" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="28.345">A</td></tbody></table><table><tbody xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/" aid:table="table" aid:trows="1" aid:tcols="1"><td xyh="1,1,0" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="28.345">A</td></tbody></table>|,
143
+ actual
144
+ end
145
+
141
146
  def test_inline_br
142
147
  actual = compile_inline("@<br>{}")
143
148
  assert_equal %Q|\n|, actual
@@ -183,6 +188,11 @@ class IDGXMLBuidlerTest < Test::Unit::TestCase
183
188
  assert_equal %Q|<replace idref="texinline-1"><pre>\\sin</pre></replace> <replace idref="texinline-2"><pre>\\frac{1}{2}</pre></replace>|, actual
184
189
  end
185
190
 
191
+ def test_dlist_beforeulol
192
+ actual = compile_block(" : foo\n foo.\n\npara\n\n : foo\n foo.\n\n 1. bar\n\n : foo\n foo.\n\n * bar\n")
193
+ assert_equal %Q|<dl><dt>foo</dt><dd>foo.</dd></dl><p>para</p><dl><dt>foo</dt><dd>foo.</dd></dl><ol><li aid:pstyle="ol-item" olnum="1" num="1">bar</li></ol><dl><dt>foo</dt><dd>foo.</dd></dl><ul><li aid:pstyle="ul-item">bar</li></ul>|, actual
194
+ end
195
+
186
196
  def test_paragraph
187
197
  actual = compile_block("foo\nbar\n")
188
198
  assert_equal %Q|<p>foobar</p>|, actual
@@ -659,7 +669,6 @@ EOS
659
669
  assert_equal expected, actual
660
670
  end
661
671
 
662
-
663
672
  def test_block_raw0
664
673
  actual = compile_block("//raw[<>!\"\\n& ]\n")
665
674
  expected = %Q(<>!\"\n& )
@@ -146,7 +146,6 @@ class IndexTest < Test::Unit::TestCase
146
146
  assert_equal "1.1.1", index.number('target')
147
147
  end
148
148
 
149
-
150
149
  def test_HeadelineIndex7
151
150
  src = <<-EOB
152
151
  = chap1
@@ -53,7 +53,6 @@ class LATEXBuidlerTest < Test::Unit::TestCase
53
53
  assert_equal %Q|\\subsection*{this is test.}\n\\label{sec:1-0-1}\n|, actual
54
54
  end
55
55
 
56
-
57
56
  def test_headline_level3_with_secno
58
57
  @config["secnolevel"] = 3
59
58
  actual = compile_block("==={test} this is test.\n")
@@ -253,6 +252,11 @@ class LATEXBuidlerTest < Test::Unit::TestCase
253
252
  assert_equal %Q|\n\\begin{description}\n\\item[foo\\lbrack{}bar\\rbrack{}] \\mbox{} \\\\\nfoo.bar.\n\\end{description}\n|, actual
254
253
  end
255
254
 
255
+ def test_dlist_beforeulol
256
+ actual = compile_block(" : foo\n foo.\n\npara\n\n : foo\n foo.\n\n 1. bar\n\n : foo\n foo.\n\n * bar\n")
257
+ assert_equal %Q|\n\\begin{description}\n\\item[foo] \\mbox{} \\\\\nfoo.\n\\end{description}\n\npara\n\n\\begin{description}\n\\item[foo] \\mbox{} \\\\\nfoo.\n\\end{description}\n\n\\begin{enumerate}\n\\item bar\n\\end{enumerate}\n\n\\begin{description}\n\\item[foo] \\mbox{} \\\\\nfoo.\n\\end{description}\n\n\\begin{itemize}\n\\item bar\n\\end{itemize}\n|, actual
258
+ end
259
+
256
260
  def test_cmd
257
261
  actual = compile_block("//cmd{\nfoo\nbar\n\nbuz\n//}\n")
258
262
  assert_equal %Q|\n\\begin{reviewcmd}\nfoo\nbar\n\nbuz\n\\end{reviewcmd}\n|, actual
@@ -290,7 +294,6 @@ class LATEXBuidlerTest < Test::Unit::TestCase
290
294
  assert_equal %Q|\n\\vspace{-1.5em}\\begin{reviewemlistlst}[title={\\relax},language={sql}]\nSELECT COUNT(*) FROM tests WHERE tests.no > 10 AND test.name LIKE 'ABC%'\n\\end{reviewemlistlst}\n|, actual
291
295
  end
292
296
 
293
-
294
297
  def test_emlist_caption
295
298
  actual = compile_block("//emlist[cap1]{\nfoo\nbar\n\nbuz\n//}\n")
296
299
  assert_equal %Q|\n\\reviewemlistcaption{cap1}\n\\begin{reviewemlist}\nfoo\nbar\n\nbuz\n\\end{reviewemlist}\n|, actual
@@ -542,6 +545,12 @@ class LATEXBuidlerTest < Test::Unit::TestCase
542
545
  assert_equal %Q(\\begin{reviewtable}{|p{5mm}|cr|}\n\\hline\n\\reviewth{A} & B & C \\\\ \\hline\n\\end{reviewtable}\n), actual
543
546
  end
544
547
 
548
+ def test_emtable
549
+ actual = compile_block("//emtable[foo]{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n//emtable{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
550
+ assert_equal "\\begin{table}[h]\n\\reviewtablecaption*{foo}\n\\begin{reviewtable}{|l|l|}\n\\hline\n\\reviewth{aaa} & \\reviewth{bbb} \\\\ \\hline\nccc & ddd\\textless{}\\textgreater{}\\& \\\\ \\hline\n\\end{reviewtable}\n\\end{table}\n\n\\begin{reviewtable}{|l|l|}\n\\hline\n\\reviewth{aaa} & \\reviewth{bbb} \\\\ \\hline\nccc & ddd\\textless{}\\textgreater{}\\& \\\\ \\hline\n\\end{reviewtable}\n",
551
+ actual
552
+ end
553
+
545
554
  def test_imgtable
546
555
  def @chapter.image(id)
547
556
  item = Book::ImageIndex::Item.new("sampleimg",1, 'sample img')
@@ -937,4 +946,89 @@ EOS
937
946
  actual = compile_inline("test @<comment>{コメント} test2")
938
947
  assert_equal %Q|test \\pdfcomment{コメント} test2|, actual
939
948
  end
949
+
950
+ def test_appendix_list
951
+ @chapter.instance_eval do
952
+ def on_APPENDIX?
953
+ true
954
+ end
955
+ end
956
+ src =<<-EOS
957
+ @<list>{foo}
958
+ //list[foo][FOO]{
959
+ //}
960
+ EOS
961
+ expected =<<-EOS
962
+
963
+ \\reviewlistref{A.1}
964
+
965
+ \\reviewlistcaption{リストA.1: FOO}
966
+ \\begin{reviewlist}
967
+ \\end{reviewlist}
968
+ EOS
969
+ actual = compile_block(src)
970
+ assert_equal expected, actual
971
+ end
972
+
973
+ def test_appendix_table
974
+ @chapter.instance_eval do
975
+ def on_APPENDIX?
976
+ true
977
+ end
978
+ end
979
+ src =<<-EOS
980
+ @<table>{foo}
981
+ //table[foo][FOO]{
982
+ A B
983
+ //}
984
+ EOS
985
+ expected =<<-EOS
986
+
987
+ \\reviewtableref{A.1}{table:chap1:foo}
988
+
989
+ \\begin{table}[h]
990
+ \\reviewtablecaption{FOO}
991
+ \\label{table:chap1:foo}
992
+ \\begin{reviewtable}{|l|l|}
993
+ \\hline
994
+ \\reviewth{A} & B \\\\ \\hline
995
+ \\end{reviewtable}
996
+ \\end{table}
997
+ EOS
998
+ actual = compile_block(src)
999
+ assert_equal expected, actual
1000
+ end
1001
+
1002
+ def test_appendix_image
1003
+ @chapter.instance_eval do
1004
+ def on_APPENDIX?
1005
+ true
1006
+ end
1007
+ end
1008
+
1009
+ def @chapter.image(id)
1010
+ item = Book::NumberlessImageIndex::Item.new("sampleimg", 1)
1011
+ item.instance_eval{@path="./images/chap1-sampleimg.png"}
1012
+ item
1013
+ end
1014
+
1015
+ src =<<-EOS
1016
+ @<img>{sampleimg}
1017
+ //image[sampleimg][FOO]{
1018
+ //}
1019
+ EOS
1020
+ expected =<<-EOS
1021
+
1022
+ \\reviewimageref{A.1}{image:chap1:sampleimg}
1023
+
1024
+ \\begin{reviewimage}
1025
+ \\includegraphics[width=\\maxwidth]{./images/chap1-sampleimg.png}
1026
+ \\caption{FOO}
1027
+ \\label{image:chap1:sampleimg}
1028
+ \\end{reviewimage}
1029
+ EOS
1030
+ actual = compile_block(src)
1031
+ assert_equal expected, actual
1032
+ end
1033
+
940
1034
  end
@@ -121,7 +121,6 @@ class PDFMakerTest < Test::Unit::TestCase
121
121
  end
122
122
  end
123
123
 
124
-
125
124
  def test_make_okuduke_dojin
126
125
  @config.merge!({
127
126
  "aut"=>["テスト太郎","テスト次郎"],
@@ -150,6 +150,11 @@ class RSTBuidlerTest < Test::Unit::TestCase
150
150
  assert_equal %Q| * - ★1☆\n - ▲2☆\n * - ★3☆\n - ▲4☆<>&\n\n|, actual
151
151
  end
152
152
 
153
+ def test_emtable
154
+ actual = compile_block("//emtable[foo]{\nA\n//}\n//emtable{\nA\n//}")
155
+ assert_equal %Q|.. list-table:: foo\n :header-rows: 1\n\n * - A\n\n * - A\n\n|, actual
156
+ end
157
+
153
158
  def test_paragraph
154
159
  actual = compile_block("foo\nbar\n")
155
160
  assert_equal %Q|foobar\n\n|, actual
@@ -147,7 +147,12 @@ class TOPBuidlerTest < Test::Unit::TestCase
147
147
 
148
148
  def test_inline_in_table
149
149
  actual = compile_block("//table{\n★1☆\t▲2☆\n------------\n★3☆\t▲4☆<>&\n//}\n")
150
- assert_equal %Q|★★1☆☆\t★▲2☆☆\n★3☆\t▲4☆<>&\n◆→終了:表←◆\n\n|, actual
150
+ assert_equal %Q|◆→開始:表←◆\n★★1☆☆\t★▲2☆☆\n★3☆\t▲4☆<>&\n◆→終了:表←◆\n\n|, actual
151
+ end
152
+
153
+ def test_dlist_beforeulol
154
+ actual = compile_block(" : foo\n foo.\n\npara\n\n : foo\n foo.\n\n 1. bar\n\n : foo\n foo.\n\n * bar\n")
155
+ assert_equal %Q|★foo☆\n\tfoo.\n\t\n\npara\n\n★foo☆\n\tfoo.\n\t\n\n1\tbar\n\n★foo☆\n\tfoo.\n\t\n\n●\tbar\n\n|, actual
151
156
  end
152
157
 
153
158
  def test_paragraph
@@ -210,6 +215,26 @@ class TOPBuidlerTest < Test::Unit::TestCase
210
215
  assert_equal %Q|[1]|, compile_inline("@<bib>{samplebib}")
211
216
  end
212
217
 
218
+ def test_table
219
+ actual = compile_block("//table{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
220
+ assert_equal %Q|◆→開始:表←◆\n★aaa☆\t★bbb☆\nccc\tddd<>&\n◆→終了:表←◆\n\n|,
221
+ actual
222
+ end
223
+
224
+ def test_inline_table
225
+ def @chapter.table(id)
226
+ Book::TableIndex::Item.new("sampletable",1)
227
+ end
228
+ actual = compile_block("@<table>{sampletest}\n")
229
+ assert_equal %Q|表1.1\n|, actual
230
+ end
231
+
232
+ def test_emtable
233
+ actual = compile_block("//emtable[foo]{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n//emtable{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
234
+ assert_equal %Q|◆→開始:表←◆\nfoo\n\n★aaa☆\t★bbb☆\nccc\tddd<>&\n◆→終了:表←◆\n\n◆→開始:表←◆\n★aaa☆\t★bbb☆\nccc\tddd<>&\n◆→終了:表←◆\n\n|,
235
+ actual
236
+ end
237
+
213
238
  def test_major_blocks
214
239
  actual = compile_block("//note{\nA\n\nB\n//}\n//note[caption]{\nA\n//}")
215
240
  expected = %Q(◆→開始:ノート←◆\nA\nB\n◆→終了:ノート←◆\n\n◆→開始:ノート←◆\n■caption\nA\n◆→終了:ノート←◆\n\n)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: review
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - kmuto
@@ -113,17 +113,17 @@ executables:
113
113
  - review-vol
114
114
  - review-webmaker
115
115
  extensions: []
116
- extra_rdoc_files:
117
- - ChangeLog
116
+ extra_rdoc_files: []
118
117
  files:
119
118
  - ".gitignore"
120
119
  - ".rubocop.yml"
121
120
  - ".rubocop_todo.yml"
122
121
  - ".travis.yml"
123
122
  - COPYING
124
- - ChangeLog
125
123
  - Dockerfile
126
124
  - Gemfile
125
+ - NEWS.ja.md
126
+ - NEWS.md
127
127
  - README.md
128
128
  - Rakefile
129
129
  - appveyor.yml
@@ -154,8 +154,7 @@ files:
154
154
  - debian/review.links
155
155
  - debian/rules
156
156
  - debian/source/format
157
- - doc/NEWS.ja.md
158
- - doc/NEWS.md
157
+ - doc/ChangeLog-0.x_to_2.0
159
158
  - doc/catalog.ja.md
160
159
  - doc/catalog.md
161
160
  - doc/config.yml.sample
@@ -333,7 +332,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
333
332
  version: '0'
334
333
  requirements: []
335
334
  rubyforge_project:
336
- rubygems_version: 2.6.8
335
+ rubygems_version: 2.6.11
337
336
  signing_key:
338
337
  specification_version: 4
339
338
  summary: 'Re:VIEW: a easy-to-use digital publishing system'