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 +8 -10
- data/ext/xhtml.c +1 -1
- data/ext/xhtml.h +1 -1
- data/lib/redcarpet.rb +10 -9
- data/redcarpet.gemspec +1 -1
- data/test/redcarpet_test.rb +14 -9
- metadata +3 -3
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
|
-
|
54
|
-
|
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("
|
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("
|
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 &
|
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
data/lib/redcarpet.rb
CHANGED
@@ -26,7 +26,7 @@
|
|
26
26
|
# end
|
27
27
|
#
|
28
28
|
class Redcarpet
|
29
|
-
VERSION = '1.5.
|
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
|
-
#
|
64
|
-
attr_accessor :
|
61
|
+
# Enable PHP-Markdown tables extension
|
62
|
+
attr_accessor :tables
|
63
|
+
|
64
|
+
# Enable PHP-Markdown ~~strikethrough~~ extension
|
65
|
+
attr_accessor :strikethrough
|
65
66
|
|
66
|
-
#
|
67
|
-
attr_accessor :
|
67
|
+
# Enable PHP-Markdown fenced code extension
|
68
|
+
attr_accessor :fenced_code
|
68
69
|
|
69
|
-
#
|
70
|
-
attr_accessor :
|
70
|
+
# Backwards compatibility
|
71
|
+
attr_accessor :fold_lines
|
71
72
|
|
72
73
|
def initialize(text, *extensions)
|
73
74
|
@text = text
|
data/redcarpet.gemspec
CHANGED
data/test/redcarpet_test.rb
CHANGED
@@ -155,22 +155,25 @@ class RedcarpetTest < Test::Unit::TestCase
|
|
155
155
|
header
|
156
156
|
end
|
157
157
|
|
158
|
-
def
|
159
|
-
|
158
|
+
def test_that_tables_flag_works
|
159
|
+
text = <<EOS
|
160
160
|
aaa | bbbb
|
161
161
|
-----|------
|
162
162
|
hello|sailor
|
163
163
|
EOS
|
164
|
-
|
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
|
168
|
-
|
169
|
-
assert
|
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
|
173
|
-
|
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
|
-
|
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:
|
4
|
+
hash: 1
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 1.5.
|
9
|
+
- 1
|
10
|
+
version: 1.5.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- "Natacha Port\xC3\xA9"
|