redcarpet 1.5.0 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of redcarpet might be problematic. Click here for more details.

data/ext/redcarpet.c CHANGED
@@ -50,23 +50,21 @@ static void rb_redcarpet__get_flags(VALUE ruby_obj,
50
50
  if (rb_funcall(ruby_obj, rb_intern("generate_toc"), 0) == Qtrue)
51
51
  render_flags |= XHTML_TOC;
52
52
 
53
- if (rb_funcall(ruby_obj, rb_intern("no_strikethrough"), 0) == Qtrue)
54
- render_flags |= XHTML_SKIP_STRIKETHROUGH;
55
-
56
- /* parser - strict
57
- * This is fucking stupid; what the 'strict' flag actually
58
- * enforces is laxer emphasis parsing. So we use a properly
59
- * named flag internally, even if outside we have retarded
60
- * naming because of compat. issues .*/
53
+ /**
54
+ * Markdown extensions -- all disabled by default
55
+ */
61
56
  if (rb_funcall(ruby_obj, rb_intern("strict"), 0) == Qtrue)
62
57
  extensions |= MKDEXT_LAX_EMPHASIS;
63
58
 
64
- if (rb_funcall(ruby_obj, rb_intern("no_tables"), 0) != Qtrue)
59
+ if (rb_funcall(ruby_obj, rb_intern("tables"), 0) == Qtrue)
65
60
  extensions |= MKDEXT_TABLES;
66
61
 
67
- if (rb_funcall(ruby_obj, rb_intern("no_fencedcode"), 0) != Qtrue)
62
+ if (rb_funcall(ruby_obj, rb_intern("fenced_code"), 0) == Qtrue)
68
63
  extensions |= MKDEXT_FENCED_CODE;
69
64
 
65
+ if (rb_funcall(ruby_obj, rb_intern("strikethrough"), 0) == Qtrue)
66
+ render_flags |= XHTML_STRIKETHROUGH;
67
+
70
68
  *enabled_extensions_p = extensions;
71
69
  *render_flags_p = render_flags;
72
70
  }
data/ext/xhtml.c CHANGED
@@ -167,7 +167,7 @@ rndr_double_emphasis(struct buf *ob, struct buf *text, char c, void *opaque)
167
167
  return 0;
168
168
 
169
169
  if (c == '~') {
170
- if (options->flags & XHTML_SKIP_STRIKETHROUGH)
170
+ if ((options->flags & XHTML_STRIKETHROUGH) == 0)
171
171
  return 0;
172
172
 
173
173
  BUFPUTSL(ob, "<span style=\"text-decoration:line-through;\">");
data/ext/xhtml.h CHANGED
@@ -27,7 +27,7 @@ typedef enum {
27
27
  XHTML_AUTOLINK = (1 << 6),
28
28
  XHTML_SAFELINK = (1 << 7),
29
29
  XHTML_TOC = (1 << 8),
30
- XHTML_SKIP_STRIKETHROUGH = (1 << 10),
30
+ XHTML_STRIKETHROUGH = (1 << 10),
31
31
  } render_mode;
32
32
 
33
33
  void
data/lib/redcarpet.rb CHANGED
@@ -26,7 +26,7 @@
26
26
  # end
27
27
  #
28
28
  class Redcarpet
29
- VERSION = '1.5.0'
29
+ VERSION = '1.5.1'
30
30
 
31
31
  # Original Markdown formatted text.
32
32
  attr_reader :text
@@ -37,8 +37,6 @@ class Redcarpet
37
37
  # Do not output <tt><style></tt> tags included in the source text.
38
38
  attr_accessor :filter_styles
39
39
 
40
- attr_accessor :fold_lines # Ignore, just for compatibility
41
-
42
40
  # Do not output any raw HTML included in the source text.
43
41
  attr_accessor :filter_html
44
42
 
@@ -60,14 +58,17 @@ class Redcarpet
60
58
  # Add TOC anchors to every header
61
59
  attr_accessor :generate_toc
62
60
 
63
- # Do not process tables
64
- attr_accessor :no_tables
61
+ # Enable PHP-Markdown tables extension
62
+ attr_accessor :tables
63
+
64
+ # Enable PHP-Markdown ~~strikethrough~~ extension
65
+ attr_accessor :strikethrough
65
66
 
66
- # Do not process ~~strikethrough~~
67
- attr_accessor :no_strikethrough
67
+ # Enable PHP-Markdown fenced code extension
68
+ attr_accessor :fenced_code
68
69
 
69
- # Do not process fenced code blocks
70
- attr_accessor :no_fencedcode
70
+ # Backwards compatibility
71
+ attr_accessor :fold_lines
71
72
 
72
73
  def initialize(text, *extensions)
73
74
  @text = text
data/redcarpet.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'redcarpet'
3
- s.version = '1.5.0'
3
+ s.version = '1.5.1'
4
4
  s.summary = "Ruby bindings for libupskirt"
5
5
  s.date = '2011-04-11'
6
6
  s.email = 'vicent@github.com'
@@ -155,22 +155,25 @@ class RedcarpetTest < Test::Unit::TestCase
155
155
  header
156
156
  end
157
157
 
158
- def test_that_no_tables_flag_works
159
- rd = Redcarpet.new(<<EOS, :no_tables)
158
+ def test_that_tables_flag_works
159
+ text = <<EOS
160
160
  aaa | bbbb
161
161
  -----|------
162
162
  hello|sailor
163
163
  EOS
164
- assert rd.to_html !~ /<table/
164
+
165
+ assert Redcarpet.new(text).to_html !~ /<table/
166
+ assert Redcarpet.new(text, :tables).to_html ~ /<table/
165
167
  end
166
168
 
167
- def test_strikethrough
168
- rd = Redcarpet.new("this is ~some~ striked ~~text~~", :no_strikethrough)
169
- assert rd.to_html !~ /text-decoration:line-through;/
169
+ def test_strikethrough_flag_works
170
+ text = "this is ~some~ striked ~~text~~"
171
+ assert Redcarpet.new(text).to_html !~ /text-decoration:line-through;/
172
+ assert Redcarpet.new(text, :strikethrough).to_html ~ /text-decoration:line-through;/
170
173
  end
171
174
 
172
- def test_that_no_fenced_flag_works
173
- rd = Redcarpet.new(<<fenced, :no_fencedcode)
175
+ def test_that_fenced_flag_works
176
+ text = <<fenced
174
177
  This is a simple test
175
178
 
176
179
  ~~~~~
@@ -178,7 +181,9 @@ This is some awesome code
178
181
  with tabs and shit
179
182
  ~~~
180
183
  fenced
181
- assert rd.to_html !~ /<code/
184
+
185
+ assert Redcarpet.new(text).to_html !~ /<code/
186
+ assert Redcarpet.new(text, :fenced_code).to_html ~ /<code/
182
187
  end
183
188
 
184
189
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redcarpet
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 5
9
- - 0
10
- version: 1.5.0
9
+ - 1
10
+ version: 1.5.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Natacha Port\xC3\xA9"