md2review 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 26d828ba35042062e4e8d534bdf6c84b57f3519d
4
+ data.tar.gz: a9dd76ad0f29ea57c4c38cf5e214abdf0c27e7b8
5
+ SHA512:
6
+ metadata.gz: 932e10a53407736e0090698f5a84364b5ad3d962978a11ae40133c458e9b285871500ae589fcc5790d66b0e024cb85702de59515b4d3097dc464672e44015981
7
+ data.tar.gz: 51ee71ac7c2479acd43d8d76d471e6349dbf98bb98e6ce581ea8952897a32a6a24179308797f4d69d7baef2ed363c71bddd2751b26ffa7827fa6039fcb0312d5
data/.gitignore CHANGED
@@ -1,5 +1,7 @@
1
1
  *.gem
2
2
  *.rbc
3
+ *~
4
+ #*#
3
5
  .bundle
4
6
  .config
5
7
  .yardoc
data/README.md CHANGED
@@ -21,7 +21,7 @@ Or install it yourself as:
21
21
 
22
22
  You can use the commmand md2review as:
23
23
 
24
- $ md2review your-document.md > your-document.re
24
+ $ md2review your-document.md > your-document.re
25
25
 
26
26
  ## Contributing
27
27
 
data/bin/md2review CHANGED
@@ -26,7 +26,9 @@ parse_extensions[:fenced_code_blocks] = true
26
26
  renderer = Redcarpet::Render::ReVIEW
27
27
 
28
28
  ARGV.delete_if do |arg|
29
- if arg =~ /^--render-([\w-]+)$/
29
+ if arg =~ /^--render-header-offset\s*=\s*([012])$/
30
+ render_extensions[:header_offset] = $1.to_i
31
+ elsif arg =~ /^--render-([\w-]+)$/
30
32
  arg = $1.gsub('-', '_')
31
33
  render_extensions[arg.to_sym] = true
32
34
  elsif arg =~ /^--parse-([\w-]+)$/
@@ -1,3 +1,3 @@
1
1
  module MD2ReVIEW
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -6,12 +6,20 @@ module Redcarpet
6
6
  super()
7
7
  @table_num = 0
8
8
  @table_id_prefix = "tbl"
9
+ @header_offset = 0
10
+ if render_extensions[:header_offset]
11
+ @header_offset = render_extensions[:header_offset]
12
+ end
9
13
  end
10
14
 
11
15
  def normal_text(text)
12
16
  text
13
17
  end
14
18
 
19
+ def escape_inline(text)
20
+ text.gsub(/\}/){'\\}'}
21
+ end
22
+
15
23
  def block_code(code, language)
16
24
  code_text = normal_text(code).chomp
17
25
  lang = ""
@@ -38,11 +46,12 @@ module Redcarpet
38
46
  end
39
47
 
40
48
  def codespan(code)
41
- "@<tt>{#{normal_text(code)}}"
49
+ "@<tt>{#{escape_inline(code)}}"
42
50
  end
43
51
 
44
52
  def header(title, level)
45
- case level
53
+ l = level - @header_offset
54
+ case l
46
55
  when 1
47
56
  "\n= #{title}\n"
48
57
  when 2
@@ -60,6 +69,7 @@ module Redcarpet
60
69
  if header
61
70
  header_text = "#{header}-----------------\n"
62
71
  end
72
+ body.chomp!
63
73
  "//table[#{table_id()}][]{\n#{header_text}#{body}\n//}\n"
64
74
  end
65
75
 
@@ -80,23 +90,23 @@ module Redcarpet
80
90
  end
81
91
 
82
92
  def autolink(link, link_type)
83
- "@<href>{#{link}}"
93
+ "@<href>{#{escape_inline(link)}}"
84
94
  end
85
95
 
86
96
  def link(link, title, content)
87
- "@<href>{#{link},#{content}}"
97
+ "@<href>{#{escape_inline(link)},#{escape_inline(content)}}"
88
98
  end
89
99
 
90
100
  def double_emphasis(text)
91
- "@<strong>{#{text}}"
101
+ "@<strong>{#{escape_inline(text)}}"
92
102
  end
93
103
 
94
104
  def emphasis(text)
95
- "@<b>{#{text}}"
105
+ "@<b>{#{escape_inline(text)}}"
96
106
  end
97
107
 
98
108
  def strikethrough(text)
99
- "@<del>{#{text}}"
109
+ "@<del>{#{escape_inline(text)}}"
100
110
  end
101
111
 
102
112
  def linebreak
metadata CHANGED
@@ -1,30 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: md2review
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
5
- prerelease:
4
+ version: 1.0.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - takahashim
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-11-23 00:00:00.000000000 Z
11
+ date: 2013-10-19 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: redcarpet
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>'
17
+ - - '>'
20
18
  - !ruby/object:Gem::Version
21
19
  version: 2.0.0
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>'
24
+ - - '>'
28
25
  - !ruby/object:Gem::Version
29
26
  version: 2.0.0
30
27
  description: a converter MD -> ReVIEW
@@ -47,26 +44,25 @@ files:
47
44
  - md2review.gemspec
48
45
  homepage: ''
49
46
  licenses: []
47
+ metadata: {}
50
48
  post_install_message:
51
49
  rdoc_options: []
52
50
  require_paths:
53
51
  - lib
54
52
  required_ruby_version: !ruby/object:Gem::Requirement
55
- none: false
56
53
  requirements:
57
- - - ! '>='
54
+ - - '>='
58
55
  - !ruby/object:Gem::Version
59
56
  version: '0'
60
57
  required_rubygems_version: !ruby/object:Gem::Requirement
61
- none: false
62
58
  requirements:
63
- - - ! '>='
59
+ - - '>='
64
60
  - !ruby/object:Gem::Version
65
61
  version: '0'
66
62
  requirements: []
67
63
  rubyforge_project:
68
- rubygems_version: 1.8.24
64
+ rubygems_version: 2.1.5
69
65
  signing_key:
70
- specification_version: 3
66
+ specification_version: 4
71
67
  summary: a converter MD -> ReVIEW
72
68
  test_files: []