tdiary-style-gfm 0.5.2 → 1.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c8d9fafc1e380c46c4aca98057ad31f77adb4fbf4e3a6e66e7e41ba4b442c200
4
- data.tar.gz: 8d5cc7a712cb2998141bfb6421c1b3e0013b9a304be9c861a158d828d49f7a19
3
+ metadata.gz: '08f262d39eed1b076e813afd0ca97b6c28b3a2514f4d19fb769741cc89247184'
4
+ data.tar.gz: b6d60f96286de7df7bb26daa5a0d6c9d11ec6ac663ec637a6cf31ca2159ea855
5
5
  SHA512:
6
- metadata.gz: 5df7a4825e8e050ab91826422f724bfd70deab2048c1d39ef119eb52e112145904d476945db5691829d5a4aa2742d60bcf4da284cf5416ee200ed4bc091b1248
7
- data.tar.gz: 63944bb7b80161676361a1515cd85445da3628c096a4211d51d129f6ddec04f1c4c434878c106bc57b29cf6f56a61b570d1e5eca3c473c03da5623f32a83c63f
6
+ metadata.gz: c6e514534bada9e058c3302a980e85f1e4e5bbe7e4943bd7fb9111a99ba0ab44d594dbea9f8044ca57f7bb2423492a6d933ef5df9a60c64f8fee924f3ddb944d
7
+ data.tar.gz: 63c7f6352a6184743f0c0ad95dffb43c9d88759d238bb593bb01aaccb6b34d78bcd8ba71c348f6684d682c72489161adb456deeb146ccf8165ebbff493241873
@@ -1,7 +1,6 @@
1
1
  # -*- coding: utf-8; -*-
2
2
 
3
- require 'github/markdown'
4
- require 'rouge'
3
+ require 'commonmarker'
5
4
  require 'twitter-text'
6
5
 
7
6
  module TDiary
@@ -64,15 +63,7 @@ module TDiary
64
63
  r = replaced_r
65
64
 
66
65
  # 2. Apply markdown conversion
67
- r = GitHub::Markdown.to_html(r, :gfm) do |code, lang|
68
- begin
69
- formatter = Rouge::Formatters::HTMLPygments.new(Rouge::Formatters::HTML.new, 'highlight')
70
- lexer = Rouge::Lexer.find_fancy(lang)
71
- formatter.format(lexer.lex(code))
72
- rescue Exception => ex
73
- "<div class=\"highlight\"><pre>#{CGI.escapeHTML(code)}</pre></div>"
74
- end
75
- end
66
+ r = CommonMarker.render_html(r, [:DEFAULT], [:autolink])
76
67
 
77
68
  # 3. Stash <pre> and <code> tags
78
69
  pre_tag_stashes = []
@@ -1,7 +1,7 @@
1
1
  module TDiary
2
2
  module Style
3
3
  module Gfm
4
- VERSION = "0.5.2"
4
+ VERSION = "1.0.0"
5
5
  end
6
6
  end
7
7
  end
@@ -7,20 +7,19 @@ Gem::Specification.new do |spec|
7
7
  spec.name = "tdiary-style-gfm"
8
8
  spec.version = TDiary::Style::Gfm::VERSION
9
9
  spec.authors = ["SHIBATA Hiroshi"]
10
- spec.email = ["shibata.hiroshi@gmail.com"]
10
+ spec.email = ["hsbt@ruby-lang.org"]
11
11
  spec.description = %q{GFM Style for tDiary}
12
12
  spec.summary = %q{GFM Style for tDiary}
13
13
  spec.homepage = "https://github.com/tdiary/tdiary-style-gfm"
14
14
  spec.license = "GPL-3.0"
15
- spec.required_ruby_version = ">= 2.2.0"
15
+ spec.required_ruby_version = ">= 2.2.2"
16
16
 
