tdiary-style-markdown 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tdiary/style/markdown/version.rb +1 -1
- data/lib/tdiary/style/markdown.rb +27 -0
- data/test/tdiary/style/markdown-test.rb +4 -12
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bde33d5fb620172b6fd8386b37b76047faf97c38
|
4
|
+
data.tar.gz: 6e760bfbf8c2987f76de68c70300de9035b4fcc3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1bd4216cc683e1eba6adc93be2f7c4cdfb501999a37c1861de7646f21a0fcd622fbf9751267c0b04e79eff9ccfc48a92e9bd1bf233a6cc549e56e49d1a76e8ee
|
7
|
+
data.tar.gz: b604de4ae06a7c7989c6a4873785973f3e49e0468c43b891d94ab842314acdd40e4ef4541893819690ab5366a89e6a4a0bec84fc68e61d747e2335f6a7a0fede
|
@@ -124,6 +124,13 @@ module TDiary
|
|
124
124
|
end
|
125
125
|
end
|
126
126
|
|
127
|
+
footnote_stashes = HTMLwithPygments.tdiary_style_markdown_footnote_stashes
|
128
|
+
footnote_stashes.each do |num, raw_content|
|
129
|
+
if r["@@tdiary-style-markdown-footnote-#{num}@@"]
|
130
|
+
r["@@tdiary-style-markdown-footnote-#{num}@@"] = raw_content
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
127
134
|
r
|
128
135
|
end
|
129
136
|
|
@@ -193,9 +200,29 @@ module TDiary
|
|
193
200
|
end
|
194
201
|
|
195
202
|
class HTMLwithPygments < Redcarpet::Render::HTML
|
203
|
+
@@tdiary_style_markdown_footnote_stashes = []
|
204
|
+
|
205
|
+
def self.tdiary_style_markdown_footnote_stashes
|
206
|
+
@@tdiary_style_markdown_footnote_stashes
|
207
|
+
end
|
208
|
+
|
196
209
|
def block_code(code, language)
|
197
210
|
Pygments.highlight(code, lexer: language)
|
198
211
|
end
|
212
|
+
|
213
|
+
def footnotes(content)
|
214
|
+
""
|
215
|
+
end
|
216
|
+
|
217
|
+
def footnote_def(content, num)
|
218
|
+
raw_content = content.gsub(/<p>(.+?)<\/p>\n/){ $1 }
|
219
|
+
@@tdiary_style_markdown_footnote_stashes.push([num, raw_content])
|
220
|
+
""
|
221
|
+
end
|
222
|
+
|
223
|
+
def footnote_ref(num)
|
224
|
+
"<%=fn \"@@tdiary-style-markdown-footnote-#{num}@@\"%>"
|
225
|
+
end
|
199
226
|
end
|
200
227
|
end
|
201
228
|
end
|
@@ -503,6 +503,7 @@ NOTE: `{{.NetworkSettings.IPAddress}}` is golang template.
|
|
503
503
|
source = <<-'EOF'
|
504
504
|
# subTitle
|
505
505
|
|
506
|
+
Ruby{{fn "Object Oriented language"}} is fun!
|
506
507
|
HTML[^1] is a markup language[^2].
|
507
508
|
|
508
509
|
[^1]: Hyper Text Markup Language
|
@@ -515,22 +516,13 @@ HTML[^1] is a markup language[^2].
|
|
515
516
|
<div class="section">
|
516
517
|
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
517
518
|
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
518
|
-
<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>
|
519
|
+
<p>Ruby<%=fn "Object Oriented language"%> is fun!
|
520
|
+
HTML<%=fn "Hyper Text Markup Language"%> is a markup language<%=fn "language"%>.</p>
|
530
521
|
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
531
522
|
</div>
|
532
523
|
EOF
|
533
524
|
|
525
|
+
puts @diary.to_html
|
534
526
|
assert_equal(@html, @diary.to_html)
|
535
527
|
end
|
536
528
|
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.
|
4
|
+
version: 0.2.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: 2015-06-
|
11
|
+
date: 2015-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redcarpet
|