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,255 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
= filter.rb
|
3
|
-
Definition of Filter structure.
|
4
|
-
=end
|
5
|
-
|
6
|
-
module RD
|
7
|
-
class Filter
|
8
|
-
attr_accessor :mode
|
9
|
-
|
10
|
-
def initialize(mode = :target, &block)
|
11
|
-
@mode = mode
|
12
|
-
@block = block
|
13
|
-
end
|
14
|
-
|
15
|
-
# inn, out: RD::Part
|
16
|
-
def call(inn)
|
17
|
-
out = RD::Part.new("", nil, "w")
|
18
|
-
result = @block.call(inn, out)
|
19
|
-
if out.empty?
|
20
|
-
result
|
21
|
-
else
|
22
|
-
out.to_s
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
module FileInclude
|
27
|
-
def find_file(file, part)
|
28
|
-
for dir in part.tree.include_path
|
29
|
-
begin
|
30
|
-
return open(dir + "/" + file)
|
31
|
-
rescue
|
32
|
-
next
|
33
|
-
end
|
34
|
-
end
|
35
|
-
nil
|
36
|
-
end
|
37
|
-
module_function :find_file
|
38
|
-
end # Filter::Include
|
39
|
-
end # Filter
|
40
|
-
|
41
|
-
# Build-in Filter
|
42
|
-
# Simple inclusion
|
43
|
-
INCLUDE_FILTER = Filter.new(:target) do |inn, out|
|
44
|
-
inn.each do |line|
|
45
|
-
out.print(line)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
# Simple RD inclusion
|
50
|
-
RD_FILTER = Filter.new(:rd) do |inn, out|
|
51
|
-
out.print("=begin\n")
|
52
|
-
inn.each do |line|
|
53
|
-
out.print(line)
|
54
|
-
end
|
55
|
-
out.print("\n=end\n")
|
56
|
-
end
|
57
|
-
|
58
|
-
# Eval ruby script
|
59
|
-
# "out.print" to output.
|
60
|
-
EVAL_FILTER = Filter.new(:target) do |inn, out|
|
61
|
-
begin
|
62
|
-
eval(inn.to_s)
|
63
|
-
rescue
|
64
|
-
out.print "!!Error occured when eval!!\n"
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
# RD::Part is a pseudo IO class
|
69
|
-
class Part
|
70
|
-
attr(:tree)
|
71
|
-
attr_accessor :lineno
|
72
|
-
attr_accessor :pos
|
73
|
-
|
74
|
-
def initialize(content = "", tree = nil, mode = "r")
|
75
|
-
@content = content
|
76
|
-
if mode == "r"
|
77
|
-
@content.freeze
|
78
|
-
end
|
79
|
-
@tree = tree
|
80
|
-
@pos = 0
|
81
|
-
@lineno = 0
|
82
|
-
@unget = nil
|
83
|
-
end
|
84
|
-
|
85
|
-
def each_line(rs = $/)
|
86
|
-
while line = gets
|
87
|
-
yield(line)
|
88
|
-
end
|
89
|
-
end
|
90
|
-
alias each each_line
|
91
|
-
|
92
|
-
def each_byte
|
93
|
-
while char = getc
|
94
|
-
yield(char)
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
def eof?
|
99
|
-
@pos == @content.size
|
100
|
-
end
|
101
|
-
alias eof eof?
|
102
|
-
|
103
|
-
def get_char(ex)
|
104
|
-
ret = nil
|
105
|
-
if @unget
|
106
|
-
ret = @unget
|
107
|
-
else
|
108
|
-
unless eof?
|
109
|
-
ret = @content[@pos]
|
110
|
-
@pos += 1
|
111
|
-
else
|
112
|
-
raise EOFError if ex
|
113
|
-
end
|
114
|
-
end
|
115
|
-
ret
|
116
|
-
end
|
117
|
-
private :get_char
|
118
|
-
|
119
|
-
def getc
|
120
|
-
get_char(nil)
|
121
|
-
end
|
122
|
-
|
123
|
-
def readchar
|
124
|
-
get_char(true)
|
125
|
-
end
|
126
|
-
|
127
|
-
def ungetc(char)
|
128
|
-
@ungetc = char
|
129
|
-
nil
|
130
|
-
end
|
131
|
-
|
132
|
-
def get_line(ex, rs)
|
133
|
-
ret = nil
|
134
|
-
unless eof?
|
135
|
-
new_pos = @content.index(rs, @pos)
|
136
|
-
if new_pos
|
137
|
-
ret = @content[@pos .. new_pos]
|
138
|
-
@pos = new_pos + 1
|
139
|
-
@lineno += 1
|
140
|
-
else
|
141
|
-
ret = @content[@pos .. @content.size - 1]
|
142
|
-
@pos = @content.size
|
143
|
-
@lineno += 1
|
144
|
-
end
|
145
|
-
else
|
146
|
-
raise EOFError if ex
|
147
|
-
end
|
148
|
-
$_ = ret
|
149
|
-
end
|
150
|
-
private :get_line
|
151
|
-
|
152
|
-
def gets(rs = $/)
|
153
|
-
get_line(nil, rs)
|
154
|
-
end
|
155
|
-
|
156
|
-
def readline(rs = $/)
|
157
|
-
get_line(true, $/)
|
158
|
-
end
|
159
|
-
|
160
|
-
def read(length = @content.size - @pos)
|
161
|
-
ret = ""
|
162
|
-
length.times do
|
163
|
-
ret << getc
|
164
|
-
end
|
165
|
-
ret
|
166
|
-
end
|
167
|
-
|
168
|
-
def readlines(rs = $/)
|
169
|
-
ret = []
|
170
|
-
each_line(rs) do |line|
|
171
|
-
ret.push(line)
|
172
|
-
end
|
173
|
-
ret
|
174
|
-
end
|
175
|
-
|
176
|
-
def rewind
|
177
|
-
@pos = 0
|
178
|
-
end
|
179
|
-
|
180
|
-
def seek(offset, whence)
|
181
|
-
case whence
|
182
|
-
when 0
|
183
|
-
@pos = offset
|
184
|
-
when 1
|
185
|
-
@pos += offset
|
186
|
-
when 2
|
187
|
-
@pos += @content.size - 1
|
188
|
-
else
|
189
|
-
raise Errno::EINVAL
|
190
|
-
end
|
191
|
-
end
|
192
|
-
|
193
|
-
alias tell pos
|
194
|
-
|
195
|
-
def << (arg)
|
196
|
-
begin
|
197
|
-
@content << arg.to_s
|
198
|
-
self
|
199
|
-
rescue
|
200
|
-
raise IOError
|
201
|
-
end
|
202
|
-
end
|
203
|
-
|
204
|
-
def print(*args)
|
205
|
-
begin
|
206
|
-
args.each do |i|
|
207
|
-
@content << i.to_s
|
208
|
-
end
|
209
|
-
nil
|
210
|
-
rescue
|
211
|
-
raise IOError
|
212
|
-
end
|
213
|
-
end
|
214
|
-
|
215
|
-
def printf(format, *args)
|
216
|
-
str = sprintf(format, *args)
|
217
|
-
begin
|
218
|
-
@content << str
|
219
|
-
nil
|
220
|
-
rescue
|
221
|
-
raise IOError
|
222
|
-
end
|
223
|
-
end
|
224
|
-
|
225
|
-
def putc(char)
|
226
|
-
self.printf("%c", char)
|
227
|
-
char
|
228
|
-
end
|
229
|
-
|
230
|
-
def puts(*args)
|
231
|
-
args.flatten.each do |i|
|
232
|
-
self.print(i, "\n")
|
233
|
-
end
|
234
|
-
end
|
235
|
-
|
236
|
-
def write(str)
|
237
|
-
@content << str.to_s
|
238
|
-
str.to_s.size
|
239
|
-
end
|
240
|
-
|
241
|
-
def empty?
|
242
|
-
@content.empty?
|
243
|
-
end
|
244
|
-
|
245
|
-
def to_s
|
246
|
-
@content
|
247
|
-
end
|
248
|
-
end
|
249
|
-
end
|
250
|
-
|
251
|
-
=begin
|
252
|
-
== script info.
|
253
|
-
filter structure.
|
254
|
-
$Id: filter.rb,v 1.7 2001/03/19 15:20:08 toshirok Exp $
|
255
|
-
=end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
= head-filter.rb
|
3
|
-
$Id: head-filter.rb,v 1.5 2003/10/30 12:12:33 rubikitch Exp rubikitch $
|
4
|
-
Copyright(c) 2003 Rubikitch
|
5
|
-
Licence: Ruby's License or GPL-2+
|
6
|
-
=end
|
7
|
-
module RD
|
8
|
-
HEAD_FILTER = Filter.new(:target) do |inn, out|
|
9
|
-
$Visitor.head = inn.to_s
|
10
|
-
out.print " "
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
$RC["filter"]["head"] = RD::HEAD_FILTER
|
@@ -1,233 +0,0 @@
|
|
1
|
-
require 'rd/element'
|
2
|
-
|
3
|
-
module RD
|
4
|
-
|
5
|
-
# Inline-level Element of document tree
|
6
|
-
class InlineElement < Element
|
7
|
-
end
|
8
|
-
|
9
|
-
# abstruct class.
|
10
|
-
class TerminalInline < InlineElement
|
11
|
-
include TerminalElement
|
12
|
-
|
13
|
-
attr_accessor :content
|
14
|
-
|
15
|
-
def initialize(content)
|
16
|
-
super()
|
17
|
-
@content = content
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
# abstract class.
|
22
|
-
class NonterminalInline < InlineElement
|
23
|
-
include NonterminalElement
|
24
|
-
|
25
|
-
attr_reader :content
|
26
|
-
|
27
|
-
def initialize
|
28
|
-
super()
|
29
|
-
@content = []
|
30
|
-
end
|
31
|
-
|
32
|
-
def children
|
33
|
-
@content
|
34
|
-
end
|
35
|
-
|
36
|
-
def to_label
|
37
|
-
ret = ""
|
38
|
-
children.each do |i|
|
39
|
-
ret << i.to_label
|
40
|
-
end
|
41
|
-
ret.strip
|
42
|
-
end
|
43
|
-
end # NonterminalInline
|
44
|
-
|
45
|
-
class StringElement < TerminalInline
|
46
|
-
def accept(visitor)
|
47
|
-
visitor.visit_StringElement(self)
|
48
|
-
end
|
49
|
-
|
50
|
-
def to_label
|
51
|
-
@content
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
class Verb < TerminalInline
|
56
|
-
def accept(visitor)
|
57
|
-
visitor.visit_Verb(self)
|
58
|
-
end
|
59
|
-
|
60
|
-
def to_label
|
61
|
-
@content.strip
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
class Emphasis < NonterminalInline
|
66
|
-
def accept(visitor)
|
67
|
-
visitor.visit_Emphasis(self)
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
class Code < NonterminalInline
|
72
|
-
def accept(visitor)
|
73
|
-
visitor.visit_Code(self)
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
class Var < NonterminalInline
|
78
|
-
def accept(visitor)
|
79
|
-
visitor.visit_Var(self)
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
class Keyboard < NonterminalInline
|
84
|
-
def accept(visitor)
|
85
|
-
visitor.visit_Keyboard(self)
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
class Index < NonterminalInline
|
90
|
-
def accept(visitor)
|
91
|
-
visitor.visit_Index(self)
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
class Footnote < NonterminalInline
|
96
|
-
def accept(visitor)
|
97
|
-
visitor.visit_Footnote(self)
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
class Reference < NonterminalInline
|
102
|
-
attr_accessor :label # Reference::Label
|
103
|
-
alias set_label label=
|
104
|
-
|
105
|
-
def initialize(label)
|
106
|
-
super()
|
107
|
-
@content = []
|
108
|
-
@label = label.renew_label
|
109
|
-
end
|
110
|
-
|
111
|
-
def Reference.new_from_label(label)
|
112
|
-
ref = Reference.new(label)
|
113
|
-
ref.add_children(label.to_reference_content)
|
114
|
-
return ref
|
115
|
-
end
|
116
|
-
|
117
|
-
def Reference.new_from_label_under_document_struct(label, struct)
|
118
|
-
ref = Reference.new(label)
|
119
|
-
ref.add_children_under_document_struct(label.to_reference_content,
|
120
|
-
struct)
|
121
|
-
return ref
|
122
|
-
end
|
123
|
-
|
124
|
-
def Reference.new_from_label_without_document_struct(label)
|
125
|
-
ref = Reference.new(label)
|
126
|
-
ref.add_children_without_document_struct(label.to_reference_content)
|
127
|
-
return ref
|
128
|
-
end
|
129
|
-
|
130
|
-
def accept(visitor)
|
131
|
-
visitor.visit_Reference(self)
|
132
|
-
end
|
133
|
-
|
134
|
-
def result_of_apply_method_of(visitor, children)
|
135
|
-
label.result_of_apply_method_of(visitor, self, children)
|
136
|
-
end
|
137
|
-
|
138
|
-
def to_label
|
139
|
-
@label.to_label
|
140
|
-
end
|
141
|
-
|
142
|
-
# abstruct class. Label for Reference
|
143
|
-
class Label
|
144
|
-
def extract_label
|
145
|
-
raise NotImplementedError, "[BUG] must be overridden."
|
146
|
-
end
|
147
|
-
|
148
|
-
def to_reference_content
|
149
|
-
raise NotImplementedError, "[BUG] must be overridden."
|
150
|
-
end
|
151
|
-
|
152
|
-
def result_of_apply_method_of(visitor)
|
153
|
-
raise NotImplementedError, "[BUG] must be overridden."
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
157
|
-
class URL < Label
|
158
|
-
attr_accessor :url
|
159
|
-
|
160
|
-
def initialize(url_str)
|
161
|
-
@url = url_str
|
162
|
-
end
|
163
|
-
|
164
|
-
def to_label
|
165
|
-
""
|
166
|
-
end
|
167
|
-
|
168
|
-
def result_of_apply_method_of(visitor, reference, children)
|
169
|
-
visitor.apply_to_Reference_with_URL(reference, children)
|
170
|
-
end
|
171
|
-
|
172
|
-
def to_reference_content
|
173
|
-
[StringElement.new("<URL:#{self.url}>")]
|
174
|
-
end
|
175
|
-
|
176
|
-
def renew_label
|
177
|
-
self
|
178
|
-
end
|
179
|
-
end # URL
|
180
|
-
|
181
|
-
class RDLabel < Label
|
182
|
-
attr_accessor :element_label
|
183
|
-
attr_accessor :filename
|
184
|
-
|
185
|
-
def initialize(element_label, filename = nil)
|
186
|
-
@element_label = element_label
|
187
|
-
@filename = filename
|
188
|
-
end
|
189
|
-
|
190
|
-
def result_of_apply_method_of(visitor, reference, children)
|
191
|
-
visitor.apply_to_Reference_with_RDLabel(reference, children)
|
192
|
-
end
|
193
|
-
|
194
|
-
def to_reference_content
|
195
|
-
[]
|
196
|
-
end
|
197
|
-
|
198
|
-
def renew_label
|
199
|
-
self
|
200
|
-
end
|
201
|
-
|
202
|
-
alias to_label element_label
|
203
|
-
end # RDLabel
|
204
|
-
|
205
|
-
# for initialization. Parameter Object(?)
|
206
|
-
class TemporaryLabel < Label
|
207
|
-
attr_accessor :element_label
|
208
|
-
attr_accessor :filename
|
209
|
-
|
210
|
-
def initialize(element_label = [], filename = nil)
|
211
|
-
@element_label = element_label
|
212
|
-
@filename = filename
|
213
|
-
end
|
214
|
-
|
215
|
-
def to_reference_content
|
216
|
-
self.element_label
|
217
|
-
end
|
218
|
-
|
219
|
-
def renew_label
|
220
|
-
RDLabel.new(extract_label(self.element_label), self.filename)
|
221
|
-
end
|
222
|
-
|
223
|
-
def extract_label(elements)
|
224
|
-
ret = ""
|
225
|
-
elements.each do |i|
|
226
|
-
ret << i.to_label
|
227
|
-
end
|
228
|
-
ret.strip
|
229
|
-
end
|
230
|
-
private :extract_label
|
231
|
-
end
|
232
|
-
end # Reference
|
233
|
-
end
|