17
- spec.files = `git ls-files`.split($/)
17
+ spec.files = Dir["README.md", "LICENSE.txt", "tdiary-style-gfm.gemspec", "lib/**/*"]
18
18
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
19
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
20
  spec.require_paths = ["lib"]
21
21
 
22
- spec.add_dependency 'github-markdown'
23
- spec.add_dependency 'rouge', '>= 2.2'
22
+ spec.add_dependency 'commonmarker'
24
23
  spec.add_dependency 'twitter-text', '~> 1.0'
25
24
  spec.add_dependency 'emot'
26
25
 
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tdiary-style-gfm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - SHIBATA Hiroshi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-27 00:00:00.000000000 Z
11
+ date: 2018-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: github-markdown
14
+ name: commonmarker
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: rouge
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '2.2'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '2.2'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: twitter-text
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -110,23 +96,16 @@ dependencies:
110
96
  version: '0'
111
97
  description: GFM Style for tDiary
112
98
  email:
113
- - shibata.hiroshi@gmail.com
99
+ - hsbt@ruby-lang.org
114
100
  executables: []
115
101
  extensions: []
116
102
  extra_rdoc_files: []
117
103
  files:
118
- - ".gitignore"
119
- - ".rspec"
120
- - ".travis.yml"
121
- - Gemfile
122
104
  - LICENSE.txt
123
105
  - README.md
124
- - Rakefile
125
106
  - lib/tdiary-style-gfm.rb
126
107
  - lib/tdiary/style/gfm.rb
127
108
  - lib/tdiary/style/gfm/version.rb
128
- - spec/spec_helper.rb
129
- - spec/tdiary/style/gfm_spec.rb
130
109
  - tdiary-style-gfm.gemspec
131
110
  homepage: https://github.com/tdiary/tdiary-style-gfm
132
111
  licenses:
@@ -140,7 +119,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
140
119
  requirements:
141
120
  - - ">="
142
121
  - !ruby/object:Gem::Version
143
- version: 2.2.0
122
+ version: 2.2.2
144
123
  required_rubygems_version: !ruby/object:Gem::Requirement
145
124
  requirements:
146
125
  - - ">="
@@ -148,10 +127,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
127
  version: '0'
149
128
  requirements: []
150
129
  rubyforge_project:
151
- rubygems_version: 2.7.3
130
+ rubygems_version: 2.7.6
152
131
  signing_key:
153
132
  specification_version: 4
154
133
  summary: GFM Style for tDiary
