tdiary 3.2.2.20130518 → 3.2.2.20130527
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +17 -11
- data/Rakefile +2 -0
- data/config.ru +2 -1
- data/tdiary.gemspec +7 -0
- data/tdiary.rb +6 -2
- data/tdiary/cli.rb +27 -1
- data/tdiary/environment.rb +0 -1
- data/tdiary/tasks/release.rake +7 -1
- data/tdiary/version.rb +1 -1
- metadata +87 -132
- data/vendor/hikidoc-0.0.6/COPYING +0 -28
- data/vendor/hikidoc-0.0.6/NEWS +0 -30
- data/vendor/hikidoc-0.0.6/NEWS.ja +0 -30
- data/vendor/hikidoc-0.0.6/README +0 -86
- data/vendor/hikidoc-0.0.6/README.ja +0 -83
- data/vendor/hikidoc-0.0.6/Rakefile +0 -68
- data/vendor/hikidoc-0.0.6/TextFormattingRules +0 -320
- data/vendor/hikidoc-0.0.6/TextFormattingRules.ja +0 -318
- data/vendor/hikidoc-0.0.6/bin/hikidoc +0 -66
- data/vendor/hikidoc-0.0.6/lib/hikidoc.rb +0 -914
- data/vendor/hikidoc-0.0.6/setup.rb +0 -1360
- data/vendor/hikidoc-0.0.6/test/run-test.rb +0 -13
- data/vendor/hikidoc-0.0.6/test/test_hikidoc.rb +0 -506
- data/vendor/imagesize-0.1.1/Manifest.txt +0 -19
- data/vendor/imagesize-0.1.1/README.txt +0 -49
- data/vendor/imagesize-0.1.1/lib/image_size.rb +0 -305
- data/vendor/imagesize-0.1.1/lib/image_size/version.rb +0 -9
- data/vendor/imagesize-0.1.1/setup.rb +0 -1585
- data/vendor/imagesize-0.1.1/test/2-4-7.png +0 -0
- data/vendor/imagesize-0.1.1/test/4_1_2.gif +0 -0
- data/vendor/imagesize-0.1.1/test/bmp.bmp +0 -0
- data/vendor/imagesize-0.1.1/test/cursor.xbm +0 -6
- data/vendor/imagesize-0.1.1/test/detect.swf +0 -0
- data/vendor/imagesize-0.1.1/test/pbm.pbm +0 -0
- data/vendor/imagesize-0.1.1/test/pcx.pcx +0 -0
- data/vendor/imagesize-0.1.1/test/pgm.pgm +0 -5
- data/vendor/imagesize-0.1.1/test/test.xpm +0 -38
- data/vendor/imagesize-0.1.1/test/test_helper.rb +0 -2
- data/vendor/imagesize-0.1.1/test/test_image_size.rb +0 -71
- data/vendor/imagesize-0.1.1/test/tiff.tiff +0 -0
- data/vendor/imagesize-0.1.1/test/tokyo_tower.jpg +0 -0
- data/vendor/imagesize-0.1.1/test/tower_e.gif.psd +0 -0
- data/vendor/rdtool-0.6.38/COPYING.txt +0 -339
- data/vendor/rdtool-0.6.38/Gemfile +0 -3
- data/vendor/rdtool-0.6.38/HISTORY +0 -318
- data/vendor/rdtool-0.6.38/LGPL-2.1 +0 -502
- data/vendor/rdtool-0.6.38/LICENSE.txt +0 -58
- data/vendor/rdtool-0.6.38/README.html +0 -66
- data/vendor/rdtool-0.6.38/README.ja.html +0 -73
- data/vendor/rdtool-0.6.38/README.rd +0 -76
- data/vendor/rdtool-0.6.38/README.rd.ja +0 -85
- data/vendor/rdtool-0.6.38/Rakefile +0 -152
- data/vendor/rdtool-0.6.38/TODO +0 -22
- data/vendor/rdtool-0.6.38/bin/rd2 +0 -283
- data/vendor/rdtool-0.6.38/bin/rdswap.rb +0 -207
- data/vendor/rdtool-0.6.38/doc/rd-draft.html +0 -456
- data/vendor/rdtool-0.6.38/doc/rd-draft.ja.html +0 -466
- data/vendor/rdtool-0.6.38/doc/rd-draft.rd +0 -479
- data/vendor/rdtool-0.6.38/doc/rd-draft.rd.ja +0 -487
- data/vendor/rdtool-0.6.38/lib/rd/block-element.rb +0 -114
- data/vendor/rdtool-0.6.38/lib/rd/complex-list-item.rb +0 -65
- data/vendor/rdtool-0.6.38/lib/rd/desclist.rb +0 -55
- data/vendor/rdtool-0.6.38/lib/rd/document-struct.rb +0 -46
- data/vendor/rdtool-0.6.38/lib/rd/dot.rd2rc +0 -18
- data/vendor/rdtool-0.6.38/lib/rd/element.rb +0 -160
- data/vendor/rdtool-0.6.38/lib/rd/filter.rb +0 -255
- data/vendor/rdtool-0.6.38/lib/rd/head-filter.rb +0 -14
- data/vendor/rdtool-0.6.38/lib/rd/inline-element.rb +0 -233
- data/vendor/rdtool-0.6.38/lib/rd/labeled-element.rb +0 -14
- data/vendor/rdtool-0.6.38/lib/rd/list.rb +0 -57
- data/vendor/rdtool-0.6.38/lib/rd/loose-struct.rb +0 -11
- data/vendor/rdtool-0.6.38/lib/rd/methodlist.rb +0 -57
- data/vendor/rdtool-0.6.38/lib/rd/output-format-visitor.rb +0 -30
- data/vendor/rdtool-0.6.38/lib/rd/package.rb +0 -4
- data/vendor/rdtool-0.6.38/lib/rd/parser-util.rb +0 -14
- data/vendor/rdtool-0.6.38/lib/rd/post-install +0 -1
- data/vendor/rdtool-0.6.38/lib/rd/pre-setup.rb +0 -18
- data/vendor/rdtool-0.6.38/lib/rd/rbl-file.rb +0 -69
- data/vendor/rdtool-0.6.38/lib/rd/rbl-suite.rb +0 -37
- data/vendor/rdtool-0.6.38/lib/rd/rd-struct.rb +0 -86
- data/vendor/rdtool-0.6.38/lib/rd/rd2html-ext-lib.rb +0 -266
- data/vendor/rdtool-0.6.38/lib/rd/rd2html-ext-opt.rb +0 -34
- data/vendor/rdtool-0.6.38/lib/rd/rd2html-lib.rb +0 -490
- data/vendor/rdtool-0.6.38/lib/rd/rd2html-opt.rb +0 -67
- data/vendor/rdtool-0.6.38/lib/rd/rd2man-lib.rb +0 -251
- data/vendor/rdtool-0.6.38/lib/rd/rd2rdo-lib.rb +0 -19
- data/vendor/rdtool-0.6.38/lib/rd/rd2rmi-lib.rb +0 -32
- data/vendor/rdtool-0.6.38/lib/rd/rdblockparser.ry +0 -518
- data/vendor/rdtool-0.6.38/lib/rd/rdblockparser.tab.rb +0 -1061
- data/vendor/rdtool-0.6.38/lib/rd/rdfmt.rb +0 -15
- data/vendor/rdtool-0.6.38/lib/rd/rdinlineparser.ry +0 -503
- data/vendor/rdtool-0.6.38/lib/rd/rdinlineparser.tab.rb +0 -1243
- data/vendor/rdtool-0.6.38/lib/rd/rdvisitor.rb +0 -214
- data/vendor/rdtool-0.6.38/lib/rd/reference-resolver.rb +0 -114
- data/vendor/rdtool-0.6.38/lib/rd/search-file.rb +0 -14
- data/vendor/rdtool-0.6.38/lib/rd/tree.rb +0 -103
- data/vendor/rdtool-0.6.38/lib/rd/version.rb +0 -41
- data/vendor/rdtool-0.6.38/lib/rd/visitor.rb +0 -86
- data/vendor/rdtool-0.6.38/rdtool.gemspec +0 -125
- data/vendor/rdtool-0.6.38/setup.rb +0 -1596
- data/vendor/rdtool-0.6.38/test/data/includee1.html +0 -1
- data/vendor/rdtool-0.6.38/test/data/includee2.html +0 -1
- data/vendor/rdtool-0.6.38/test/data/includee3.nothtml +0 -1
- data/vendor/rdtool-0.6.38/test/data/includee4.xhtml +0 -0
- data/vendor/rdtool-0.6.38/test/data/label.rbl +0 -2
- data/vendor/rdtool-0.6.38/test/data/label2.rbl +0 -2
- data/vendor/rdtool-0.6.38/test/data/sub/includee2.html +0 -1
- data/vendor/rdtool-0.6.38/test/data/sub/includee4.html +0 -0
- data/vendor/rdtool-0.6.38/test/dummy-observer.rb +0 -6
- data/vendor/rdtool-0.6.38/test/dummy.rb +0 -33
- data/vendor/rdtool-0.6.38/test/temp-dir.rb +0 -19
- data/vendor/rdtool-0.6.38/test/test-block-parser.rb +0 -46
- data/vendor/rdtool-0.6.38/test/test-desclist-item.rb +0 -219
- data/vendor/rdtool-0.6.38/test/test-document-element.rb +0 -46
- data/vendor/rdtool-0.6.38/test/test-document-struct.rb +0 -66
- data/vendor/rdtool-0.6.38/test/test-element.rb +0 -46
- data/vendor/rdtool-0.6.38/test/test-headline.rb +0 -80
- data/vendor/rdtool-0.6.38/test/test-inline-parser.rb +0 -46
- data/vendor/rdtool-0.6.38/test/test-list-item.rb +0 -54
- data/vendor/rdtool-0.6.38/test/test-list.rb +0 -53
- data/vendor/rdtool-0.6.38/test/test-methodlist-item.rb +0 -73
- data/vendor/rdtool-0.6.38/test/test-nonterminal-element.rb +0 -170
- data/vendor/rdtool-0.6.38/test/test-nonterminal-inline.rb +0 -33
- data/vendor/rdtool-0.6.38/test/test-output-format-visitor.rb +0 -48
- data/vendor/rdtool-0.6.38/test/test-parser-util.rb +0 -41
- data/vendor/rdtool-0.6.38/test/test-rbl-file.rb +0 -156
- data/vendor/rdtool-0.6.38/test/test-rbl-suite.rb +0 -43
- data/vendor/rdtool-0.6.38/test/test-rd2html-lib.rb +0 -496
- data/vendor/rdtool-0.6.38/test/test-rdtree.rb +0 -17
- data/vendor/rdtool-0.6.38/test/test-rdvisitor.rb +0 -29
- data/vendor/rdtool-0.6.38/test/test-reference-resolver.rb +0 -202
- data/vendor/rdtool-0.6.38/test/test-reference.rb +0 -132
- data/vendor/rdtool-0.6.38/test/test-search-file.rb +0 -22
- data/vendor/rdtool-0.6.38/test/test-terminal-inline.rb +0 -41
- data/vendor/rdtool-0.6.38/test/test-textblock.rb +0 -44
- data/vendor/rdtool-0.6.38/test/test-tree.rb +0 -82
- data/vendor/rdtool-0.6.38/test/test-version.rb +0 -57
- data/vendor/rdtool-0.6.38/test/test-visitor.rb +0 -230
- data/vendor/rdtool-0.6.38/utils/rd-mode.el +0 -464
@@ -1 +0,0 @@
|
|
1
|
-
includee1.html
|
@@ -1 +0,0 @@
|
|
1
|
-
includee2.html
|
@@ -1 +0,0 @@
|
|
1
|
-
includee3.nothtml
|
File without changes
|
@@ -1 +0,0 @@
|
|
1
|
-
sub/includee2.html
|
File without changes
|
@@ -1,33 +0,0 @@
|
|
1
|
-
require "rd/element"
|
2
|
-
require "rd/document-struct"
|
3
|
-
require "rd/visitor"
|
4
|
-
|
5
|
-
module RD
|
6
|
-
class DummyElement < Element
|
7
|
-
attr_accessor :parent
|
8
|
-
|
9
|
-
def children
|
10
|
-
[]
|
11
|
-
end
|
12
|
-
|
13
|
-
def each_element
|
14
|
-
yield(self)
|
15
|
-
end
|
16
|
-
|
17
|
-
def accept(visitor)
|
18
|
-
"dummy"
|
19
|
-
end
|
20
|
-
|
21
|
-
def to_label
|
22
|
-
" label "
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
DummyStruct = DocumentStructure.new
|
27
|
-
end
|
28
|
-
|
29
|
-
class DummyVisitor < RD::Visitor
|
30
|
-
def method_missing(method, *args)
|
31
|
-
[method.to_s, args]
|
32
|
-
end
|
33
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
|
2
|
-
def in_temp_dir
|
3
|
-
tmpdir = "test-tmp.#$$"
|
4
|
-
pwd = Dir.pwd
|
5
|
-
Dir.mkdir(tmpdir)
|
6
|
-
Dir.chdir(tmpdir)
|
7
|
-
begin
|
8
|
-
yield
|
9
|
-
ensure
|
10
|
-
Dir.chdir(pwd)
|
11
|
-
Dir.rmdir(tmpdir)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def remove_file(file)
|
16
|
-
if File.exist? file
|
17
|
-
File.unlink(file)
|
18
|
-
end
|
19
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
|
3
|
-
require 'rd/rdblockparser.tab'
|
4
|
-
require 'rd/rd-struct'
|
5
|
-
|
6
|
-
include RD
|
7
|
-
|
8
|
-
class TestBlockParser < Test::Unit::TestCase
|
9
|
-
def setup
|
10
|
-
@p = RDParser.new
|
11
|
-
@p.class.module_eval {
|
12
|
-
public :cut_off,:set_term_to_element
|
13
|
-
}
|
14
|
-
@p.instance_eval do
|
15
|
-
@tree = Tree.new_with_document_struct(DocumentStructure::RD)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_cut_off
|
20
|
-
assert_equal(["aaaa"], @p.cut_off(["aaaa"]))
|
21
|
-
assert_equal(["aaaa\n"], @p.cut_off(["aaaa\n"]))
|
22
|
-
assert_equal(["aaaa\n"], @p.cut_off([" aaaa\n"]))
|
23
|
-
assert_equal(["aaaa\n", "bbbb\n"], @p.cut_off([" aaaa\n", " bbbb\n"]))
|
24
|
-
assert_equal(["aaaa\n", " bbbb\n"], @p.cut_off(["aaaa\n", " bbbb\n"]))
|
25
|
-
assert_equal(["aaaa\n", " bbbb\n"], @p.cut_off([" aaaa\n", " bbbb\n"]))
|
26
|
-
assert_equal(["aaaa\n", " bbbb\n", " cccc\n"],
|
27
|
-
@p.cut_off([" aaaa\n", " bbbb\n", " cccc\n"]))
|
28
|
-
assert_equal(["aaaa\n", " bbbb\n", " cccc\n"],
|
29
|
-
@p.cut_off([" aaaa\n", " bbbb\n", " cccc\n"]))
|
30
|
-
assert_raises(RuntimeError) do
|
31
|
-
@p.cut_off([" aaaa\n", "bbbb\n"])
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_set_term_to_element
|
36
|
-
desclist = DescListItem.new
|
37
|
-
term = DescListItem::Term.new
|
38
|
-
@p.set_term_to_element(desclist, term)
|
39
|
-
assert_equal(term, desclist.term)
|
40
|
-
|
41
|
-
methodlist = MethodListItem.new
|
42
|
-
term = MethodListItem::Term.new "string"
|
43
|
-
@p.set_term_to_element(methodlist, term)
|
44
|
-
assert_equal(term, methodlist.term)
|
45
|
-
end
|
46
|
-
end
|
@@ -1,219 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
|
3
|
-
require 'rd/desclist'
|
4
|
-
require 'rd/rd-struct'
|
5
|
-
|
6
|
-
include RD
|
7
|
-
|
8
|
-
class TestDescListItem < Test::Unit::TestCase
|
9
|
-
def setup
|
10
|
-
@flat = DescListItem.new
|
11
|
-
@t1 = DescListItem::Term.new
|
12
|
-
@flat.set_term_under_document_struct(@t1, DocumentStructure::RD)
|
13
|
-
@c1 = TextBlock.new
|
14
|
-
@c2 = ItemList.new
|
15
|
-
@flat.add_children_under_document_struct([@c1, @c2],
|
16
|
-
DocumentStructure::RD)
|
17
|
-
|
18
|
-
@nest = DescListItem.new
|
19
|
-
@t2 = DescListItem::Term.new
|
20
|
-
@t21 = StringElement.new ""
|
21
|
-
@t2.add_child_under_document_struct(@t21, DocumentStructure::RD)
|
22
|
-
@nest.set_term_under_document_struct(@t2, DocumentStructure::RD)
|
23
|
-
@d1 = TextBlock.new
|
24
|
-
@d11 = StringElement.new ""
|
25
|
-
@d1.add_child_under_document_struct(@d11, DocumentStructure::RD)
|
26
|
-
@nest.add_children_under_document_struct([@d1],
|
27
|
-
DocumentStructure::RD)
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_set_term_under_docment_struct
|
31
|
-
t = DescListItem::Term.new
|
32
|
-
i = DescListItem.new
|
33
|
-
i.set_term_under_document_struct(t, DocumentStructure::RD)
|
34
|
-
assert_equal(t, i.term)
|
35
|
-
assert_equal(i, t.parent)
|
36
|
-
|
37
|
-
assert_raises(ArgumentError) do
|
38
|
-
t = StringElement.new ""
|
39
|
-
DescListItem.new.set_term_under_document_struct(t, DocumentStructure::RD)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
def test_assign_term
|
44
|
-
desclist = DescListItem.new
|
45
|
-
term = DescListItem::Term.new
|
46
|
-
desclist.assign_term(term)
|
47
|
-
assert_equal(term, desclist.term)
|
48
|
-
assert_equal(desclist, term.parent)
|
49
|
-
end
|
50
|
-
|
51
|
-
def test_set_term_without_document_strcut
|
52
|
-
desclist = DescListItem.new
|
53
|
-
term = DescListItem::Term.new
|
54
|
-
desclist.set_term_without_document_struct(term)
|
55
|
-
assert_equal(term, desclist.term)
|
56
|
-
assert_equal(desclist, term.parent)
|
57
|
-
|
58
|
-
not_term = StringElement.new "not term"
|
59
|
-
desclist.set_term_without_document_struct(not_term)
|
60
|
-
assert_equal(not_term, desclist.term)
|
61
|
-
assert_equal(desclist, not_term.parent)
|
62
|
-
end
|
63
|
-
|
64
|
-
def test_each_block_in_description
|
65
|
-
exp = [@c1, @c2]
|
66
|
-
i = 0
|
67
|
-
@flat.each_block_in_description do |b|
|
68
|
-
assert_equal(exp[i], b)
|
69
|
-
i += 1
|
70
|
-
end
|
71
|
-
|
72
|
-
exp = [@d1]
|
73
|
-
i = 0
|
74
|
-
@nest.each_block_in_description do |b|
|
75
|
-
assert_equal(exp[i], b)
|
76
|
-
i += 1
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
def test_each_element
|
81
|
-
exp = [@flat, @t1, @c1, @c2]
|
82
|
-
i = 0
|
83
|
-
@flat.each_element do |b|
|
84
|
-
assert_equal(exp[i], b)
|
85
|
-
i += 1
|
86
|
-
end
|
87
|
-
|
88
|
-
exp = [@nest, @t2, @t21, @d1, @d11]
|
89
|
-
i = 0
|
90
|
-
@nest.each_element do |b|
|
91
|
-
assert_equal(exp[i], b)
|
92
|
-
i += 1
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
def test_make_term
|
97
|
-
tr = Tree.new_with_document_struct(DocumentStructure::RD)
|
98
|
-
de = DocumentElement.new
|
99
|
-
tr.root = de
|
100
|
-
di, dt = nil
|
101
|
-
de.build do
|
102
|
-
new DescList do
|
103
|
-
di = new DescListItem do
|
104
|
-
dt = make_term do
|
105
|
-
new StringElement, "string"
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
110
|
-
assert_equal("<RD::DescListItem>\n <RD::DescListItem::Term>\n" +
|
111
|
-
" <RD::StringElement>", di.inspect)
|
112
|
-
assert_equal(di.term, dt)
|
113
|
-
|
114
|
-
tr = Tree.new_with_document_struct(DocumentStructure::RD)
|
115
|
-
de = DocumentElement.new
|
116
|
-
tr.root = de
|
117
|
-
di, dt = nil
|
118
|
-
de.build do
|
119
|
-
new DescList do
|
120
|
-
di = new DescListItem do
|
121
|
-
dt = make_term
|
122
|
-
end
|
123
|
-
end
|
124
|
-
end
|
125
|
-
assert_equal(di.term, dt)
|
126
|
-
end
|
127
|
-
|
128
|
-
def test_inspect
|
129
|
-
di = DescListItem.new
|
130
|
-
dt = DescListItem::Term.new
|
131
|
-
se = StringElement.new "string"
|
132
|
-
tb = TextBlock.new
|
133
|
-
di.set_term_under_document_struct(dt, DocumentStructure::RD)
|
134
|
-
di.add_child_under_document_struct(tb, DocumentStructure::RD)
|
135
|
-
dt.add_child_under_document_struct(se, DocumentStructure::RD)
|
136
|
-
assert_equal("<RD::DescListItem>\n <RD::DescListItem::Term>\n" +
|
137
|
-
" <RD::StringElement>\n <RD::TextBlock>", di.inspect)
|
138
|
-
|
139
|
-
di_no_desc = DescListItem.new
|
140
|
-
dt_no_desc = DescListItem::Term.new
|
141
|
-
di_no_desc.set_term_under_document_struct(dt_no_desc,
|
142
|
-
DocumentStructure::RD)
|
143
|
-
assert_equal("<RD::DescListItem>\n <RD::DescListItem::Term>",
|
144
|
-
di_no_desc.inspect)
|
145
|
-
|
146
|
-
di_no_term = DescListItem.new
|
147
|
-
di_no_term.add_child_under_document_struct(TextBlock.new,
|
148
|
-
DocumentStructure::RD)
|
149
|
-
assert_equal("<RD::DescListItem>\n <RD::TextBlock>",
|
150
|
-
di_no_term.inspect)
|
151
|
-
assert_equal("<RD::DescListItem>", DescListItem.new.inspect)
|
152
|
-
end
|
153
|
-
end
|
154
|
-
|
155
|
-
class TestDescListItemTerm < Test::Unit::TestCase
|
156
|
-
def setup
|
157
|
-
@flat = DescListItem::Term.new
|
158
|
-
@c1 = StringElement.new "aaa"
|
159
|
-
@c2 = Emphasis.new
|
160
|
-
@c3 = StringElement.new " bbb"
|
161
|
-
@flat.add_children_under_document_struct([@c1, @c2, @c3],
|
162
|
-
DocumentStructure::RD)
|
163
|
-
|
164
|
-
@nest = DescListItem::Term.new
|
165
|
-
@d1 = StringElement.new "aaa"
|
166
|
-
@d2 = Emphasis.new
|
167
|
-
@d21 = StringElement.new " bbb"
|
168
|
-
@d2.add_child_under_document_struct(@d21, DocumentStructure::RD)
|
169
|
-
@nest.add_children_under_document_struct([@d1, @d2],
|
170
|
-
DocumentStructure::RD)
|
171
|
-
@empty = DescListItem::Term.new
|
172
|
-
end
|
173
|
-
|
174
|
-
def test_each_child
|
175
|
-
exp = [@c1, @c2, @c3]
|
176
|
-
i = 0
|
177
|
-
@flat.each_child do |b|
|
178
|
-
assert_equal(exp[i], b)
|
179
|
-
i += 1
|
180
|
-
end
|
181
|
-
|
182
|
-
exp = [@d1, @d2]
|
183
|
-
i = 0
|
184
|
-
@nest.each_child do |b|
|
185
|
-
assert_equal(exp[i], b)
|
186
|
-
i += 1
|
187
|
-
end
|
188
|
-
end
|
189
|
-
|
190
|
-
def test_each_element
|
191
|
-
exp = [@flat, @c1, @c2, @c3]
|
192
|
-
i = 0
|
193
|
-
@flat.each_element do |b|
|
194
|
-
assert_equal(exp[i], b)
|
195
|
-
i += 1
|
196
|
-
end
|
197
|
-
|
198
|
-
exp = [@nest, @d1, @d2, @d21]
|
199
|
-
i = 0
|
200
|
-
@nest.each_element do |b|
|
201
|
-
assert_equal(exp[i], b)
|
202
|
-
i += 1
|
203
|
-
end
|
204
|
-
|
205
|
-
exp = [@empty]
|
206
|
-
i = 0
|
207
|
-
@empty.each_element do |b|
|
208
|
-
assert_equal(exp[i], b)
|
209
|
-
i += 1
|
210
|
-
end
|
211
|
-
end
|
212
|
-
|
213
|
-
def test_to_label
|
214
|
-
assert_equal("aaa bbb", @flat.to_label)
|
215
|
-
assert_equal("aaabbb", @nest.to_label)
|
216
|
-
assert_equal("", @empty.to_label)
|
217
|
-
end
|
218
|
-
end
|
219
|
-
|
@@ -1,46 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
|
3
|
-
require 'rd/element'
|
4
|
-
require 'rd/rd-struct'
|
5
|
-
|
6
|
-
include RD
|
7
|
-
|
8
|
-
class TestDocumentElement < Test::Unit::TestCase
|
9
|
-
def setup
|
10
|
-
@p = DocumentElement.new
|
11
|
-
@c1 = Headline.new(1)
|
12
|
-
@c2 = TextBlock.new
|
13
|
-
@c3 = ItemList.new
|
14
|
-
@c31 = ItemListItem.new
|
15
|
-
@c311 = TextBlock.new
|
16
|
-
@c31.add_child_under_document_struct(@c311, DocumentStructure::RD)
|
17
|
-
@c3.add_child_under_document_struct(@c31, DocumentStructure::RD)
|
18
|
-
@p.add_children_under_document_struct([@c1, @c2, @c3],
|
19
|
-
DocumentStructure::RD)
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_s_new
|
23
|
-
assert(DocumentElement.new)
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_blocks
|
27
|
-
assert_equal([@c1, @c2, @c3], @p.blocks)
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_each_block
|
31
|
-
i = 1
|
32
|
-
@p.each_block do |b|
|
33
|
-
assert_equal(eval("@c#{i}"), b)
|
34
|
-
i += 1
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_each_element
|
39
|
-
exp = [@p, @c1, @c2, @c3, @c31, @c311]
|
40
|
-
i = 0
|
41
|
-
@p.each_element do |b|
|
42
|
-
assert_equal(exp[i], b)
|
43
|
-
i += 1
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
@@ -1,66 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
|
3
|
-
require 'rd/document-struct.rb'
|
4
|
-
require 'rd/rdfmt'
|
5
|
-
|
6
|
-
class TestDocumentStructure < Test::Unit::TestCase
|
7
|
-
include RD
|
8
|
-
|
9
|
-
def test_each_relationship
|
10
|
-
a = DocumentStructure.new
|
11
|
-
r1 = ElementRelationship.new(TextBlock, InlineElement)
|
12
|
-
r2 = ElementRelationship.new(DocumentElement, BlockElement)
|
13
|
-
r3 = ElementRelationship.new(ListItem, BlockElement)
|
14
|
-
r4 = ElementRelationship.new(ItemList, ItemListItem)
|
15
|
-
exp = [r1, r2, r3, r4]
|
16
|
-
|
17
|
-
a.add_relationships(*exp)
|
18
|
-
|
19
|
-
a.each_relationship do |i|
|
20
|
-
assert(exp.include?(i))
|
21
|
-
exp.delete(i)
|
22
|
-
end
|
23
|
-
assert_equal([], exp)
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_is_valid?
|
27
|
-
a = DocumentStructure.new
|
28
|
-
r1 = ElementRelationship.new(TextBlock, InlineElement)
|
29
|
-
r2 = ElementRelationship.new(DocumentElement, BlockElement)
|
30
|
-
r3 = ElementRelationship.new(ListItem, BlockElement)
|
31
|
-
r4 = ElementRelationship.new(ItemList, ItemListItem)
|
32
|
-
a.add_relationships(r1, r2, r3, r4)
|
33
|
-
|
34
|
-
assert(a.is_valid?(TextBlock.new, Emphasis.new))
|
35
|
-
assert(a.is_valid?(DocumentElement.new, TextBlock.new))
|
36
|
-
assert(a.is_valid?(ItemList.new, ItemListItem.new))
|
37
|
-
assert_false(a.is_valid?(TextBlock.new, Headline.new(1)))
|
38
|
-
assert_false(a.is_valid?(ItemList.new, TextBlock.new))
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
class TestElementRelationship < Test::Unit::TestCase
|
43
|
-
include RD
|
44
|
-
|
45
|
-
def test_match?
|
46
|
-
a = ElementRelationship.new(TextBlock, InlineElement)
|
47
|
-
assert(a.match?(TextBlock.new, Emphasis.new))
|
48
|
-
assert_false(a.match?(TextBlock.new, Headline.new(1)))
|
49
|
-
|
50
|
-
a = ElementRelationship.new(InlineElement, InlineElement)
|
51
|
-
assert(a.match?(Emphasis.new, Code.new))
|
52
|
-
assert_false(a.match?(Emphasis.new, Headline.new(1)))
|
53
|
-
|
54
|
-
a = ElementRelationship.new(DocumentElement, BlockElement)
|
55
|
-
assert(a.match?(DocumentElement.new, Headline.new(1)))
|
56
|
-
assert_false(a.match?(DocumentElement.new, Emphasis.new))
|
57
|
-
|
58
|
-
a = ElementRelationship.new(ItemList, ItemListItem)
|
59
|
-
assert(a.match?(ItemList.new, ItemListItem.new))
|
60
|
-
assert_false(a.match?(ItemList.new, TextBlock.new))
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
def assert_false(cond)
|
65
|
-
assert_equal(false, cond)
|
66
|
-
end
|