tdiary-style-markdown 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/lib/tdiary/style/markdown.rb +8 -3
- data/lib/tdiary/style/markdown/version.rb +1 -1
- data/tdiaty-style-markdown.gemspec +1 -1
- data/test/tdiary/style/markdown-test.rb +100 -2
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1c4c0647ba29b7435e29efffc592a11e7885dca1a28426458a375959118fafe3
|
4
|
+
data.tar.gz: d744678fe37f65b2d570d0d5f7b5f222224e82a62b73717dbb79ff3bfa219e34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9b603ca9f4f3c2687c51aa49affcd7fdc1d39fed76d5d28e2f957e999bdbb72b3d0792a9727817c6735b628f050a619656e53f8a6b38821fcd88be3f8b8f882
|
7
|
+
data.tar.gz: a34aa52f756993863a47b38de47cfe81acf865fe2eac30e01a415054170e7f02946a73e5d638a85301711f6652ca70289bb04ec004cc904fbffe4c41963df463
|
@@ -62,7 +62,8 @@ module TDiary
|
|
62
62
|
|
63
63
|
# 2. Apply markdown conversion
|
64
64
|
extensions = [:autolink, :table]
|
65
|
-
|
65
|
+
options = [:HARDBREAKS, :UNSAFE]
|
66
|
+
renderer = HTMLwithRouge.new(options: options, extensions: extensions)
|
66
67
|
doc = CommonMarker.render_doc(r, :DEFAULT, extensions)
|
67
68
|
r = renderer.render(doc)
|
68
69
|
|
@@ -80,8 +81,12 @@ module TDiary
|
|
80
81
|
end
|
81
82
|
|
82
83
|
# 4. Convert miscellaneous
|
83
|
-
|
84
|
-
|
84
|
+
r.gsub!(/>(.+?)</) do
|
85
|
+
if $1.include?("<a ")
|
86
|
+
">#{$1}<"
|
87
|
+
else
|
88
|
+
">#{Twitter::TwitterText::Autolink.auto_link_usernames_or_lists($1)}<"
|
89
|
+
end
|
85
90
|
end
|
86
91
|
|
87
92
|
r = r.emojify
|
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_dependency 'commonmarker'
|
22
22
|
spec.add_dependency 'rouge'
|
23
|
-
spec.add_dependency 'twitter-text'
|
23
|
+
spec.add_dependency 'twitter-text', '~> 3.0.0'
|
24
24
|
spec.add_dependency 'gemoji'
|
25
25
|
|
26
26
|
spec.add_development_dependency "bundler", "~> 1.3"
|
@@ -322,7 +322,7 @@ p :some_code
|
|
322
322
|
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
323
323
|
<pre class="highlight ruby"><code><span class="nb">p</span> <span class="ss">:some_code</span>
|
324
324
|
</code></pre>
|
325
|
-
<p
|
325
|
+
<p>@<a class="tweet-url username" href="https://twitter.com/a_matsuda" rel="nofollow">a_matsuda</a> is amatsuda</p>
|
326
326
|
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
327
327
|
</div>
|
328
328
|
EOF
|
@@ -344,7 +344,105 @@ p :some_code
|
|
344
344
|
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
345
345
|
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
346
346
|
<p><code>:some_code</code></p>
|
347
|
-
<p
|
347
|
+
<p>@<a class="tweet-url username" href="https://twitter.com/a_matsuda" rel="nofollow">a_matsuda</a> is amatsuda</p>
|
348
|
+
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
349
|
+
</div>
|
350
|
+
EOF
|
351
|
+
assert_equal(@html, @diary.to_html)
|
352
|
+
end
|
353
|
+
|
354
|
+
def test_twitter_username_with_code_and_username
|
355
|
+
source = <<-'EOF'
|
356
|
+
# subTitle
|
357
|
+
|
358
|
+
`:some_code` @a_matsuda is amatsuda
|
359
|
+
EOF
|
360
|
+
@diary.append(source)
|
361
|
+
|
362
|
+
@html = <<-'EOF'
|
363
|
+
<div class="section">
|
364
|
+
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
365
|
+
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
366
|
+
<p><code>:some_code</code> @<a class="tweet-url username" href="https://twitter.com/a_matsuda" rel="nofollow">a_matsuda</a> is amatsuda</p>
|
367
|
+
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
368
|
+
</div>
|
369
|
+
EOF
|
370
|
+
assert_equal(@html, @diary.to_html)
|
371
|
+
end
|
372
|
+
|
373
|
+
def test_twitter_username_with_code_and_username_without_space
|
374
|
+
source = <<-'EOF'
|
375
|
+
# subTitle
|
376
|
+
|
377
|
+
`:some_code`@a_matsuda is amatsuda
|
378
|
+
EOF
|
379
|
+
@diary.append(source)
|
380
|
+
|
381
|
+
@html = <<-'EOF'
|
382
|
+
<div class="section">
|
383
|
+
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
384
|
+
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
385
|
+
<p><code>:some_code</code>@a_matsuda is amatsuda</p>
|
386
|
+
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
387
|
+
</div>
|
388
|
+
EOF
|
389
|
+
assert_equal(@html, @diary.to_html)
|
390
|
+
end
|
391
|
+
|
392
|
+
def test_twitter_username_with_code_tag
|
393
|
+
source = <<-'EOF'
|
394
|
+
# subTitle
|
395
|
+
|
396
|
+
<code>@a_matsuda</code> is amatsuda
|
397
|
+
EOF
|
398
|
+
@diary.append(source)
|
399
|
+
|
400
|
+
@html = <<-'EOF'
|
401
|
+
<div class="section">
|
402
|
+
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
403
|
+
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
404
|
+
<p><code>@a_matsuda</code> is amatsuda</p>
|
405
|
+
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
406
|
+
</div>
|
407
|
+
EOF
|
408
|
+
assert_equal(@html, @diary.to_html)
|
409
|
+
end
|
410
|
+
|
411
|
+
def test_twitter_username_in_link_text
|
412
|
+
source = <<-'EOF'
|
413
|
+
# subTitle
|
414
|
+
|
415
|
+
[@a_matsuda is amatsuda](https://example.com)
|
416
|
+
EOF
|
417
|
+
@diary.append(source)
|
418
|
+
|
419
|
+
@html = <<-'EOF'
|
420
|
+
<div class="section">
|
421
|
+
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
422
|
+
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
423
|
+
<p><a href="https://example.com">@a_matsuda is amatsuda</a></p>
|
424
|
+
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
425
|
+
</div>
|
426
|
+
EOF
|
427
|
+
assert_equal(@html, @diary.to_html)
|
428
|
+
end
|
429
|
+
|
430
|
+
def test_twitter_username_in_sourcecode
|
431
|
+
source = <<-'EOF'
|
432
|
+
# subTitle
|
433
|
+
|
434
|
+
```ruby
|
435
|
+
@a_matsuda = "amatsuda"
|
436
|
+
```
|
437
|
+
EOF
|
438
|
+
@diary.append(source)
|
439
|
+
|
440
|
+
@html = <<-'EOF'
|
441
|
+
<div class="section">
|
442
|
+
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
443
|
+
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
444
|
+
<pre class="highlight ruby"><code><span class="vi">@a_matsuda</span> <span class="o">=</span> <span class="s2">"amatsuda"</span>
|
445
|
+
</code></pre>
|
348
446
|
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
349
447
|
</div>
|
350
448
|
EOF
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tdiary-style-markdown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenji Okimoto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commonmarker
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: twitter-text
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 3.0.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 3.0.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: gemoji
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
148
|
version: '0'
|
149
149
|
requirements: []
|
150
150
|
rubyforge_project:
|
151
|
-
rubygems_version: 2.6
|
151
|
+
rubygems_version: 2.7.6
|
152
152
|
signing_key:
|
153
153
|
specification_version: 4
|
154
154
|
summary: Markdown Style for tDiary
|