tdiary 4.0.1.20130903 → 4.0.1.20130929
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -7
- data/Gemfile.lock +13 -27
- data/spec/core/style/tdiary_style_spec.rb +1 -1
- data/spec/core/style/wiki_style_spec.rb +1 -1
- data/tdiary/io/base.rb +11 -7
- data/tdiary/style/{tdiary_style.rb → tdiary.rb} +0 -3
- data/tdiary/style/{wiki_style.rb → wiki.rb} +0 -5
- data/tdiary/version.rb +1 -1
- metadata +5 -25
- data/misc/style/emptdiary/README.rd +0 -83
- data/misc/style/emptdiary/README.rd.en +0 -78
- data/misc/style/emptdiary/emptdiary_style.rb +0 -201
- data/misc/style/etdiary/README.rd +0 -83
- data/misc/style/etdiary/etdiary_style.rb +0 -448
- data/misc/style/gfm/gfm_style.rb +0 -195
- data/misc/style/rd/README.rd +0 -71
- data/misc/style/rd/rd_style.rb +0 -367
- data/misc/style/wiki/README +0 -116
- data/misc/style/wiki/README.en +0 -101
- data/misc/style/wiki/wiki_parser.rb +0 -273
- data/misc/style/wiki/wiki_style.rb +0 -478
- data/spec/core/style/emptdiary_style_spec.rb +0 -165
- data/spec/core/style/etdiary_style_spec.rb +0 -512
- data/spec/core/style/gfm_style_spec.rb +0 -382
- data/spec/core/style/rd_style_spec.rb +0 -224
@@ -1,382 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8; -*-
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
require 'tdiary'
|
5
|
-
require 'misc/style/gfm/gfm_style'
|
6
|
-
|
7
|
-
describe TDiary::Style::GfmDiary do
|
8
|
-
before do
|
9
|
-
@diary = TDiary::Style::GfmDiary.new(Time.at( 1041346800 ), "TITLE", "")
|
10
|
-
end
|
11
|
-
|
12
|
-
describe '#append' do
|
13
|
-
before do
|
14
|
-
@source = <<-'EOF'
|
15
|
-
# subTitle
|
16
|
-
honbun
|
17
|
-
|
18
|
-
## subTitleH4
|
19
|
-
honbun
|
20
|
-
|
21
|
-
EOF
|
22
|
-
@diary.append(@source)
|
23
|
-
end
|
24
|
-
|
25
|
-
context 'HTML' do
|
26
|
-
before do
|
27
|
-
@html = <<-'EOF'
|
28
|
-
<div class="section">
|
29
|
-
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
30
|
-
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
31
|
-
<p>honbun</p>
|
32
|
-
|
33
|
-
<h4>subTitleH4</h4>
|
34
|
-
|
35
|
-
<p>honbun</p>
|
36
|
-
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
37
|
-
</div>
|
38
|
-
EOF
|
39
|
-
end
|
40
|
-
it { @diary.to_html.should eq @html }
|
41
|
-
end
|
42
|
-
|
43
|
-
context 'CHTML' do
|
44
|
-
before do
|
45
|
-
@html = <<-'EOF'
|
46
|
-
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
47
|
-
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
48
|
-
<p>honbun</p>
|
49
|
-
|
50
|
-
<h4>subTitleH4</h4>
|
51
|
-
|
52
|
-
<p>honbun</p>
|
53
|
-
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
54
|
-
EOF
|
55
|
-
end
|
56
|
-
it { @diary.to_html({}, :CHTML).should eq @html }
|
57
|
-
end
|
58
|
-
|
59
|
-
context 'to_src' do
|
60
|
-
it { @diary.to_src.should eq @source }
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
describe '#replace' do
|
65
|
-
before do
|
66
|
-
source = <<-'EOF'
|
67
|
-
# subTitle
|
68
|
-
honbun
|
69
|
-
|
70
|
-
## subTitleH4
|
71
|
-
honbun
|
72
|
-
|
73
|
-
EOF
|
74
|
-
@diary.append(source)
|
75
|
-
|
76
|
-
replaced = <<-'EOF'
|
77
|
-
# replaceTitle
|
78
|
-
replace
|
79
|
-
|
80
|
-
## replaceTitleH4
|
81
|
-
replace
|
82
|
-
|
83
|
-
EOF
|
84
|
-
@diary.replace(Time.at( 1041346800 ), "TITLE", replaced)
|
85
|
-
|
86
|
-
@html = <<-'EOF'
|
87
|
-
<div class="section">
|
88
|
-
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
89
|
-
<h3><%= subtitle_proc( Time.at( 1041346800 ), "replaceTitle" ) %></h3>
|
90
|
-
<p>replace</p>
|
91
|
-
|
92
|
-
<h4>replaceTitleH4</h4>
|
93
|
-
|
94
|
-
<p>replace</p>
|
95
|
-
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
96
|
-
</div>
|
97
|
-
EOF
|
98
|
-
end
|
99
|
-
it { @diary.to_html.should eq @html }
|
100
|
-
end
|
101
|
-
|
102
|
-
describe 'autolink' do
|
103
|
-
before do
|
104
|
-
source = <<-EOF
|
105
|
-
# subTitle
|
106
|
-
|
107
|
-
* http://www.google.com
|
108
|
-
|
109
|
-
[google](https://www.google.com)
|
110
|
-
|
111
|
-
http://www.google.com
|
112
|
-
EOF
|
113
|
-
@diary.append(source)
|
114
|
-
@html = <<-EOF
|
115
|
-
<div class="section">
|
116
|
-
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
117
|
-
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
118
|
-
<ul>
|
119
|
-
<li><a href="http://www.google.com" rel="nofollow">http://www.google.com</a></li>
|
120
|
-
</ul>
|
121
|
-
|
122
|
-
<p><a href="https://www.google.com" rel="nofollow">google</a></p>
|
123
|
-
|
124
|
-
<p><a href="http://www.google.com" rel="nofollow">http://www.google.com</a></p>
|
125
|
-
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
126
|
-
</div>
|
127
|
-
EOF
|
128
|
-
end
|
129
|
-
|
130
|
-
it { @diary.to_html.should eq @html }
|
131
|
-
end
|
132
|
-
|
133
|
-
describe 'auto imagelink' do
|
134
|
-
before do
|
135
|
-
source = <<-EOF
|
136
|
-
# subTitle
|
137
|
-
|
138
|
-
![](http://www.google.com/logo.jpg)
|
139
|
-
|
140
|
-
![google](http://www.google.com/logo.jpg)
|
141
|
-
EOF
|
142
|
-
@diary.append(source)
|
143
|
-
@html = <<-EOF
|
144
|
-
<div class="section">
|
145
|
-
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
146
|
-
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
147
|
-
<p><img src="http://www.google.com/logo.jpg" alt=""></p>
|
148
|
-
|
149
|
-
<p><img src="http://www.google.com/logo.jpg" alt="google"></p>
|
150
|
-
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
151
|
-
</div>
|
152
|
-
EOF
|
153
|
-
end
|
154
|
-
|
155
|
-
it { @diary.to_html.should eq @html }
|
156
|
-
|
157
|
-
end
|
158
|
-
|
159
|
-
describe 'auto imagelink' do
|
160
|
-
before do
|
161
|
-
source = <<-EOF
|
162
|
-
# subTitle
|
163
|
-
|
164
|
-
<a href="http://www.exaple.com" target="_blank">Anchor</a>
|
165
|
-
EOF
|
166
|
-
@diary.append(source)
|
167
|
-
@html = <<-EOF
|
168
|
-
<div class="section">
|
169
|
-
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
170
|
-
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
171
|
-
<p><a href="http://www.exaple.com" rel="nofollow" target="_blank">Anchor</a></p>
|
172
|
-
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
173
|
-
</div>
|
174
|
-
EOF
|
175
|
-
end
|
176
|
-
|
177
|
-
it { @diary.to_html.should eq @html }
|
178
|
-
|
179
|
-
end
|
180
|
-
|
181
|
-
describe 'url syntax with code blocks' do
|
182
|
-
before do
|
183
|
-
source = <<-'EOF'
|
184
|
-
# subTitle
|
185
|
-
|
186
|
-
```ruby
|
187
|
-
@foo
|
188
|
-
```
|
189
|
-
|
190
|
-
http://example.com is example.com
|
191
|
-
|
192
|
-
EOF
|
193
|
-
@diary.append(source)
|
194
|
-
|
195
|
-
@html = <<-'EOF'
|
196
|
-
<div class="section">
|
197
|
-
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
198
|
-
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
199
|
-
<div class="highlight"><pre><span class="vi">@foo</span>
|
200
|
-
</pre></div>
|
201
|
-
<p><a href="http://example.com" rel="nofollow">http://example.com</a> is example.com</p>
|
202
|
-
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
203
|
-
</div>
|
204
|
-
EOF
|
205
|
-
end
|
206
|
-
it { @diary.to_html.should eq @html }
|
207
|
-
end
|
208
|
-
|
209
|
-
describe 'ignored url syntax with markdown anchor' do
|
210
|
-
before do
|
211
|
-
source = <<-'EOF'
|
212
|
-
# subTitle
|
213
|
-
|
214
|
-
[example](http://example.com) is example.com
|
215
|
-
|
216
|
-
EOF
|
217
|
-
@diary.append(source)
|
218
|
-
|
219
|
-
@html = <<-'EOF'
|
220
|
-
<div class="section">
|
221
|
-
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
222
|
-
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
223
|
-
<p><a href="http://example.com" rel="nofollow">example</a> is example.com</p>
|
224
|
-
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
225
|
-
</div>
|
226
|
-
EOF
|
227
|
-
end
|
228
|
-
it { @diary.to_html.should eq @html }
|
229
|
-
end
|
230
|
-
|
231
|
-
describe 'plugin syntax' do
|
232
|
-
before do
|
233
|
-
source = <<-'EOF'
|
234
|
-
# subTitle
|
235
|
-
{{plugin 'val'}}
|
236
|
-
|
237
|
-
{{plugin "val", 'val'}}
|
238
|
-
|
239
|
-
EOF
|
240
|
-
@diary.append(source)
|
241
|
-
|
242
|
-
@html = <<-'EOF'
|
243
|
-
<div class="section">
|
244
|
-
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
245
|
-
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
246
|
-
<p><%=plugin 'val'%></p>
|
247
|
-
|
248
|
-
<p><%=plugin "val", 'val'%></p>
|
249
|
-
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
250
|
-
</div>
|
251
|
-
EOF
|
252
|
-
end
|
253
|
-
it { @diary.to_html.should eq @html }
|
254
|
-
end
|
255
|
-
|
256
|
-
describe 'plugin syntax with url args' do
|
257
|
-
before do
|
258
|
-
source = <<-'EOF'
|
259
|
-
# subTitle
|
260
|
-
{{plugin 'http://www.example.com/foo.html', "https://www.example.com/bar.html"}}
|
261
|
-
|
262
|
-
EOF
|
263
|
-
@diary.append(source)
|
264
|
-
|
265
|
-
@html = <<-'EOF'
|
266
|
-
<div class="section">
|
267
|
-
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
268
|
-
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
269
|
-
<p><%=plugin 'http://www.example.com/foo.html', "https://www.example.com/bar.html"%></p>
|
270
|
-
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
271
|
-
</div>
|
272
|
-
EOF
|
273
|
-
end
|
274
|
-
it { @diary.to_html.should eq @html }
|
275
|
-
end
|
276
|
-
|
277
|
-
describe 'link to my plugin' do
|
278
|
-
before do
|
279
|
-
source = <<-'EOF'
|
280
|
-
# subTitle
|
281
|
-
|
282
|
-
()[20120101p01]
|
283
|
-
|
284
|
-
(Link)[20120101p01]
|
285
|
-
|
286
|
-
EOF
|
287
|
-
@diary.append(source)
|
288
|
-
|
289
|
-
@html = <<-'EOF'
|
290
|
-
<div class="section">
|
291
|
-
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
292
|
-
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
293
|
-
<p><%=my "20120101p01", "20120101p01" %></p>
|
294
|
-
|
295
|
-
<p><%=my "20120101p01", "Link" %></p>
|
296
|
-
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
297
|
-
</div>
|
298
|
-
EOF
|
299
|
-
end
|
300
|
-
it { @diary.to_html.should eq @html }
|
301
|
-
end
|
302
|
-
|
303
|
-
describe 'code highlighting' do
|
304
|
-
before do
|
305
|
-
source = <<-'EOF'
|
306
|
-
# subTitle
|
307
|
-
|
308
|
-
```ruby
|
309
|
-
def class
|
310
|
-
@foo = 'bar'
|
311
|
-
end
|
312
|
-
```
|
313
|
-
EOF
|
314
|
-
@diary.append(source)
|
315
|
-
|
316
|
-
@html = <<-'EOF'
|
317
|
-
<div class="section">
|
318
|
-
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
319
|
-
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
320
|
-
<div class="highlight"><pre> <span class="k">def</span> <span class="nf">class</span>
|
321
|
-
<span class="vi">@foo</span> <span class="o">=</span> <span class="s1">'bar'</span>
|
322
|
-
<span class="k">end</span>
|
323
|
-
</pre></div><%=section_leave_proc( Time.at( 1041346800 ) )%>
|
324
|
-
</div>
|
325
|
-
EOF
|
326
|
-
end
|
327
|
-
it { @diary.to_html.should eq @html }
|
328
|
-
end
|
329
|
-
|
330
|
-
describe 'ignore emphasis' do
|
331
|
-
before do
|
332
|
-
source = <<-'EOF'
|
333
|
-
# subTitle
|
334
|
-
|
335
|
-
@a_matsuda is amatsuda
|
336
|
-
|
337
|
-
{{isbn_left_image ''}}
|
338
|
-
EOF
|
339
|
-
@diary.append(source)
|
340
|
-
|
341
|
-
@html = <<-'EOF'
|
342
|
-
<div class="section">
|
343
|
-
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
344
|
-
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
345
|
-
<p>@<a class="tweet-url username" href="https://twitter.com/a_matsuda" rel="nofollow">a_matsuda</a> is amatsuda</p>
|
346
|
-
|
347
|
-
<p><%=isbn_left_image ''%></p>
|
348
|
-
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
349
|
-
</div>
|
350
|
-
EOF
|
351
|
-
end
|
352
|
-
it { @diary.to_html.should eq @html }
|
353
|
-
end
|
354
|
-
|
355
|
-
describe 'emoji' do
|
356
|
-
before do
|
357
|
-
source = <<-'EOF'
|
358
|
-
# subTitle
|
359
|
-
|
360
|
-
:sushi: は美味しい
|
361
|
-
EOF
|
362
|
-
@diary.append(source)
|
363
|
-
|
364
|
-
@html = <<-'EOF'
|
365
|
-
<div class="section">
|
366
|
-
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
367
|
-
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
368
|
-
<p><img src='http://www.emoji-cheat-sheet.com/graphics/emojis/sushi.png' width='20' height='20' title='sushi' alt='sushi' class='emoji' /> は美味しい</p>
|
369
|
-
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
370
|
-
</div>
|
371
|
-
EOF
|
372
|
-
end
|
373
|
-
it { @diary.to_html.should eq @html }
|
374
|
-
end
|
375
|
-
end
|
376
|
-
|
377
|
-
# Local Variables:
|
378
|
-
# mode: ruby
|
379
|
-
# indent-tabs-mode: t
|
380
|
-
# tab-width: 3
|
381
|
-
# ruby-indent-level: 3
|
382
|
-
# End:
|
@@ -1,224 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8; -*-
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
require 'tdiary'
|
5
|
-
require 'misc/style/rd/rd_style'
|
6
|
-
|
7
|
-
describe TDiary::Style::RdDiary do
|
8
|
-
before do
|
9
|
-
@diary = TDiary::Style::RdDiary.new(Time::at( 1041346800 ), "TITLE", "")
|
10
|
-
end
|
11
|
-
|
12
|
-
describe '#append' do
|
13
|
-
before do
|
14
|
-
source = <<-'EOF'
|
15
|
-
= subTitle
|
16
|
-
honbun
|
17
|
-
|
18
|
-
== subTitleH4
|
19
|
-
honbun
|
20
|
-
|
21
|
-
EOF
|
22
|
-
@diary.append(source)
|
23
|
-
end
|
24
|
-
|
25
|
-
context 'HTML' do
|
26
|
-
before do
|
27
|
-
@html = <<-'EOF'
|
28
|
-
<div class="section">
|
29
|
-
<%=section_enter_proc( Time::at( 1041346800 ))%>
|
30
|
-
<h3><%= subtitle_proc( Time::at( 1041346800 ), "subTitle" ) %></h3>
|
31
|
-
<p>honbun</p>
|
32
|
-
<h4>subTitleH4</h4>
|
33
|
-
<p>honbun</p>
|
34
|
-
<%=section_leave_proc( Time::at( 1041346800 ))%>
|
35
|
-
</div>
|
36
|
-
EOF
|
37
|
-
end
|
38
|
-
it { @diary.to_html.should eq @html }
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
describe '#replace' do
|
43
|
-
before do
|
44
|
-
source = <<-'EOF'
|
45
|
-
= subTitle
|
46
|
-
honbun
|
47
|
-
|
48
|
-
== subTitleH4
|
49
|
-
honbun
|
50
|
-
|
51
|
-
EOF
|
52
|
-
@diary.append(source)
|
53
|
-
|
54
|
-
replaced = <<-'EOF'
|
55
|
-
= replaceTitle
|
56
|
-
replace
|
57
|
-
|
58
|
-
== replaceTitleH4
|
59
|
-
replace
|
60
|
-
|
61
|
-
EOF
|
62
|
-
@diary.replace(Time::at( 1041346800 ), "TITLE", replaced)
|
63
|
-
|
64
|
-
@html = <<-'EOF'
|
65
|
-
<div class="section">
|
66
|
-
<%=section_enter_proc( Time::at( 1041346800 ))%>
|
67
|
-
<h3><%= subtitle_proc( Time::at( 1041346800 ), "replaceTitle" ) %></h3>
|
68
|
-
<p>replace</p>
|
69
|
-
<h4>replaceTitleH4</h4>
|
70
|
-
<p>replace</p>
|
71
|
-
<%=section_leave_proc( Time::at( 1041346800 ))%>
|
72
|
-
</div>
|
73
|
-
EOF
|
74
|
-
end
|
75
|
-
it { @diary.to_html.should eq @html }
|
76
|
-
end
|
77
|
-
|
78
|
-
describe '#add_section' do
|
79
|
-
before do
|
80
|
-
source = <<-'EOF'
|
81
|
-
= subTitle
|
82
|
-
honbun
|
83
|
-
|
84
|
-
== subTitleH4
|
85
|
-
honbun
|
86
|
-
|
87
|
-
EOF
|
88
|
-
@diary.append(source)
|
89
|
-
@diary.add_section('subTitle2', 'honbun')
|
90
|
-
|
91
|
-
@html = <<-'EOF'
|
92
|
-
<div class="section">
|
93
|
-
<%=section_enter_proc( Time::at( 1041346800 ))%>
|
94
|
-
<h3><%= subtitle_proc( Time::at( 1041346800 ), "subTitle" ) %></h3>
|
95
|
-
<p>honbun</p>
|
96
|
-
<h4>subTitleH4</h4>
|
97
|
-
<p>honbun</p>
|
98
|
-
<%=section_leave_proc( Time::at( 1041346800 ))%>
|
99
|
-
</div>
|
100
|
-
<div class="section">
|
101
|
-
<%=section_enter_proc( Time::at( 1041346800 ))%>
|
102
|
-
<h3><%= subtitle_proc( Time::at( 1041346800 ), "subTitle2" ) %></h3>
|
103
|
-
<p>honbun</p>
|
104
|
-
<%=section_leave_proc( Time::at( 1041346800 ))%>
|
105
|
-
</div>
|
106
|
-
EOF
|
107
|
-
end
|
108
|
-
it { @diary.to_html.should eq @html }
|
109
|
-
end
|
110
|
-
|
111
|
-
describe '#delete_section' do
|
112
|
-
before do
|
113
|
-
source = <<-'EOF'
|
114
|
-
= subTitle
|
115
|
-
honbun
|
116
|
-
|
117
|
-
= subTitle2
|
118
|
-
honbun
|
119
|
-
|
120
|
-
EOF
|
121
|
-
@diary.append(source)
|
122
|
-
@diary.delete_section(1)
|
123
|
-
|
124
|
-
@html = <<-'EOF'
|
125
|
-
<div class="section">
|
126
|
-
<%=section_enter_proc( Time::at( 1041346800 ))%>
|
127
|
-
<h3><%= subtitle_proc( Time::at( 1041346800 ), "subTitle2" ) %></h3>
|
128
|
-
<p>honbun</p>
|
129
|
-
<%=section_leave_proc( Time::at( 1041346800 ))%>
|
130
|
-
</div>
|
131
|
-
EOF
|
132
|
-
end
|
133
|
-
it { @diary.to_html.should eq @html }
|
134
|
-
end
|
135
|
-
|
136
|
-
describe 'test_rd_style_plugin' do
|
137
|
-
before do
|
138
|
-
source = <<-'EOF'
|
139
|
-
= subTitle
|
140
|
-
((%plugin%))
|
141
|
-
((%plugin%))
|
142
|
-
aaa
|
143
|
-
|
144
|
-
((%plugin%))
|
145
|
-
|
146
|
-
a((%ho
|
147
|
-
ge%))b
|
148
|
-
|
149
|
-
((%ho
|
150
|
-
ge%))
|
151
|
-
EOF
|
152
|
-
@diary.append(source)
|
153
|
-
end
|
154
|
-
|
155
|
-
context 'HTML' do
|
156
|
-
before do
|
157
|
-
@html = <<-'EOF'
|
158
|
-
<div class="section">
|
159
|
-
<%=section_enter_proc( Time::at( 1041346800 ))%>
|
160
|
-
<h3><%= subtitle_proc( Time::at( 1041346800 ), "subTitle" ) %></h3>
|
161
|
-
<p><%=plugin %>
|
162
|
-
<%=plugin %>
|
163
|
-
aaa</p>
|
164
|
-
<p><%=plugin %></p>
|
165
|
-
<p>a<%=ho ge%>b</p>
|
166
|
-
<p><%=ho ge%></p>
|
167
|
-
<%=section_leave_proc( Time::at( 1041346800 ))%>
|
168
|
-
</div>
|
169
|
-
EOF
|
170
|
-
end
|
171
|
-
it { @diary.to_html.should eq @html }
|
172
|
-
end
|
173
|
-
end
|
174
|
-
|
175
|
-
describe 'fn' do
|
176
|
-
context 'my' do
|
177
|
-
before do
|
178
|
-
source = <<-'EOF'
|
179
|
-
((-((<20130714>))-))
|
180
|
-
EOF
|
181
|
-
@diary.append(source)
|
182
|
-
end
|
183
|
-
|
184
|
-
before do
|
185
|
-
@html = <<-'EOF'
|
186
|
-
<div class="section">
|
187
|
-
<%=section_enter_proc( Time::at( 1041346800 ))%>
|
188
|
-
<p><%=fn apply_plugin( "<%=my \"20130714\",\"20130714\"%%>" ) %></p>
|
189
|
-
<%=section_leave_proc( Time::at( 1041346800 ))%>
|
190
|
-
</div>
|
191
|
-
EOF
|
192
|
-
end
|
193
|
-
it { @diary.to_html.should eq @html }
|
194
|
-
end
|
195
|
-
end
|
196
|
-
|
197
|
-
describe 'test_rd_on_error' do
|
198
|
-
context 'link' do
|
199
|
-
before do
|
200
|
-
source = <<-'EOF'
|
201
|
-
((<tdiary|http://www.tdiary.org/>))
|
202
|
-
EOF
|
203
|
-
@diary.append(source)
|
204
|
-
@exception_message = <<-'EOF'
|
205
|
-
RD syntax error: line 1:
|
206
|
-
...((<tdiary|http:/ / www.tdiary.org/>)) ...
|
207
|
-
^
|
208
|
-
EOF
|
209
|
-
end
|
210
|
-
it {
|
211
|
-
lambda{ @diary.to_html }.should raise_error(SyntaxError){ |e|
|
212
|
-
e.message.should eq @exception_message
|
213
|
-
}
|
214
|
-
}
|
215
|
-
end
|
216
|
-
end
|
217
|
-
end
|
218
|
-
|
219
|
-
# Local Variables:
|
220
|
-
# mode: ruby
|
221
|
-
# indent-tabs-mode: t
|
222
|
-
# tab-width: 3
|
223
|
-
# ruby-indent-level: 3
|
224
|
-
# End:
|