md2review 1.4.0 → 1.5.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: 47cac18a12085d3bdb0239c62b58fe2dbe5555c8
4
- data.tar.gz: fbc94b20594d10698e9c9ec17b30c6267472357c
3
+ metadata.gz: 2d8b18e0e9542e371228ec43dc79fd5e91ebfc80
4
+ data.tar.gz: 5596daa94be80f6eb847003ebf0d96780c090b84
5
5
  SHA512:
6
- metadata.gz: 2a3c26c36591f4f5c3dd632b8a4d0ddbe00513253a1bfcaf48775659479105cce2beca2c1b25f54c1f597fceb2654f6fe4ea84070ded41e4e0bf1ae48e493139
7
- data.tar.gz: e62530cb1aebdac4ee717c18d3acae3aedea6ddeb2e05f9774e76cf105e5d5cbc98d02325221d31ffb673a12e6757b4577b48fac89cdbfb993381e8d90217d67
6
+ metadata.gz: 289771273affbc3a4c597297c91f120662ddeb79e9eb87cf6887bc2bcd77b387deebb2f9aacd1a8e971d0b2c54f370bb45bdc59632fd2f42d25f6f11fe3504cf
7
+ data.tar.gz: 242562c5061128eb046ddf80b998662dc787c1cb7a8f3257653ab65e38d7a4406501bdd969b293f0330f55a439ed6553041af3ab2ec8eb0bfdf866b3e4bcf191
data/README.md CHANGED
@@ -27,6 +27,9 @@ You can use the commmand md2review as:
27
27
 
28
28
  ## History
29
29
 
30
+ * 1.5.0
31
+ * support language on code block
32
+ * add option --render-enable-cmd
30
33
  * 1.4.0
31
34
  * fix handling empty cell in //table
32
35
  * support header attributes in PHP Markdown Extra
@@ -1,3 +1,3 @@
1
1
  module MD2ReVIEW
2
- VERSION = "1.4.0"
2
+ VERSION = "1.5.0"
3
3
  end
@@ -15,6 +15,7 @@ module Redcarpet
15
15
  @header_offset = render_extensions[:header_offset]
16
16
  end
17
17
  @links = {}
18
+ @cmd = render_extensions[:enable_cmd]
18
19
  end
19
20
 
20
21
  def normal_text(text)
@@ -37,10 +38,15 @@ module Redcarpet
37
38
  if language =~ /caption=\"(.*)\"/
38
39
  caption = "["+$1+"]"
39
40
  else
40
- lang = "#\@# lang: #{language}\n"
41
+ caption = "[][#{language}]"
41
42
  end
42
43
  end
43
- "\n#{lang}//emlist#{caption}{\n#{code_text}\n//}\n"
44
+
45
+ if @cmd && (language == "shell-session" || language == "console")
46
+ "\n//cmd{\n#{code_text}\n//}\n"
47
+ else
48
+ "\n//emlist#{caption}{\n#{code_text}\n//}\n"
49
+ end
44
50
  end
45
51
 
46
52
  def block_quote(quote)
data/test/review_test.rb CHANGED
@@ -102,6 +102,20 @@ class ReVIEWTest < Test::Unit::TestCase
102
102
  assert_equal %Q[\n\n~~~ {caption="test"}\ndef foo\n p "test"\nend\n~~~\n\n], rd
103
103
  end
104
104
 
105
+ def test_code_fence_with_lang
106
+ rd = render_with({:fenced_code_blocks => true}, %Q[~~~ruby\ndef foo\n p "test"\nend\n~~~\n])
107
+ assert_equal %Q[\n//emlist[][ruby]{\ndef foo\n p "test"\nend\n//}\n], rd
108
+ end
109
+
110
+ def test_code_fence_with_console
111
+ rd = render_with({:fenced_code_blocks => true}, %Q[~~~console\ndef foo\n p "test"\nend\n~~~\n])
112
+ assert_equal %Q[\n//emlist[][console]{\ndef foo\n p "test"\nend\n//}\n], rd
113
+ rd = render_with({:fenced_code_blocks => true},
114
+ %Q[~~~console\ndef foo\n p "test"\nend\n~~~\n],
115
+ {:enable_cmd => true})
116
+ assert_equal %Q[\n//cmd{\ndef foo\n p "test"\nend\n//}\n], rd
117
+ end
118
+
105
119
  def test_group_ruby
106
120
  rd = render_with({:ruby => true}, "{電子出版|でんししゅっぱん}を手軽に\n")
107
121
  assert_equal %Q[\n\n@<ruby>{電子出版,でんししゅっぱん}を手軽に\n\n], rd
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: md2review
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - takahashim