tdiary-style-gfm 0.1.3 → 0.1.4

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: 1564bbcbba57a358c11586d364c06a744d0753a2
4
- data.tar.gz: e1074b3b48790af1670abe3070cc3765ae2591ae
3
+ metadata.gz: 958b5a067acef02d274a063dc6ad126d81b4a349
4
+ data.tar.gz: 1fc62c47442e37dc945f2453f1596034a5016217
5
5
  SHA512:
6
- metadata.gz: 4122f536060577050b123b28b026f84f3235ac7d1df1287f727adc6edc1853bd91279f073d249cc8e438a9ee6048ea174c9d3f2919887cdec6cc9a1ef9611b90
7
- data.tar.gz: f4167268113111f7cdd30f5530d7a7f1334ca2eb74884184c29be84aac6a1d1cdc75d0a0e9ea923c9832cab98b277bf1cd09d195dd400affee68d4ac087ee5e6
6
+ metadata.gz: e5f40c7ab7a5b2644d399446b3e563b931ab6274985c592db48f2c1c44876f7010e4043f71d882c90c5477443e39f49b28705b7fcf50296949f82e7481ddf700
7
+ data.tar.gz: 4713028db0f3ea08185e1106e32709b60d80fea34e3840a177ed92bc19219476e6f02826c073f0408995bf6cd265682479e8a6d2bf75d66c9dc9821a86162650
@@ -56,9 +56,9 @@ module TDiary
56
56
 
57
57
  # 1. Stash plugin calls
58
58
  plugin_stashes = []
59
- r.gsub!(/\{\{(.*?)\}\}/) do
59
+ r.gsub!(/\{\{(.*?)\}\}/) do |matched|
60
60
  # Convert `{{ }}' to erb tags
61
- plugin_stashes.push("<%=#{$1}%>")
61
+ plugin_stashes.push([matched, "<%=#{$1}%>"])
62
62
  "@@tdiary_style_gfm_plugin#{plugin_stashes.length - 1}@@"
63
63
  end
64
64
 
@@ -106,13 +106,25 @@ module TDiary
106
106
 
107
107
  # 5. Unstash <pre>, <code> and plugin call
108
108
  pre_tag_stashes.each.with_index do |str, i|
109
+ plugin_stashes.each.with_index do |(p_str, p_erb), j|
110
+ if str["@@tdiary_style_gfm_plugin#{j}@@"]
111
+ str["@@tdiary_style_gfm_plugin#{j}@@"] = CGI.escapeHTML(p_str)
112
+ end
113
+ end
109
114
  r["@@tdiary_style_gfm_pre_tag#{i}@@"] = str
110
115
  end
111
116
  code_tag_stashes.each.with_index do |str, i|
117
+ plugin_stashes.each.with_index do |(p_str, p_erb), j|
118
+ if str["@@tdiary_style_gfm_plugin#{j}@@"]
119
+ str["@@tdiary_style_gfm_plugin#{j}@@"] = CGI.escapeHTML(p_str)
120
+ end
121
+ end
112
122
  r["@@tdiary_style_gfm_code_tag#{i}@@"] = str
113
123
  end
114
- plugin_stashes.each.with_index do |str, i|
115
- r["@@tdiary_style_gfm_plugin#{i}@@"] = str
124
+ plugin_stashes.each.with_index do |(str, erb), i|
125
+ if r["@@tdiary_style_gfm_plugin#{i}@@"]
126
+ r["@@tdiary_style_gfm_plugin#{i}@@"] = erb
127
+ end
116
128
  end
117
129
 
118
130
  r
@@ -1,7 +1,7 @@
1
1
  module TDiary
2
2
  module Style
3
3
  module Gfm
4
- VERSION = "0.1.3"
4
+ VERSION = "0.1.4"
5
5
  end
6
6
  end
7
7
  end
@@ -567,6 +567,38 @@ ruby -e "puts \"hello, world.\""
567
567
 
568
568
  <p><%=plugin "\0", "\1", "\2"%></p>
569
569
  <%=section_leave_proc( Time.at( 1041346800 ) )%>
570
+ </div>
571
+ EOF
572
+ end
573
+ it { @diary.to_html.should eq @html }
574
+ end
575
+
576
+ describe 'plugin syntax in pre, code block' do
577
+ before do
578
+ source = <<-'EOF'
579
+ # subTitle
580
+
581
+ Get IP Address of Docker Container:
582
+
583
+ ```
584
+ % docker inspect -f "{{.NetworkSettings.IPAddress}} {{.Config.Hostname}} # Name:{{.Name}}" `docker ps -q`
585
+ ```
586
+
587
+ NOTE: `{{.NetworkSettings.IPAddress}}` is golang template.
588
+ EOF
589
+ @diary.append(source)
590
+
591
+ @html = <<-'EOF'
592
+ <div class="section">
593
+ <%=section_enter_proc( Time.at( 1041346800 ) )%>
594
+ <h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
595
+ <p>Get IP Address of Docker Container:</p>
596
+
597
+ <pre><code>% docker inspect -f &quot;{{.NetworkSettings.IPAddress}} {{.Config.Hostname}} # Name:{{.Name}}&quot; `docker ps -q`
598
+ </code></pre>
599
+
600
+ <p>NOTE: <code>{{.NetworkSettings.IPAddress}}</code> is golang template.</p>
601
+ <%=section_leave_proc( Time.at( 1041346800 ) )%>
570
602
  </div>
571
603
  EOF
572
604
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tdiary-style-gfm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - SHIBATA Hiroshi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-08 00:00:00.000000000 Z
11
+ date: 2014-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: github-markdown
@@ -134,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
134
  version: '0'
135
135
  requirements: []
136
136
  rubyforge_project:
137
- rubygems_version: 2.2.2
137
+ rubygems_version: 2.4.5
138
138
  signing_key:
139
139
  specification_version: 4
140
140
  summary: GFM Style for tDiary