155
- test_files:
156
- - spec/spec_helper.rb
157
- - spec/tdiary/style/gfm_spec.rb
134
+ test_files: []
data/.gitignore DELETED
@@ -1,17 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --format documentation
2
- --color
data/.travis.yml DELETED
@@ -1,12 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.2
4
- - 2.3
5
- - 2.4
6
- - ruby-head
7
- matrix:
8
- allowed_failures:
9
- - rvm: ruby-head
10
-
11
- before_install: gem update bundler
12
- script: bundle exec rake spec
data/Gemfile DELETED
@@ -1,6 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in tdiary-style-gfm.gemspec
4
- gemspec
5
-
6
- gem 'tdiary', github: 'tdiary/tdiary-core'
data/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec
data/spec/spec_helper.rb DELETED
@@ -1,10 +0,0 @@
1
- $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
- require 'tdiary/core_ext'
3
- require 'tdiary/comment_manager'
4
- require 'tdiary/referer_manager'
5
- require 'tdiary/style'
6
- require 'tdiary/style/gfm'
7
-
8
- TDiary::Style::GfmDiary.send(:include, TDiary::Style::BaseDiary)
9
- TDiary::Style::GfmDiary.send(:include, TDiary::Style::CategorizableDiary)
10
- TDiary::Style::GfmSection.send(:include, TDiary::Style::BaseSection)
@@ -1,628 +0,0 @@
1
- # -*- coding: utf-8; -*-
2
- require 'spec_helper'
3
-
4
- describe TDiary::Style::GfmDiary do
5
- before do
6
- @diary = TDiary::Style::GfmDiary.new(Time.at( 1041346800 ), "TITLE", "")
7
- end
8
-
9
- describe '#append' do
10
- before do
11
- @source = <<-'EOF'
12
- # subTitle
13
- honbun
14
-
15
- ## subTitleH4
16
- honbun
17
-
18
- ```
19
- # comment in code block
20
- ```
21
-
22
- EOF
23
- @diary.append(@source)
24
- end
25
-
26
- context 'HTML' do
27
- before do
28
- @html = <<-'EOF'
29
- <div class="section">
30
- <%=section_enter_proc( Time.at( 1041346800 ) )%>
31
- <h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
32
- <p>honbun</p>
33
-
34
- <h4>subTitleH4</h4>
35
-
36
- <p>honbun</p>
37
-
38
- <pre><code># comment in code block
39
- </code></pre>
40
- <%=section_leave_proc( Time.at( 1041346800 ) )%>
41
- </div>
42
- EOF
43
- end
44
- it { expect(@diary.to_html).to eq @html }
45
- end
46
-
47
- context 'CHTML' do
48
- before do
49
- @html = <<-'EOF'
50
- <%=section_enter_proc( Time.at( 1041346800 ) )%>
51
- <h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
52
- <p>honbun</p>
53
-
54
- <h4>subTitleH4</h4>
55
-
56
- <p>honbun</p>
57
-
58
- <pre><code># comment in code block
59
- </code></pre>
60
- <%=section_leave_proc( Time.at( 1041346800 ) )%>
61
- EOF
62
- end
63
- it { expect(@diary.to_html({}, :CHTML)).to eq @html }
64
- end
65
-
66
- context 'to_src' do
67
- it { expect(@diary.to_src).to eq @source }
68
- end
69
- end
70
-
71
- describe '#replace' do
72
- before do
73
- source = <<-'EOF'
74
- # subTitle
75
- honbun
76
-
77
- ## subTitleH4
78
- honbun
79
-
80
- EOF
81
- @diary.append(source)
82
-
83
- replaced = <<-'EOF'
84
- # replaceTitle
85
- replace
86
-
87
- ## replaceTitleH4
88
- replace
89
-
90
- EOF
91
- @diary.replace(Time.at( 1041346800 ), "TITLE", replaced)
92
-
93
- @html = <<-'EOF'
94
- <div class="section">
95
- <%=section_enter_proc( Time.at( 1041346800 ) )%>
96
- <h3><%= subtitle_proc( Time.at( 1041346800 ), "replaceTitle" ) %></h3>
97
- <p>replace</p>
98
-
99
- <h4>replaceTitleH4</h4>
100
-
101
- <p>replace</p>
102
- <%=section_leave_proc( Time.at( 1041346800 ) )%>
103
- </div>
104
- EOF
105
- end
106
- it { expect(@diary.to_html).to eq @html }
107
- end
108
-
109
- describe 'autolink' do
110
- before do
111
- source = <<-EOF
112
- # subTitle
113
-
114
- * http://www.google.com
115
-
116
- [google](https://www.google.com)
117
-
118
- http://www.google.com
119
- EOF
120
- @diary.append(source)
121
- @html = <<-EOF
122
- <div class="section">
123
- <%=section_enter_proc( Time.at( 1041346800 ) )%>
124
- <h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
125
- <ul>
126
- <li><a href="http://www.google.com">http://www.google.com</a></li>
127
- </ul>
128
-
129
- <p><a href="https://www.google.com">google</a></p>
130
-
131
- <p><a href="http://www.google.com">http://www.google.com</a></p>
132
- <%=section_leave_proc( Time.at( 1041346800 ) )%>
133
- </div>
134
- EOF
135
- end
136
-
137
- it { expect(@diary.to_html).to eq @html }
138
- end
139
-
140
- describe 'auto imagelink' do
141
- before do
142
- source = <<-EOF
143
- # subTitle
144
-
145
- ![](http://www.google.com/logo.jpg)
146
-
147
- ![google](http://www.google.com/logo.jpg)
148
- EOF
149
- @diary.append(source)
150
- @html = <<-EOF
151
- <div class="section">
152
- <%=section_enter_proc( Time.at( 1041346800 ) )%>
153
- <h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
154
- <p><img src="http://www.google.com/logo.jpg" alt=""></p>
155
-
156
- <p><img src="http://www.google.com/logo.jpg" alt="google"></p>
157
- <%=section_leave_proc( Time.at( 1041346800 ) )%>
158
- </div>
159
- EOF
160
- end
161
-
162
- it { expect(@diary.to_html).to eq @html }
163
-
164
- end
165
-
166
- describe 'auto imagelink' do
167
- before do
168
- source = <<-EOF
169
- # subTitle
170
-
171
- <a href="http://www.exaple.com" target="_blank">Anchor</a>
172
- EOF
173
- @diary.append(source)
174
- @html = <<-EOF
175
- <div class="section">
176
- <%=section_enter_proc( Time.at( 1041346800 ) )%>
177
- <h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
178
- <p><a href="http://www.exaple.com" target="_blank">Anchor</a></p>
179
- <%=section_leave_proc( Time.at( 1041346800 ) )%>
180
- </div>
181
- EOF
182
- end
183
-
184
- it { expect(@diary.to_html).to eq @html }
185
-
186
- end
187
-
188
- describe 'url syntax with code blocks' do
189
- before do
190
- source = <<-'EOF'
191
- # subTitle
192
-
193
- ```ruby
194
- @foo
195
- ```
196
-
197
- http://example.com is example.com
198
-
199
- EOF
200
- @diary.append(source)
201
-
202
- @html = <<-'EOF'
203
- <div class="section">
204
- <%=section_enter_proc( Time.at( 1041346800 ) )%>
205
- <h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
206
- <div class="highlight"><pre class="highlight"><code><span class="vi">@foo</span>
207
- </code></pre></div>
208
- <p><a href="http://example.com">http://example.com</a> is example.com</p>
209
- <%=section_leave_proc( Time.at( 1041346800 ) )%>
210
- </div>
211
- EOF
212
- end
213
- it { expect(@diary.to_html).to eq @html }
214
- end
215
-
216
- describe 'ignored url syntax with markdown anchor' do
217
- before do
218
- source = <<-'EOF'
219
- # subTitle
220
-
221
- [example](http://example.com) is example.com
222
-
223
- EOF
224
- @diary.append(source)
225
-
226
- @html = <<-'EOF'
227
- <div class="section">
228
- <%=section_enter_proc( Time.at( 1041346800 ) )%>
229
- <h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
230
- <p><a href="http://example.com">example</a> is example.com</p>
231
- <%=section_leave_proc( Time.at( 1041346800 ) )%>
232
- </div>
233
- EOF
234
- end
235
- it { expect(@diary.to_html).to eq @html }
236
- end
237
-
238
- describe 'plugin syntax' do
239
- before do
240
- source = <<-'EOF'
241
- # subTitle
242
- {{plugin 'val'}}
243
-
244
- {{plugin "val", 'val'}}
245
-
246
- {{plugin <<EOS, 'val'
247
- valval
248
- valval
249
- vaoooo
250
- EOS
251
- }}
252
-
253
- EOF
254
- @diary.append(source)
255
-
256
- @html = <<-'EOF'
257
- <div class="section">
258
- <%=section_enter_proc( Time.at( 1041346800 ) )%>
259
- <h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
260
- <p><%=plugin 'val'%></p>
261
-
262
- <p><%=plugin "val", 'val'%></p>
263
-
264
- <p><%=plugin <<EOS, 'val'
265
- valval
266
- valval
267
- vaoooo
268
- EOS
269
- %></p>
270
- <%=section_leave_proc( Time.at( 1041346800 ) )%>
271
- </div>
272
- EOF
273
- end
274
- it { expect(@diary.to_html).to eq @html }
275
- end
276
-
277
- describe 'plugin syntax with url args' do
278
- before do
279
- source = <<-'EOF'
280
- # subTitle
281
- {{plugin 'http://www.example.com/foo.html', "https://www.example.com/bar.html"}}
282
-
283
- EOF
284
- @diary.append(source)
285
-
286
- @html = <<-'EOF'
287
- <div class="section">
288
- <%=section_enter_proc( Time.at( 1041346800 ) )%>
289
- <h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
290
- <p><%=plugin 'http://www.example.com/foo.html', "https://www.example.com/bar.html"%></p>
291
- <%=section_leave_proc( Time.at( 1041346800 ) )%>
292
- </div>
293
- EOF
294
- end
295
- it { expect(@diary.to_html).to eq @html }
296
- end
297
-
298
- describe 'link to my plugin' do
299
- before do
300
- source = <<-'EOF'
301
- # subTitle
302
-
303
- [](20120101p01)
304
-
305
- [Link](20120101p01)
306
-
307
- EOF
308
- @diary.append(source)
309
-
310
- @html = <<-'EOF'
311
- <div class="section">
312
- <%=section_enter_proc( Time.at( 1041346800 ) )%>
313
- <h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
314
- <p><%=my "20120101p01", "20120101p01" %></p>
315
-
316
- <p><%=my "20120101p01", "Link" %></p>
317
- <%=section_leave_proc( Time.at( 1041346800 ) )%>
318
- </div>
319
- EOF
320
- end
321
- it { expect(@diary.to_html).to eq @html }
322
- end
323
-
324
- describe 'code highlighting' do
325
- before do
326
- source = <<-'EOF'
327
- # subTitle
328
-
329
- ```ruby
330
- def class
331
- @foo = 'bar'
332
- end
333
- ```
334
- EOF
335
- @diary.append(source)
336
-
337
- @html = <<-'EOF'
338
- <div class="section">
339
- <%=section_enter_proc( Time.at( 1041346800 ) )%>
340
- <h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
341
- <div class="highlight"><pre class="highlight"><code> <span class="k">def</span> <span class="nf">class</span>
342
- <span class="vi">@foo</span> <span class="o">=</span> <span class="s1">'bar'</span>
343
- <span class="k">end</span>
344
- </code></pre></div><%=section_leave_proc( Time.at( 1041346800 ) )%>
345
- </div>
346
- EOF
347
- end
348
- it { expect(@diary.to_html).to eq @html }
349
- end
350
-
351
- describe 'ignore emphasis' do
352
- before do
353
- source = <<-'EOF'
354
- # subTitle
355
-
356
- @a_matsuda is amatsuda
357
-
358
- {{isbn_left_image ''}}
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>@<a class="tweet-url username" href="https://twitter.com/a_matsuda" rel="nofollow">a_matsuda</a> is amatsuda</p>
367
-
368
- <p><%=isbn_left_image ''%></p>
369
- <%=section_leave_proc( Time.at( 1041346800 ) )%>
370
- </div>
371
- EOF
372
- end
373
- it { expect(@diary.to_html).to eq @html }
374
- end
375
-
376
- context 'twitter username' do
377
- describe 'in plain context' do
378
- before do
379
- source = <<-'EOF'
380
- # subTitle
381
-
382
- @a_matsuda is amatsuda
383
- EOF
384
- @diary.append(source)
385
-
386
- @html = <<-'EOF'
387
- <div class="section">
388
- <%=section_enter_proc( Time.at( 1041346800 ) )%>
389
- <h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
390
- <p>@<a class="tweet-url username" href="https://twitter.com/a_matsuda" rel="nofollow">a_matsuda</a> is amatsuda</p>
391
- <%=section_leave_proc( Time.at( 1041346800 ) )%>
392
- </div>
393
- EOF
394
- end
395
- it { expect(@diary.to_html).to eq @html }
396
- end
397
-
398
- describe 'with <pre>' do
399
- before do
400
- source = <<-'EOF'
401
- # subTitle
402
-
403
- p :some_code
404
-
405
- @a_matsuda is amatsuda
406
- EOF
407
- @diary.append(source)
408
-
409
- @html = <<-'EOF'
410
- <div class="section">
411
- <%=section_enter_proc( Time.at( 1041346800 ) )%>
412
- <h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
413
- <pre><code>p :some_code
414
- </code></pre>
415
-
416
- <p>@a_matsuda is amatsuda</p>
417
- <%=section_leave_proc( Time.at( 1041346800 ) )%>
418
- </div>
419
- EOF
420
- end
421
- it { expect(@diary.to_html).to eq @html }
422
- end
423
-
424
- describe 'with <code>' do
425
- before do
426
- source = <<-'EOF'
427
- # subTitle
428
-
429
- `:some_code`
430
-
431
- @a_matsuda is amatsuda
432
- EOF
433
- @diary.append(source)
434
-
435
- @html = <<-'EOF'
436
- <div class="section">
437
- <%=section_enter_proc( Time.at( 1041346800 ) )%>
438
- <h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
439
- <p><code>:some_code</code></p>
440
-
441
- <p>@a_matsuda is amatsuda</p>
442
- <%=section_leave_proc( Time.at( 1041346800 ) )%>
443
- </div>
444
- EOF
445
- end
446
- it { expect(@diary.to_html).to eq @html }
447
- end
448
- end
449
-
450
- context 'emoji' do
451
- describe 'in plain context' do
452
- before do
453
- source = <<-'EOF'
454
- # subTitle
455
-
456
- :sushi: は美味しい
457
- EOF
458
- @diary.append(source)
459
-
460
- @html = <<-'EOF'
461
- <div class="section">
462
- <%=section_enter_proc( Time.at( 1041346800 ) )%>
463
- <h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
464
- <p><img src='//www.webpagefx.com/tools/emoji-cheat-sheet/graphics/emojis/sushi.png' width='20' height='20' title='sushi' alt='sushi' class='emoji' /> は美味しい</p>
465
- <%=section_leave_proc( Time.at( 1041346800 ) )%>
466
- </div>
467
- EOF
468
- end
469
- it { expect(@diary.to_html).to eq @html }
470
- end
471
-
472
- describe 'in (multiline) <pre>' do
473
- before do
474
- source = <<-'EOF'
475
- # subTitle
476
-
477
- ```
478
- :sushi: は
479
- 美味しい
480
- ```
481
- EOF
482
- @diary.append(source)
483
-
484
- @html = <<-'EOF'
485
- <div class="section">
486
- <%=section_enter_proc( Time.at( 1041346800 ) )%>
487
- <h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
488
- <pre><code>:sushi: は
489
- 美味しい
490
- </code></pre>
491
- <%=section_leave_proc( Time.at( 1041346800 ) )%>
492
- </div>
493
- EOF
494
- end
495
- it { expect(@diary.to_html).to eq @html }
496
- end
497
-
498
- describe 'in <code>' do
499
- before do
500
- source = <<-'EOF'
501
- # subTitle
502
-
503
- `:sushi:` は美味しい
504
- EOF
505
- @diary.append(source)
506
-
507
- @html = <<-'EOF'
508
- <div class="section">
509
- <%=section_enter_proc( Time.at( 1041346800 ) )%>
510
- <h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
511
- <p><code>:sushi:</code> は美味しい</p>
512
- <%=section_leave_proc( Time.at( 1041346800 ) )%>
513
- </div>
514
- EOF
515
- end
516
- it { expect(@diary.to_html).to eq @html }
517
- end
518
-
519
- describe 'in <code> (with attribute)' do
520
- before do
521
- source = <<-'EOF'
522
- # subTitle
523
-
524
- <code class="foo">:sushi:</code> は美味しい
525
- EOF
526
- @diary.append(source)
527
-
528
- @html = <<-'EOF'
529
- <div class="section">
530
- <%=section_enter_proc( Time.at( 1041346800 ) )%>
531
- <h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
532
- <p><code class="foo">:sushi:</code> は美味しい</p>
533
- <%=section_leave_proc( Time.at( 1041346800 ) )%>
534
- </div>
535
- EOF
536
- end
537
- it { expect(@diary.to_html).to eq @html }
538
- end
539
- end
540
-
541
- describe 'do not modify original string' do
542
- before do
543
- @orig_source = <<-'EOF'
544
- # subTitle
545
-
546
- {{fn 'テスト'}}"
547
- EOF
548
- @source = @orig_source.dup
549
- @diary.append(@source)
550
- @diary.to_html
551
-
552
- @section = nil
553
- @diary.each_section{|x| @section = x}
554
- end
555
- it { expect(@section.body).to eq("\n"+@orig_source.lines.to_a.last+"\n") }
556
- end
557
-
558
- describe 'stashes in pre, code, plugin' do
559
- before do
560
- source = <<-'EOF'
561
- # subTitle
562
-
563
- ```
564
- ruby -e "puts \"hello, world.\""
565
- ```
566
-
567
- `ruby -e "puts \"hello, world.\""`
568
-
569
- {{plugin "\0", "\1", "\2"}}
570
- EOF
571
- @diary.append(source)
572
-
573
- @html = <<-'EOF'
574
- <div class="section">
575
- <%=section_enter_proc( Time.at( 1041346800 ) )%>
576
- <h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
577
- <pre><code>ruby -e &quot;puts \&quot;hello, world.\&quot;&quot;
578
- </code></pre>
579
-
580
- <p><code>ruby -e &quot;puts \&quot;hello, world.\&quot;&quot;</code></p>
581
-
582
- <p><%=plugin "\0", "\1", "\2"%></p>
583
- <%=section_leave_proc( Time.at( 1041346800 ) )%>
584
- </div>
585
- EOF
586
- end
587
- it { expect(@diary.to_html).to eq @html }
588
- end
589
-
590
- describe 'plugin syntax in pre, code block' do
591
- before do
592
- source = <<-'EOF'
593
- # subTitle
594
-
595
- Get IP Address of Docker Container:
596
-
597
- ```
598
- % docker inspect -f "{{.NetworkSettings.IPAddress}} {{.Config.Hostname}} # Name:{{.Name}}" `docker ps -q`
599
- ```
600
-
601
- NOTE: `{{.NetworkSettings.IPAddress}}` is golang template.
602
- EOF
603
- @diary.append(source)
604
-
605
- @html = <<-'EOF'
606
- <div class="section">
607
- <%=section_enter_proc( Time.at( 1041346800 ) )%>
608
- <h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
609
- <p>Get IP Address of Docker Container:</p>
610
-
611
- <pre><code>% docker inspect -f &quot;{{.NetworkSettings.IPAddress}} {{.Config.Hostname}} # Name:{{.Name}}&quot; `docker ps -q`
612
- </code></pre>
613
-
614
- <p>NOTE: <code>{{.NetworkSettings.IPAddress}}</code> is golang template.</p>
615
- <%=section_leave_proc( Time.at( 1041346800 ) )%>
616
- </div>
617
- EOF
618
- end
619
- it { expect(@diary.to_html).to eq @html }
620
- end
621
- end
622
-
623
- # Local Variables:
624
- # mode: ruby
625
- # indent-tabs-mode: t
626
- # tab-width: 3
627
- # ruby-indent-level: 3
628
- # End: