redrug 0.2.6 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/redrug +12 -5
  3. data/lib/red_rug.rb +8 -4
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e142336c9236b42f57e62dfdf0c947a2c9d91002
4
- data.tar.gz: 4e64d84e419e4071e5795816572695800e8fd7d9
3
+ metadata.gz: b28a70768420e25e2504fc03468bff2dda20eb02
4
+ data.tar.gz: f58513ae5ec0d9975be0582f2b9d48c7aa255348
5
5
  SHA512:
6
- metadata.gz: 449431b3e91a67dbf92fc471aceac85e8b456b2ecfb461d527ec44298a493afec86704825486a54f955ae6851228d11a934a168283a85642af4eebee1cb2e356
7
- data.tar.gz: 04825959750b2fd163990fbdbf0057485dcb3c6b7174273320e95d3bd59b3456eaf272dff734c5433b6573b765bdd28d1889c982e7e9e1406b564c9d871970f8
6
+ metadata.gz: c927e151019a06056f4f641e7d0f07bac755c242d81fc81bd935fafa7d01285ce756aac7b8e8d5799e4a53664e8c56377ae57d04ad5b88378986079b6c089144
7
+ data.tar.gz: a325d5b66ef979be5da8cde63d3785203ca6a795a4c7bb4d322548e577481c88f3a5fbbdef3de1fb6f09d306ae0037e0ffe74957e5ecf1d45170da56a12fe801
data/bin/redrug CHANGED
@@ -3,8 +3,9 @@ require 'optparse'
3
3
  require 'red_rug'
4
4
 
5
5
  help_text = {
6
- :help => 'Display this help text.',
7
- :version => 'Display version and license information.'
6
+ escape: 'Escape all embedded HTML before parsing markdown.',
7
+ help: 'Display this help text.',
8
+ version: 'Display version and license information.'
8
9
  }
9
10
 
10
11
  @usage = <<EOF
@@ -23,9 +24,15 @@ May be distributed under the terms of the Open Works License.
23
24
 
24
25
  EOF
25
26
 
27
+ options = Hash.new
28
+
26
29
  OptionParser.new do |opts|
27
30
  opts.banner = @usage
28
31
 
32
+ opts.on('--escape', '-e', help_text[:escape]) do
33
+ options[:escape_html] = true
34
+ end
35
+
29
36
  opts.on('--help', '-h', help_text[:help]) do
30
37
  puts opts
31
38
  puts
@@ -38,8 +45,8 @@ OptionParser.new do |opts|
38
45
  end
39
46
  end.parse!
40
47
 
41
- @content = String.new
48
+ content = String.new
42
49
 
43
- $<.each {|line| @content << line }
50
+ $<.each {|line| content << line }
44
51
 
45
- puts RedRug.to_html @content
52
+ puts RedRug.to_html(content, options)
@@ -17,8 +17,8 @@ module RedRug
17
17
  include Versionize
18
18
  @version = {
19
19
  :major => 0,
20
- :minor => 2,
21
- :revision => 6
20
+ :minor => 3,
21
+ :revision => 0
22
22
  }
23
23
 
24
24
  =begin rdoc
@@ -35,8 +35,12 @@ Example:
35
35
 
36
36
  =end
37
37
 
38
- def self.to_html(markdown_string)
39
- markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML)
38
+ def self.to_html(markdown_string, options=Hash.new)
39
+ unless options.has_key? :escape_html
40
+ options[:escape_html] = false
41
+ end
42
+
43
+ markdown = Redcarpet::Markdown.new Redcarpet::Render::HTML.new(options)
40
44
  markdown.render(markdown_string)
41
45
  end
42
46
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redrug
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chad Perrin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-20 00:00:00.000000000 Z
11
+ date: 2015-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redcarpet
@@ -78,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
78
78
  version: '0'
79
79
  requirements: []
80
80
  rubyforge_project:
81
- rubygems_version: 2.4.6
81
+ rubygems_version: 2.4.5
82
82
  signing_key:
83
83
  specification_version: 4
84
84
  summary: RedRug - Simple Markdown Interface