tdiary-style-markdown 0.3.0 → 0.4.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
  SHA1:
3
- metadata.gz: 2bab61514aa2d79021f5c4aee983ea1810af321e
4
- data.tar.gz: 0fffb76baf10b7e22a9d0a73729c8cf578c75ff5
3
+ metadata.gz: 813eba40c02dfa8d534b87fa14f7afa019b6c3e4
4
+ data.tar.gz: 66c14010055ff983960bc368eef48caa029a99e0
5
5
  SHA512:
6
- metadata.gz: 112d0e5b9e02747c1c95dbca5d244401a37066d961b692eabc484326d8ba2c10e82a59f2c1c88f6f573ab684fb2bd16a6f8c9104296ada8d736284524be53fe1
7
- data.tar.gz: 188eccdbde931f708883365ea552cc66dd8c7f65e9ca3bbe2d69bd7c96c69280ef31dec53707f5aed411683ce7be33f9fd79015022605be171cfa9a0599e39f3
6
+ metadata.gz: db1f5f7bb6dd4bfe204c4e37a6d08ce643fc166de0dd45dafed3588b9a3e3c50f9dde9967e9d6c1f2dd0cf62f44cc82266fa60172d80d2a5fc4878beb7a22ae9
7
+ data.tar.gz: 76ab1c326848a3a1b3eaad4be613d1d56bcfc465f61fbc4a4dfa02da2bd2e655fa0a3f586281a80a9f96118e403cde8ece8138604409a2a6fb8c7087d73aa182
data/Gemfile CHANGED
@@ -4,3 +4,4 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  gem 'tdiary', github: 'tdiary/tdiary-core'
7
+ gem 'emot'
data/README.md CHANGED
@@ -20,10 +20,21 @@ Or install it yourself as:
20
20
 
21
21
  ## Usage
22
22
 
23
- if you want to use this style, add @style into tdiary.conf below:
23
+ If you want to use this style, add @style into tdiary.conf below:
24
24
 
25
25
  @style = 'Markdown'
26
26
 
