tdiary-style-markdown 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -0
- data/README.md +2 -0
- data/Rakefile +7 -0
- data/lib/tdiary/style/markdown.rb +7 -1
- data/lib/tdiary/style/markdown/version.rb +1 -1
- data/test/tdiary/style/markdown-test.rb +58 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b824c99bcc7050d699d17c4e8812cd3488555683
|
4
|
+
data.tar.gz: 49ecbb1e5c0dbf016d5a619b74f53724ab25bea9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66f698b1cb223940d81722c3ba26672ae30798231b8ce6e3dfc0f39cb2a227eea01cb17206e0cc6553b09a0c0a585cce9d99c7a94f19d40c12c2ccafb46f630e
|
7
|
+
data.tar.gz: 11665f3157974f4c4f6bceb867f72664863b4e5e917efe27f856f409a2cfee629e88a70dac703f4e4c6217eb6df2bbfc28551ae5d8c7f9dfcfbc1294ec31e8b3
|
data/.travis.yml
ADDED
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -198,6 +198,11 @@ module TDiary
|
|
198
198
|
else
|
199
199
|
nil
|
200
200
|
end
|
201
|
+
caption_part = ""
|
202
|
+
language, caption = language.split(":", 2) if language
|
203
|
+
if caption
|
204
|
+
caption_part = "<span class=\"caption\">#{escape_html(caption)}</span>\n"
|
205
|
+
end
|
201
206
|
code = node.string_content
|
202
207
|
lexer = Rouge::Lexer.find_fancy(language, code) || Rouge::Lexers::PlainText
|
203
208
|
formatter = rouge_formatter(lexer)
|
@@ -208,7 +213,7 @@ module TDiary
|
|
208
213
|
if language
|
209
214
|
out(' lang="', language, '"')
|
210
215
|
end
|
211
|
-
out(
|
216
|
+
out(">")
|
212
217
|
else
|
213
218
|
out("<pre#{sourcepos(node)}")
|
214
219
|
if language
|
@@ -217,6 +222,7 @@ module TDiary
|
|
217
222
|
out(' class="highlight plaintext">')
|
218
223
|
end
|
219
224
|
end
|
225
|
+
out(caption_part)
|
220
226
|
out('<code>')
|
221
227
|
out(highlighted)
|
222
228
|
out('</code></pre>')
|
@@ -518,4 +518,62 @@ HTML<%=fn %Q(Hyper Text Markup Language)%> is a markup language<%=fn %Q(<a href=
|
|
518
518
|
|
519
519
|
assert_equal(@html, @diary.to_html)
|
520
520
|
end
|
521
|
+
|
522
|
+
class QiitaStyleCodeBlock < self
|
523
|
+
def test_caption
|
524
|
+
source = <<-EOF
|
525
|
+
# Code Blocks
|
526
|
+
|
527
|
+
```plaintext:example1.rb
|
528
|
+
p "OK"
|
529
|
+
```
|
530
|
+
|
531
|
+
~~~plaintext:example2.rb
|
532
|
+
p "OK"
|
533
|
+
~~~
|
534
|
+
EOF
|
535
|
+
@diary.append(source)
|
536
|
+
|
537
|
+
@html = <<-EOF
|
538
|
+
<div class="section">
|
539
|
+
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
540
|
+
<h3><%= subtitle_proc( Time.at( 1041346800 ), "Code Blocks" ) %></h3>
|
541
|
+
<pre class="highlight plaintext"><span class="caption">example1.rb</span>
|
542
|
+
<code>p "OK"
|
543
|
+
</code></pre>
|
544
|
+
<pre class="highlight plaintext"><span class="caption">example2.rb</span>
|
545
|
+
<code>p "OK"
|
546
|
+
</code></pre>
|
547
|
+
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
548
|
+
</div>
|
549
|
+
EOF
|
550
|
+
|
551
|
+
assert_equal(@html, @diary.to_html)
|
552
|
+
end
|
553
|
+
|
554
|
+
def test_caption_with_tilde
|
555
|
+
source = <<-EOF
|
556
|
+
# Code Blocks
|
557
|
+
|
558
|
+
```plaintext:~/example1.rb
|
559
|
+
p "OK"
|
560
|
+
```
|
561
|
+
EOF
|
562
|
+
@diary.append(source)
|
563
|
+
# note: tilde after three-tilde code fence is not supported by cmark...
|
564
|
+
|
565
|
+
@html = <<-EOF
|
566
|
+
<div class="section">
|
567
|
+
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
568
|
+
<h3><%= subtitle_proc( Time.at( 1041346800 ), "Code Blocks" ) %></h3>
|
569
|
+
<pre class="highlight plaintext"><span class="caption">~/example1.rb</span>
|
570
|
+
<code>p "OK"
|
571
|
+
</code></pre>
|
572
|
+
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
573
|
+
</div>
|
574
|
+
EOF
|
575
|
+
|
576
|
+
assert_equal(@html, @diary.to_html)
|
577
|
+
end
|
578
|
+
end
|
521
579
|
end
|
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.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenji Okimoto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commonmarker
|
@@ -116,6 +116,7 @@ extensions: []
|
|
116
116
|
extra_rdoc_files: []
|
117
117
|
files:
|
118
118
|
- ".gitignore"
|
119
|
+
- ".travis.yml"
|
119
120
|
- Gemfile
|
120
121
|
- LICENSE
|
121
122
|
- README.md
|