redcarpet 1.12.2 → 1.13.0
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/Rakefile +10 -32
- data/ext/{array.c → redcarpet/array.c} +0 -0
- data/ext/{array.h → redcarpet/array.h} +0 -0
- data/ext/{buffer.c → redcarpet/buffer.c} +28 -0
- data/ext/{buffer.h → redcarpet/buffer.h} +8 -28
- data/ext/{extconf.rb → redcarpet/extconf.rb} +0 -0
- data/ext/{xhtml.c → redcarpet/html.c} +46 -187
- data/ext/{xhtml.h → redcarpet/html.h} +20 -15
- data/ext/redcarpet/html_smartypants.c +335 -0
- data/ext/{markdown.c → redcarpet/markdown.c} +66 -20
- data/ext/{markdown.h → redcarpet/markdown.h} +0 -0
- data/ext/{redcarpet.c → redcarpet/redcarpet.c} +28 -21
- data/lib/redcarpet.rb +4 -1
- data/redcarpet.gemspec +14 -13
- data/test/redcarpet_test.rb +1 -1
- metadata +29 -16
File without changes
|
@@ -2,11 +2,11 @@
|
|
2
2
|
#include "ruby.h"
|
3
3
|
|
4
4
|
#include "markdown.h"
|
5
|
-
#include "
|
5
|
+
#include "html.h"
|
6
6
|
|
7
7
|
typedef enum
|
8
8
|
{
|
9
|
-
|
9
|
+
REDCARPET_RENDER_HTML,
|
10
10
|
REDCARPET_RENDER_TOC
|
11
11
|
} RendererType;
|
12
12
|
|
@@ -16,41 +16,40 @@ static void rb_redcarpet__get_flags(VALUE ruby_obj,
|
|
16
16
|
unsigned int *enabled_extensions_p,
|
17
17
|
unsigned int *render_flags_p)
|
18
18
|
{
|
19
|
-
unsigned int render_flags =
|
19
|
+
unsigned int render_flags = HTML_EXPAND_TABS;
|
20
20
|
unsigned int extensions = 0;
|
21
21
|
|
22
|
-
/* smart */
|
23
|
-
if (rb_funcall(ruby_obj, rb_intern("smart"), 0) == Qtrue)
|
24
|
-
render_flags |= XHTML_SMARTYPANTS;
|
25
|
-
|
26
22
|
/* filter_html */
|
27
23
|
if (rb_funcall(ruby_obj, rb_intern("filter_html"), 0) == Qtrue)
|
28
|
-
render_flags |=
|
24
|
+
render_flags |= HTML_SKIP_HTML;
|
29
25
|
|
30
26
|
/* no_image */
|
31
27
|
if (rb_funcall(ruby_obj, rb_intern("no_image"), 0) == Qtrue)
|
32
|
-
render_flags |=
|
28
|
+
render_flags |= HTML_SKIP_IMAGES;
|
33
29
|
|
34
30
|
/* no_links */
|
35
31
|
if (rb_funcall(ruby_obj, rb_intern("no_links"), 0) == Qtrue)
|
36
|
-
render_flags |=
|
32
|
+
render_flags |= HTML_SKIP_LINKS;
|
37
33
|
|
38
34
|
/* filter_style */
|
39
35
|
if (rb_funcall(ruby_obj, rb_intern("filter_styles"), 0) == Qtrue)
|
40
|
-
render_flags |=
|
36
|
+
render_flags |= HTML_SKIP_STYLE;
|
41
37
|
|
42
38
|
/* safelink */
|
43
39
|
if (rb_funcall(ruby_obj, rb_intern("safelink"), 0) == Qtrue)
|
44
|
-
render_flags |=
|
40
|
+
render_flags |= HTML_SAFELINK;
|
45
41
|
|
46
42
|
if (rb_funcall(ruby_obj, rb_intern("generate_toc"), 0) == Qtrue)
|
47
|
-
render_flags |=
|
43
|
+
render_flags |= HTML_TOC;
|
48
44
|
|
49
45
|
if (rb_funcall(ruby_obj, rb_intern("hard_wrap"), 0) == Qtrue)
|
50
|
-
render_flags |=
|
46
|
+
render_flags |= HTML_HARD_WRAP;
|
51
47
|
|
52
48
|
if (rb_funcall(ruby_obj, rb_intern("gh_blockcode"), 0) == Qtrue)
|
53
|
-
render_flags |=
|
49
|
+
render_flags |= HTML_GITHUB_BLOCKCODE;
|
50
|
+
|
51
|
+
if (rb_funcall(ruby_obj, rb_intern("xhtml"), 0) == Qtrue)
|
52
|
+
render_flags |= HTML_USE_XHTML;
|
54
53
|
|
55
54
|
/**
|
56
55
|
* Markdown extensions -- all disabled by default
|
@@ -98,12 +97,12 @@ static VALUE rb_redcarpet__render(VALUE self, RendererType render_type)
|
|
98
97
|
rb_redcarpet__get_flags(self, &enabled_extensions, &render_flags);
|
99
98
|
|
100
99
|
switch (render_type) {
|
101
|
-
case
|
102
|
-
|
100
|
+
case REDCARPET_RENDER_HTML:
|
101
|
+
upshtml_renderer(&renderer, render_flags);
|
103
102
|
break;
|
104
103
|
|
105
104
|
case REDCARPET_RENDER_TOC:
|
106
|
-
|
105
|
+
upshtml_toc_renderer(&renderer);
|
107
106
|
break;
|
108
107
|
|
109
108
|
default:
|
@@ -112,9 +111,17 @@ static VALUE rb_redcarpet__render(VALUE self, RendererType render_type)
|
|
112
111
|
|
113
112
|
ups_markdown(output_buf, &input_buf, &renderer, enabled_extensions);
|
114
113
|
|
115
|
-
|
114
|
+
if (rb_funcall(self, rb_intern("smart"), 0) == Qtrue) {
|
115
|
+
struct buf *smart_buf = bufnew(128);
|
116
|
+
upshtml_smartypants(smart_buf, output_buf);
|
117
|
+
result = rb_str_new(smart_buf->data, smart_buf->size);
|
118
|
+
bufrelease(smart_buf);
|
119
|
+
} else {
|
120
|
+
result = rb_str_new(output_buf->data, output_buf->size);
|
121
|
+
}
|
122
|
+
|
116
123
|
bufrelease(output_buf);
|
117
|
-
|
124
|
+
upshtml_free_renderer(&renderer);
|
118
125
|
|
119
126
|
/* force the input encoding */
|
120
127
|
if (rb_respond_to(text, rb_intern("encoding"))) {
|
@@ -134,7 +141,7 @@ rb_redcarpet_toc(int argc, VALUE *argv, VALUE self)
|
|
134
141
|
static VALUE
|
135
142
|
rb_redcarpet_to_html(int argc, VALUE *argv, VALUE self)
|
136
143
|
{
|
137
|
-
return rb_redcarpet__render(self,
|
144
|
+
return rb_redcarpet__render(self, REDCARPET_RENDER_HTML);
|
138
145
|
}
|
139
146
|
|
140
147
|
void Init_redcarpet()
|
data/lib/redcarpet.rb
CHANGED
@@ -26,7 +26,7 @@
|
|
26
26
|
# end
|
27
27
|
#
|
28
28
|
class Redcarpet
|
29
|
-
VERSION = '1.
|
29
|
+
VERSION = '1.13.0'
|
30
30
|
|
31
31
|
# Original Markdown formatted text.
|
32
32
|
attr_reader :text
|
@@ -76,6 +76,9 @@ class Redcarpet
|
|
76
76
|
# Do not render emphasis_inside_words
|
77
77
|
attr_accessor :no_intraemphasis
|
78
78
|
|
79
|
+
# Generate XHTML 1.0 compilant self-closing tags (e.g. <br/>)
|
80
|
+
attr_accessor :xhtml
|
81
|
+
|
79
82
|
def initialize(text, *extensions)
|
80
83
|
@text = text
|
81
84
|
extensions.each { |e| send("#{e}=", true) }
|
data/redcarpet.gemspec
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'redcarpet'
|
3
|
-
s.version = '1.
|
3
|
+
s.version = '1.13.0'
|
4
4
|
s.summary = "Ruby bindings for libupskirt"
|
5
5
|
s.description = 'A fast and safe Markdown to (X)HTML parser'
|
6
|
-
s.date = '2011-05-
|
6
|
+
s.date = '2011-05-06'
|
7
7
|
s.email = 'vicent@github.com'
|
8
8
|
s.homepage = 'http://github.com/tanoku/redcarpet'
|
9
9
|
s.has_rdoc = true
|
@@ -14,16 +14,17 @@ Gem::Specification.new do |s|
|
|
14
14
|
README.markdown
|
15
15
|
Rakefile
|
16
16
|
bin/redcarpet
|
17
|
-
ext/array.c
|
18
|
-
ext/array.h
|
19
|
-
ext/buffer.c
|
20
|
-
ext/buffer.h
|
21
|
-
ext/extconf.rb
|
22
|
-
ext/
|
23
|
-
ext/
|
24
|
-
ext/redcarpet.c
|
25
|
-
ext/
|
26
|
-
ext/
|
17
|
+
ext/redcarpet/array.c
|
18
|
+
ext/redcarpet/array.h
|
19
|
+
ext/redcarpet/buffer.c
|
20
|
+
ext/redcarpet/buffer.h
|
21
|
+
ext/redcarpet/extconf.rb
|
22
|
+
ext/redcarpet/html.c
|
23
|
+
ext/redcarpet/html.h
|
24
|
+
ext/redcarpet/html_smartypants.c
|
25
|
+
ext/redcarpet/markdown.c
|
26
|
+
ext/redcarpet/markdown.h
|
27
|
+
ext/redcarpet/redcarpet.c
|
27
28
|
lib/markdown.rb
|
28
29
|
lib/redcarpet.rb
|
29
30
|
redcarpet.gemspec
|
@@ -36,7 +37,7 @@ Gem::Specification.new do |s|
|
|
36
37
|
# = MANIFEST =
|
37
38
|
s.test_files = ["test/markdown_test.rb", "test/redcarpet_test.rb"]
|
38
39
|
s.extra_rdoc_files = ["COPYING"]
|
39
|
-
s.extensions = ["ext/extconf.rb"]
|
40
|
+
s.extensions = ["ext/redcarpet/extconf.rb"]
|
40
41
|
s.executables = ["redcarpet"]
|
41
42
|
s.require_paths = ["lib"]
|
42
43
|
end
|
data/test/redcarpet_test.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redcarpet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 35
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 13
|
9
|
+
- 0
|
10
|
+
version: 1.13.0
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- "Natacha Port\xC3\xA9"
|
@@ -10,7 +16,7 @@ autorequire:
|
|
10
16
|
bindir: bin
|
11
17
|
cert_chain: []
|
12
18
|
|
13
|
-
date: 2011-05-
|
19
|
+
date: 2011-05-06 00:00:00 +03:00
|
14
20
|
default_executable:
|
15
21
|
dependencies: []
|
16
22
|
|
@@ -19,7 +25,7 @@ email: vicent@github.com
|
|
19
25
|
executables:
|
20
26
|
- redcarpet
|
21
27
|
extensions:
|
22
|
-
- ext/extconf.rb
|
28
|
+
- ext/redcarpet/extconf.rb
|
23
29
|
extra_rdoc_files:
|
24
30
|
- COPYING
|
25
31
|
files:
|
@@ -27,16 +33,17 @@ files:
|
|
27
33
|
- README.markdown
|
28
34
|
- Rakefile
|
29
35
|
- bin/redcarpet
|
30
|
-
- ext/array.c
|
31
|
-
- ext/array.h
|
32
|
-
- ext/buffer.c
|
33
|
-
- ext/buffer.h
|
34
|
-
- ext/extconf.rb
|
35
|
-
- ext/
|
36
|
-
- ext/
|
37
|
-
- ext/redcarpet.c
|
38
|
-
- ext/
|
39
|
-
- ext/
|
36
|
+
- ext/redcarpet/array.c
|
37
|
+
- ext/redcarpet/array.h
|
38
|
+
- ext/redcarpet/buffer.c
|
39
|
+
- ext/redcarpet/buffer.h
|
40
|
+
- ext/redcarpet/extconf.rb
|
41
|
+
- ext/redcarpet/html.c
|
42
|
+
- ext/redcarpet/html.h
|
43
|
+
- ext/redcarpet/html_smartypants.c
|
44
|
+
- ext/redcarpet/markdown.c
|
45
|
+
- ext/redcarpet/markdown.h
|
46
|
+
- ext/redcarpet/redcarpet.c
|
40
47
|
- lib/markdown.rb
|
41
48
|
- lib/redcarpet.rb
|
42
49
|
- redcarpet.gemspec
|
@@ -54,21 +61,27 @@ rdoc_options: []
|
|
54
61
|
require_paths:
|
55
62
|
- lib
|
56
63
|
required_ruby_version: !ruby/object:Gem::Requirement
|
64
|
+
none: false
|
57
65
|
requirements:
|
58
66
|
- - ">="
|
59
67
|
- !ruby/object:Gem::Version
|
68
|
+
hash: 3
|
69
|
+
segments:
|
70
|
+
- 0
|
60
71
|
version: "0"
|
61
|
-
version:
|
62
72
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
63
74
|
requirements:
|
64
75
|
- - ">="
|
65
76
|
- !ruby/object:Gem::Version
|
77
|
+
hash: 3
|
78
|
+
segments:
|
79
|
+
- 0
|
66
80
|
version: "0"
|
67
|
-
version:
|
68
81
|
requirements: []
|
69
82
|
|
70
83
|
rubyforge_project:
|
71
|
-
rubygems_version: 1.3.
|
84
|
+
rubygems_version: 1.3.7
|
72
85
|
signing_key:
|
73
86
|
specification_version: 3
|
74
87
|
summary: Ruby bindings for libupskirt
|