tdiary-style-markdown 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +36 -0
- data/Gemfile +6 -0
- data/LICENSE +675 -0
- data/README.md +41 -0
- data/Rakefile +1 -0
- data/lib/tdiary/style/markdown/version.rb +7 -0
- data/lib/tdiary/style/markdown.rb +208 -0
- data/lib/tdiary-style-markdown.rb +1 -0
- data/tdiaty-style-markdown.gemspec +29 -0
- data/test/run-test.rb +29 -0
- data/test/tdiary/style/markdown-test.rb +536 -0
- data/test/test-helper.rb +10 -0
- metadata +157 -0
@@ -0,0 +1,536 @@
|
|
1
|
+
require "test-helper"
|
2
|
+
|
3
|
+
class TestMarkdownDiary < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
@diary = TDiary::Style::MarkdownDiary.new(Time.at( 1041346800 ), "TITLE", "")
|
6
|
+
end
|
7
|
+
|
8
|
+
class Append < self
|
9
|
+
def setup
|
10
|
+
super
|
11
|
+
@source = <<-'EOF'
|
12
|
+
# subTitle
|
13
|
+
honbun
|
14
|
+
|
15
|
+
## subTitleH4
|
16
|
+
honbun
|
17
|
+
|
18
|
+
```
|
19
|
+
# comment in code block
|
20
|
+
```
|
21
|
+
|
22
|
+
EOF
|
23
|
+
@diary.append(@source)
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_html
|
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
|
+
<div class="highlight"><pre><span class="c"># comment in code block</span>
|
37
|
+
</pre></div><%=section_leave_proc( Time.at( 1041346800 ) )%>
|
38
|
+
</div>
|
39
|
+
EOF
|
40
|
+
assert_equal(@html, @diary.to_html)
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_source
|
44
|
+
assert_equal(@source, @diary.to_src)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
class Replace < self
|
49
|
+
def setup
|
50
|
+
super
|
51
|
+
source = <<-'EOF'
|
52
|
+
# subTitle
|
53
|
+
honbun
|
54
|
+
|
55
|
+
## subTitleH4
|
56
|
+
honbun
|
57
|
+
|
58
|
+
EOF
|
59
|
+
@diary.append(source)
|
60
|
+
|
61
|
+
@replaced = <<-'EOF'
|
62
|
+
# replaceTitle
|
63
|
+
replace
|
64
|
+
|
65
|
+
## replaceTitleH4
|
66
|
+
replace
|
67
|
+
|
68
|
+
EOF
|
69
|
+
end
|
70
|
+
|
71
|
+
def test_replace
|
72
|
+
@diary.replace(Time.at( 1041346800 ), "TITLE", @replaced)
|
73
|
+
@html = <<-'EOF'
|
74
|
+
<div class="section">
|
75
|
+
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
76
|
+
<h3><%= subtitle_proc( Time.at( 1041346800 ), "replaceTitle" ) %></h3>
|
77
|
+
<p>replace</p>
|
78
|
+
|
79
|
+
<h4>replaceTitleH4</h4>
|
80
|
+
|
81
|
+
<p>replace</p>
|
82
|
+
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
83
|
+
</div>
|
84
|
+
EOF
|
85
|
+
assert_equal(@html, @diary.to_html)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def test_auto_link
|
90
|
+
source = <<-EOF
|
91
|
+
# subTitle
|
92
|
+
|
93
|
+
* http://www.google.com
|
94
|
+
|
95
|
+
[google](https://www.google.com)
|
96
|
+
|
97
|
+
http://www.google.com
|
98
|
+
EOF
|
99
|
+
@diary.append(source)
|
100
|
+
@html = <<-EOF
|
101
|
+
<div class="section">
|
102
|
+
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
103
|
+
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
104
|
+
<ul>
|
105
|
+
<li><a href="http://www.google.com">http://www.google.com</a></li>
|
106
|
+
</ul>
|
107
|
+
|
108
|
+
<p><a href="https://www.google.com">google</a></p>
|
109
|
+
|
110
|
+
<p><a href="http://www.google.com">http://www.google.com</a></p>
|
111
|
+
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
112
|
+
</div>
|
113
|
+
EOF
|
114
|
+
assert_equal(@html, @diary.to_html)
|
115
|
+
end
|
116
|
+
|
117
|
+
def test_auto_image_link
|
118
|
+
source = <<-EOF
|
119
|
+
# subTitle
|
120
|
+
|
121
|
+
![](http://www.google.com/logo.jpg)
|
122
|
+
|
123
|
+
![google](http://www.google.com/logo.jpg)
|
124
|
+
EOF
|
125
|
+
@diary.append(source)
|
126
|
+
@html = <<-EOF
|
127
|
+
<div class="section">
|
128
|
+
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
129
|
+
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
130
|
+
<p><img src="http://www.google.com/logo.jpg" alt=""></p>
|
131
|
+
|
132
|
+
<p><img src="http://www.google.com/logo.jpg" alt="google"></p>
|
133
|
+
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
134
|
+
</div>
|
135
|
+
EOF
|
136
|
+
assert_equal(@html, @diary.to_html)
|
137
|
+
end
|
138
|
+
|
139
|
+
def test_html_link
|
140
|
+
source = <<-EOF
|
141
|
+
# subTitle
|
142
|
+
|
143
|
+
<a href="http://www.exaple.com" target="_blank">Anchor</a>
|
144
|
+
EOF
|
145
|
+
@diary.append(source)
|
146
|
+
@html = <<-EOF
|
147
|
+
<div class="section">
|
148
|
+
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
149
|
+
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
150
|
+
<p><a href="http://www.exaple.com" target="_blank">Anchor</a></p>
|
151
|
+
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
152
|
+
</div>
|
153
|
+
EOF
|
154
|
+
assert_equal(@html, @diary.to_html)
|
155
|
+
end
|
156
|
+
|
157
|
+
def test_url_syntax_with_code_blocks
|
158
|
+
source = <<-'EOF'
|
159
|
+
# subTitle
|
160
|
+
|
161
|
+
```ruby
|
162
|
+
@foo
|
163
|
+
```
|
164
|
+
|
165
|
+
http://example.com is example.com
|
166
|
+
|
167
|
+
EOF
|
168
|
+
@diary.append(source)
|
169
|
+
|
170
|
+
@html = <<-'EOF'
|
171
|
+
<div class="section">
|
172
|
+
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
173
|
+
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
174
|
+
<div class="highlight"><pre><span class="vi">@foo</span>
|
175
|
+
</pre></div>
|
176
|
+
<p><a href="http://example.com">http://example.com</a> is example.com</p>
|
177
|
+
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
178
|
+
</div>
|
179
|
+
EOF
|
180
|
+
assert_equal(@html, @diary.to_html)
|
181
|
+
end
|
182
|
+
|
183
|
+
def test_ignore_url_syntax_with_markdown
|
184
|
+
source = <<-'EOF'
|
185
|
+
# subTitle
|
186
|
+
|
187
|
+
[example](http://example.com) is example.com
|
188
|
+
|
189
|
+
EOF
|
190
|
+
@diary.append(source)
|
191
|
+
|
192
|
+
@html = <<-'EOF'
|
193
|
+
<div class="section">
|
194
|
+
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
195
|
+
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
196
|
+
<p><a href="http://example.com">example</a> is example.com</p>
|
197
|
+
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
198
|
+
</div>
|
199
|
+
EOF
|
200
|
+
assert_equal(@html, @diary.to_html)
|
201
|
+
end
|
202
|
+
|
203
|
+
def test_plugin_syntax
|
204
|
+
source = <<-'EOF'
|
205
|
+
# subTitle
|
206
|
+
{{plugin 'val'}}
|
207
|
+
|
208
|
+
{{plugin "val", 'val'}}
|
209
|
+
|
210
|
+
EOF
|
211
|
+
@diary.append(source)
|
212
|
+
|
213
|
+
@html = <<-'EOF'
|
214
|
+
<div class="section">
|
215
|
+
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
216
|
+
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
217
|
+
<p><%=plugin 'val'%></p>
|
218
|
+
|
219
|
+
<p><%=plugin "val", 'val'%></p>
|
220
|
+
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
221
|
+
</div>
|
222
|
+
EOF
|
223
|
+
assert_equal(@html, @diary.to_html)
|
224
|
+
end
|
225
|
+
|
226
|
+
def test_plugin_syntax_with_url_args
|
227
|
+
source = <<-'EOF'
|
228
|
+
# subTitle
|
229
|
+
{{plugin 'http://www.example.com/foo.html', "https://www.example.com/bar.html"}}
|
230
|
+
|
231
|
+
EOF
|
232
|
+
@diary.append(source)
|
233
|
+
|
234
|
+
@html = <<-'EOF'
|
235
|
+
<div class="section">
|
236
|
+
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
237
|
+
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
238
|
+
<p><%=plugin 'http://www.example.com/foo.html', "https://www.example.com/bar.html"%></p>
|
239
|
+
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
240
|
+
</div>
|
241
|
+
EOF
|
242
|
+
assert_equal(@html, @diary.to_html)
|
243
|
+
end
|
244
|
+
|
245
|
+
def test_link_to_my_plugin
|
246
|
+
source = <<-'EOF'
|
247
|
+
# subTitle
|
248
|
+
|
249
|
+
[](20120101p01)
|
250
|
+
|
251
|
+
[Link](20120101p01)
|
252
|
+
|
253
|
+
EOF
|
254
|
+
@diary.append(source)
|
255
|
+
|
256
|
+
@html = <<-'EOF'
|
257
|
+
<div class="section">
|
258
|
+
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
259
|
+
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
260
|
+
<p><%=my "20120101p01", "20120101p01" %></p>
|
261
|
+
|
262
|
+
<p><%=my "20120101p01", "Link" %></p>
|
263
|
+
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
264
|
+
</div>
|
265
|
+
EOF
|
266
|
+
assert_equal(@html, @diary.to_html)
|
267
|
+
end
|
268
|
+
|
269
|
+
def test_code_highlighting
|
270
|
+
source = <<-'EOF'
|
271
|
+
# subTitle
|
272
|
+
|
273
|
+
```ruby
|
274
|
+
def class
|
275
|
+
@foo = 'bar'
|
276
|
+
end
|
277
|
+
```
|
278
|
+
EOF
|
279
|
+
@diary.append(source)
|
280
|
+
|
281
|
+
@html = <<-'EOF'
|
282
|
+
<div class="section">
|
283
|
+
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
284
|
+
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
285
|
+
<div class="highlight"><pre> <span class="k">def</span> <span class="nf">class</span>
|
286
|
+
<span class="vi">@foo</span> <span class="o">=</span> <span class="s1">'bar'</span>
|
287
|
+
<span class="k">end</span>
|
288
|
+
</pre></div><%=section_leave_proc( Time.at( 1041346800 ) )%>
|
289
|
+
</div>
|
290
|
+
EOF
|
291
|
+
assert_equal(@html, @diary.to_html)
|
292
|
+
end
|
293
|
+
|
294
|
+
class TwitterUsername < self
|
295
|
+
def test_plain
|
296
|
+
source = <<-'EOF'
|
297
|
+
# subTitle
|
298
|
+
|
299
|
+
@a_matsuda is amatsuda
|
300
|
+
EOF
|
301
|
+
@diary.append(source)
|
302
|
+
|
303
|
+
@html = <<-'EOF'
|
304
|
+
<div class="section">
|
305
|
+
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
306
|
+
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
307
|
+
<p>@<a class="tweet-url username" href="https://twitter.com/a_matsuda" rel="nofollow">a_matsuda</a> is amatsuda</p>
|
308
|
+
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
309
|
+
</div>
|
310
|
+
EOF
|
311
|
+
assert_equal(@html, @diary.to_html)
|
312
|
+
end
|
313
|
+
|
314
|
+
def test_twitter_username_with_pre
|
315
|
+
source = <<-'EOF'
|
316
|
+
# subTitle
|
317
|
+
|
318
|
+
```ruby
|
319
|
+
p :some_code
|
320
|
+
```
|
321
|
+
|
322
|
+
@a_matsuda is amatsuda
|
323
|
+
EOF
|
324
|
+
@diary.append(source)
|
325
|
+
|
326
|
+
@html = <<-'EOF'
|
327
|
+
<div class="section">
|
328
|
+
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
329
|
+
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
330
|
+
<div class="highlight"><pre><span class="nb">p</span> <span class="ss">:some_code</span>
|
331
|
+
</pre></div>
|
332
|
+
<p>@a_matsuda is amatsuda</p>
|
333
|
+
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
334
|
+
</div>
|
335
|
+
EOF
|
336
|
+
assert_equal(@html, @diary.to_html)
|
337
|
+
end
|
338
|
+
|
339
|
+
def test_twitter_username_with_code
|
340
|
+
source = <<-'EOF'
|
341
|
+
# subTitle
|
342
|
+
|
343
|
+
`:some_code`
|
344
|
+
|
345
|
+
@a_matsuda is amatsuda
|
346
|
+
EOF
|
347
|
+
@diary.append(source)
|
348
|
+
|
349
|
+
@html = <<-'EOF'
|
350
|
+
<div class="section">
|
351
|
+
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
352
|
+
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
353
|
+
<p><code>:some_code</code></p>
|
354
|
+
|
355
|
+
<p>@a_matsuda is amatsuda</p>
|
356
|
+
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
357
|
+
</div>
|
358
|
+
EOF
|
359
|
+
assert_equal(@html, @diary.to_html)
|
360
|
+
end
|
361
|
+
end
|
362
|
+
|
363
|
+
class Emoji < self
|
364
|
+
def test_in_plain_context
|
365
|
+
source = <<-'EOF'
|
366
|
+
# subTitle
|
367
|
+
|
368
|
+
:sushi: は美味しい
|
369
|
+
EOF
|
370
|
+
@diary.append(source)
|
371
|
+
|
372
|
+
@html = <<-'EOF'
|
373
|
+
<div class="section">
|
374
|
+
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
375
|
+
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
376
|
+
<p><img src='http://www.emoji-cheat-sheet.com/graphics/emojis/sushi.png' width='20' height='20' title='sushi' alt='sushi' class='emoji' /> は美味しい</p>
|
377
|
+
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
378
|
+
</div>
|
379
|
+
EOF
|
380
|
+
assert_equal(@html, @diary.to_html)
|
381
|
+
end
|
382
|
+
|
383
|
+
def test_in_multiline
|
384
|
+
source = <<-'EOF'
|
385
|
+
# subTitle
|
386
|
+
|
387
|
+
```
|
388
|
+
:sushi: は
|
389
|
+
美味しい
|
390
|
+
```
|
391
|
+
EOF
|
392
|
+
@diary.append(source)
|
393
|
+
|
394
|
+
@html = <<-'EOF'
|
395
|
+
<div class="section">
|
396
|
+
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
397
|
+
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
398
|
+
<div class="highlight"><pre><span class="o">:</span><span class="nl">sushi:</span><span class="w"> </span><span class="err">は</span>
|
399
|
+
<span class="err">美味しい</span>
|
400
|
+
</pre></div><%=section_leave_proc( Time.at( 1041346800 ) )%>
|
401
|
+
</div>
|
402
|
+
EOF
|
403
|
+
assert_equal(@html, @diary.to_html)
|
404
|
+
end
|
405
|
+
|
406
|
+
def test_in_code
|
407
|
+
source = <<-'EOF'
|
408
|
+
# subTitle
|
409
|
+
|
410
|
+
`:sushi:` は美味しい
|
411
|
+
EOF
|
412
|
+
@diary.append(source)
|
413
|
+
|
414
|
+
@html = <<-'EOF'
|
415
|
+
<div class="section">
|
416
|
+
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
417
|
+
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
418
|
+
<p><code>:sushi:</code> は美味しい</p>
|
419
|
+
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
420
|
+
</div>
|
421
|
+
EOF
|
422
|
+
assert_equal(@html, @diary.to_html)
|
423
|
+
end
|
424
|
+
|
425
|
+
def test_in_code_with_attribute
|
426
|
+
source = <<-'EOF'
|
427
|
+
# subTitle
|
428
|
+
|
429
|
+
<code class="foo">:sushi:</code> は美味しい
|
430
|
+
EOF
|
431
|
+
@diary.append(source)
|
432
|
+
|
433
|
+
@html = <<-'EOF'
|
434
|
+
<div class="section">
|
435
|
+
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
436
|
+
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
437
|
+
<p><code class="foo">:sushi:</code> は美味しい</p>
|
438
|
+
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
439
|
+
</div>
|
440
|
+
EOF
|
441
|
+
assert_equal(@html, @diary.to_html)
|
442
|
+
end
|
443
|
+
end
|
444
|
+
|
445
|
+
def test_stashes_in_pre_code_plugin
|
446
|
+
source = <<-'EOF'
|
447
|
+
# subTitle
|
448
|
+
|
449
|
+
```
|
450
|
+
ruby -e "puts \"hello, world.\""
|
451
|
+
```
|
452
|
+
|
453
|
+
`ruby -e "puts \"hello, world.\""`
|
454
|
+
|
455
|
+
{{plugin "\0", "\1", "\2"}}
|
456
|
+
EOF
|
457
|
+
@diary.append(source)
|
458
|
+
|
459
|
+
@html = <<-'EOF'
|
460
|
+
<div class="section">
|
461
|
+
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
462
|
+
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
463
|
+
<div class="highlight"><pre><span class="vg">ruby</span><span class="w"> </span><span class="o">-</span><span class="vg">e</span><span class="w"> </span><span class="s2">"puts \"</span><span class="vg">hello</span><span class="p">,</span><span class="w"> </span><span class="vg">world</span><span class="o">.\</span><span class="s2">""</span>
|
464
|
+
</pre></div>
|
465
|
+
<p><code>ruby -e "puts \"hello, world.\""</code></p>
|
466
|
+
|
467
|
+
<p><%=plugin "\0", "\1", "\2"%></p>
|
468
|
+
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
469
|
+
</div>
|
470
|
+
EOF
|
471
|
+
assert_equal(@html, @diary.to_html)
|
472
|
+
end
|
473
|
+
|
474
|
+
def test_plugin_syntax_in_pre_code_block
|
475
|
+
source = <<-'EOF'
|
476
|
+
# subTitle
|
477
|
+
|
478
|
+
Get IP Address of Docker Container:
|
479
|
+
|
480
|
+
```
|
481
|
+
% docker inspect -f "{{.NetworkSettings.IPAddress}} {{.Config.Hostname}} # Name:{{.Name}}" `docker ps -q`
|
482
|
+
```
|
483
|
+
|
484
|
+
NOTE: `{{.NetworkSettings.IPAddress}}` is golang template.
|
485
|
+
EOF
|
486
|
+
@diary.append(source)
|
487
|
+
|
488
|
+
@html = <<-'EOF'
|
489
|
+
<div class="section">
|
490
|
+
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
491
|
+
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
492
|
+
<p>Get IP Address of Docker Container:</p>
|
493
|
+
<div class="highlight"><pre><span class="o">%</span> <span class="n">docker</span> <span class="n">inspect</span> <span class="o">-</span><span class="n">f</span> <span class="s">"{{.NetworkSettings.IPAddress}} {{.Config.Hostname}} # Name:{{.Name}}"</span> <span class="err">`</span><span class="n">docker</span> <span class="n">ps</span> <span class="o">-</span><span class="n">q</span><span class="err">`</span>
|
494
|
+
</pre></div>
|
495
|
+
<p>NOTE: <code>{{.NetworkSettings.IPAddress}}</code> is golang template.</p>
|
496
|
+
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
497
|
+
</div>
|
498
|
+
EOF
|
499
|
+
assert_equal(@html, @diary.to_html)
|
500
|
+
end
|
501
|
+
|
502
|
+
def test_footnote
|
503
|
+
source = <<-'EOF'
|
504
|
+
# subTitle
|
505
|
+
|
506
|
+
HTML[^1] is a markup language[^2].
|
507
|
+
|
508
|
+
[^1]: Hyper Text Markup Language
|
509
|
+
[^2]: language
|
510
|
+
|
511
|
+
EOF
|
512
|
+
@diary.append(source)
|
513
|
+
|
514
|
+
@html = <<-EOF
|
515
|
+
<div class="section">
|
516
|
+
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
517
|
+
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
518
|
+
<p>HTML<sup id="fnref1"><a href="#fn1" rel="footnote">1</a></sup> is a markup language.</p>
|
519
|
+
|
520
|
+
<div class="footnotes">
|
521
|
+
<hr>
|
522
|
+
<ol>
|
523
|
+
|
524
|
+
<li id="fn1">
|
525
|
+
<p>Hyper Text Markup Language <a href="#fnref1" rev="footnote">↩</a></p>
|
526
|
+
</li>
|
527
|
+
|
528
|
+
</ol>
|
529
|
+
</div>
|
530
|
+
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
531
|
+
</div>
|
532
|
+
EOF
|
533
|
+
|
534
|
+
assert_equal(@html, @diary.to_html)
|
535
|
+
end
|
536
|
+
end
|
data/test/test-helper.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
2
|
+
require 'tdiary/core_ext'
|
3
|
+
require 'tdiary/comment_manager'
|
4
|
+
require 'tdiary/referer_manager'
|
5
|
+
require 'tdiary/style'
|
6
|
+
require 'tdiary/style/markdown'
|
7
|
+
|
8
|
+
TDiary::Style::MarkdownDiary.send(:include, TDiary::Style::BaseDiary)
|
9
|
+
TDiary::Style::MarkdownDiary.send(:include, TDiary::Style::CategorizableDiary)
|
10
|
+
TDiary::Style::MarkdownSection.send(:include, TDiary::Style::BaseSection)
|
metadata
ADDED
@@ -0,0 +1,157 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tdiary-style-markdown
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kenji Okimoto
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-06-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: redcarpet
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: pygments.rb
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: twitter-text
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: gemoji
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: bundler
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.3'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.3'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: test-unit
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: Markdown Style for tDiary
|
112
|
+
email:
|
113
|
+
- okimoto@clear-code.com
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- ".gitignore"
|
119
|
+
- Gemfile
|
120
|
+
- LICENSE
|
121
|
+
- README.md
|
122
|
+
- Rakefile
|
123
|
+
- lib/tdiary-style-markdown.rb
|
124
|
+
- lib/tdiary/style/markdown.rb
|
125
|
+
- lib/tdiary/style/markdown/version.rb
|
126
|
+
- tdiaty-style-markdown.gemspec
|
127
|
+
- test/run-test.rb
|
128
|
+
- test/tdiary/style/markdown-test.rb
|
129
|
+
- test/test-helper.rb
|
130
|
+
homepage: https://github.com/clear-code/tdiary-style-markdown
|
131
|
+
licenses:
|
132
|
+
- MIT
|
133
|
+
metadata: {}
|
134
|
+
post_install_message:
|
135
|
+
rdoc_options: []
|
136
|
+
require_paths:
|
137
|
+
- lib
|
138
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
144
|
+
requirements:
|
145
|
+
- - ">="
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: '0'
|
148
|
+
requirements: []
|
149
|
+
rubyforge_project:
|
150
|
+
rubygems_version: 2.2.2
|
151
|
+
signing_key:
|
152
|
+
specification_version: 4
|
153
|
+
summary: Markdown Style for tDiary
|
154
|
+
test_files:
|
155
|
+
- test/run-test.rb
|
156
|
+
- test/tdiary/style/markdown-test.rb
|
157
|
+
- test/test-helper.rb
|