27
+ ### Style sheet
28
+
29
+ Use [rouge](https://github.com/jneen/rouge) for syntax highlighting.
30
+
31
+ ```text
32
+ $ rougify style github > public/github.css
33
+ ```
34
+
35
+ Add `@import url("/github.css");` to your style sheet via tdiary
36
+ configuration.
37
+
27
38
  ## Contributing
28
39
 
29
40
  1. Fork it
@@ -1,5 +1,6 @@
1
1
  require 'redcarpet'
2
- require 'pygments'
2
+ require 'rouge'
3
+ require 'rouge/plugins/redcarpet'
3
4
  require 'twitter-text'
4
5
 
5
6
  module TDiary
@@ -61,7 +62,7 @@ module TDiary
61
62
  end
62
63
 
63
64
  # 2. Apply markdown conversion
64
- renderer = Redcarpet::Markdown.new(HTMLwithPygments,
65
+ renderer = Redcarpet::Markdown.new(HTMLwithRouge,
65
66
  fenced_code_blocks: true,
66
67
  tables: true,
67
68
  autolink: true,
@@ -124,7 +125,7 @@ module TDiary
124
125
  end
125
126
  end
126
127
 
127
- footnote_stashes = HTMLwithPygments.tdiary_style_markdown_footnote_stashes
128
+ footnote_stashes = HTMLwithRouge.tdiary_style_markdown_footnote_stashes
128
129
  footnote_stashes.each do |num, raw_content|
129
130
  if r["@@tdiary-style-markdown-footnote-#{num}@@"]
130
131
  r["@@tdiary-style-markdown-footnote-#{num}@@"] = raw_content
@@ -199,17 +200,14 @@ module TDiary
199
200
  end
200
201
  end
201
202
 
202
- class HTMLwithPygments < Redcarpet::Render::HTML
203
+ class HTMLwithRouge < Redcarpet::Render::HTML
204
+ include Rouge::Plugins::Redcarpet
203
205
  @@tdiary_style_markdown_footnote_stashes = []
204
206
 
205
207
  def self.tdiary_style_markdown_footnote_stashes
206
208
  @@tdiary_style_markdown_footnote_stashes
207
209
  end
208
210
 
209
- def block_code(code, language)
210
- Pygments.highlight(code, lexer: language)
211
- end
212
-
213
211
  def footnotes(content)
214
212
  ""
215
213
  end
@@ -1,7 +1,7 @@
1
1
  module TDiary
2
2
  module Style
3
3
  module Markdown
4
- VERSION = "0.3.0"
4
+ VERSION = "0.4.0"
5
5
  end
6
6
  end
7
7
  end
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_dependency 'redcarpet'
22
- spec.add_dependency 'pygments.rb'
22
+ spec.add_dependency 'rouge'
23
23
  spec.add_dependency 'twitter-text'
24
24
  spec.add_dependency 'gemoji'
25
25
 
@@ -33,8 +33,9 @@ honbun
33
33
  <h4>subTitleH4</h4>
34
34
 
35
35
  <p>honbun</p>
36
- <div class="highlight"><pre><span class="c"># comment in code block</span>
37
- </pre></div><%=section_leave_proc( Time.at( 1041346800 ) )%>
36
+ <pre class="highlight plaintext"><code># comment in code block
37
+ </code></pre>
38
+ <%=section_leave_proc( Time.at( 1041346800 ) )%>
38
39
  </div>
39
40
  EOF
40
41
  assert_equal(@html, @diary.to_html)
@@ -171,8 +172,9 @@ http://example.com is example.com
171
172
  <div class="section">
172
173
  <%=section_enter_proc( Time.at( 1041346800 ) )%>
173
174
  <h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
174
- <div class="highlight"><pre><span class="vi">@foo</span>
175
- </pre></div>
175
+ <pre class="highlight ruby"><code><span class="vi">@foo</span>
176
+ </code></pre>
177
+
176
178
  <p><a href="http://example.com">http://example.com</a> is example.com</p>
177
179
  <%=section_leave_proc( Time.at( 1041346800 ) )%>
178
180
  </div>
@@ -282,10 +284,11 @@ http://example.com is example.com
282
284
  <div class="section">
283
285
  <%=section_enter_proc( Time.at( 1041346800 ) )%>
284
286
  <h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
285
- <div class="highlight"><pre> <span class="k">def</span> <span class="nf">class</span>
286
- <span class="vi">@foo</span> <span class="o">=</span> <span class="s1">&#39;bar&#39;</span>
287
+ <pre class="highlight ruby"><code> <span class="k">def</span> <span class="nf">class</span>
288
+ <span class="vi">@foo</span> <span class="o">=</span> <span class="s1">'bar'</span>
287
289
  <span class="k">end</span>
288
- </pre></div><%=section_leave_proc( Time.at( 1041346800 ) )%>
290
+ </code></pre>
291
+ <%=section_leave_proc( Time.at( 1041346800 ) )%>
289
292
  </div>
290
293
  EOF
291
294
  assert_equal(@html, @diary.to_html)
@@ -327,8 +330,9 @@ p :some_code
327
330
  <div class="section">
328
331
  <%=section_enter_proc( Time.at( 1041346800 ) )%>
329
332
  <h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
330
- <div class="highlight"><pre><span class="nb">p</span> <span class="ss">:some_code</span>
331
- </pre></div>
333
+ <pre class="highlight ruby"><code><span class="nb">p</span> <span class="ss">:some_code</span>
334
+ </code></pre>
335
+
332
336
  <p>@a_matsuda is amatsuda</p>
333
337
  <%=section_leave_proc( Time.at( 1041346800 ) )%>
334
338
  </div>
@@ -395,9 +399,10 @@ p :some_code
395
399
  <div class="section">
396
400
  <%=section_enter_proc( Time.at( 1041346800 ) )%>
397
401
  <h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
398
- <div class="highlight"><pre><span class="o">:</span><span class="nl">sushi:</span><span class="w"> </span><span class="err">は</span>
399
- <span class="err">美味しい</span>
400
- </pre></div><%=section_leave_proc( Time.at( 1041346800 ) )%>
402
+ <pre class="highlight plaintext"><code>:sushi:
403
+ 美味しい
404
+ </code></pre>
405
+ <%=section_leave_proc( Time.at( 1041346800 ) )%>
401
406
  </div>
402
407
  EOF
403
408
  assert_equal(@html, @diary.to_html)
@@ -460,8 +465,9 @@ ruby -e "puts \"hello, world.\""
460
465
  <div class="section">
461
466
  <%=section_enter_proc( Time.at( 1041346800 ) )%>
462
467
  <h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
463
- <div class="highlight"><pre><span class="vg">ruby</span><span class="w"> </span><span class="o">-</span><span class="vg">e</span><span class="w"> </span><span class="s2">&quot;puts \&quot;</span><span class="vg">hello</span><span class="p">,</span><span class="w"> </span><span class="vg">world</span><span class="o">.\</span><span class="s2">&quot;&quot;</span>
464
- </pre></div>
468
+ <pre class="highlight plaintext"><code>ruby -e "puts \"hello, world.\""
469
+ </code></pre>
470
+
465
471
  <p><code>ruby -e &quot;puts \&quot;hello, world.\&quot;&quot;</code></p>
466
472
 
467
473
  <p><%=plugin "\0", "\1", "\2"%></p>
@@ -490,8 +496,9 @@ NOTE: `{{.NetworkSettings.IPAddress}}` is golang template.
490
496
  <%=section_enter_proc( Time.at( 1041346800 ) )%>
491
497
  <h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
492
498
  <p>Get IP Address of Docker Container:</p>
493
- <div class="highlight"><pre><span class="o">%</span> <span class="n">docker</span> <span class="n">inspect</span> <span class="o">-</span><span class="n">f</span> <span class="s">&quot;{{.NetworkSettings.IPAddress}} {{.Config.Hostname}} # Name:{{.Name}}&quot;</span> <span class="err">`</span><span class="n">docker</span> <span class="n">ps</span> <span class="o">-</span><span class="n">q</span><span class="err">`</span>
494
- </pre></div>
499
+ <pre class="highlight plaintext"><code>% docker inspect -f "{{.NetworkSettings.IPAddress}} {{.Config.Hostname}} # Name:{{.Name}}" `docker ps -q`
500
+ </code></pre>
501
+
495
502
  <p>NOTE: <code>{{.NetworkSettings.IPAddress}}</code> is golang template.</p>
496
503
  <%=section_leave_proc( Time.at( 1041346800 ) )%>
497
504
  </div>
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.3.0
4
+ version: 0.4.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-18 00:00:00.000000000 Z
11
+ date: 2016-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redcarpet
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: pygments.rb
28
+ name: rouge
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -147,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
147
  version: '0'
148
148
  requirements: []
149
149
  rubyforge_project:
150
- rubygems_version: 2.2.2
150
+ rubygems_version: 2.5.1
151
151
  signing_key:
152
152
  specification_version: 4
153
153
  summary: Markdown Style for tDiary