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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 38526451bd0f0f6f80ac55c9b6eb8e76dfa61c28
4
- data.tar.gz: 69ad909151791d52c40f15ce3fe561973de16308
3
+ metadata.gz: bde33d5fb620172b6fd8386b37b76047faf97c38
4
+ data.tar.gz: 6e760bfbf8c2987f76de68c70300de9035b4fcc3
5
5
  SHA512:
6
- metadata.gz: d41f46a7e97aeec2ebda59beebfe21b1850a69de8d64112ed9be96ab6402a9bdd9c8e3722b8833c23a460a4241da08be6ac50e471fb4ce8dce3ac9a60634526b
7
- data.tar.gz: 1f77d2c2df4037614e2c5166b35821e37c7e2c21a4e0260704a1320e7001de6ffc349addb57684f425112ce5215748e7cf3e1c0da1efeb5ca205f30e8c1ec7d9
6
+ metadata.gz: 1bd4216cc683e1eba6adc93be2f7c4cdfb501999a37c1861de7646f21a0fcd622fbf9751267c0b04e79eff9ccfc48a92e9bd1bf233a6cc549e56e49d1a76e8ee
7
+ data.tar.gz: b604de4ae06a7c7989c6a4873785973f3e49e0468c43b891d94ab842314acdd40e4ef4541893819690ab5366a89e6a4a0bec84fc68e61d747e2335f6a7a0fede
@@ -1,7 +1,7 @@
1
1
  module TDiary
2
2
  module Style
3
3
  module Markdown
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
6
6
  end
7
7
  end
@@ -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>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&nbsp;<a href="#fnref1" rev="footnote">&#8617;</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.1.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-02 00:00:00.000000000 Z
11
+ date: 2015-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redcarpet