rtomayko-rdiscount 1.3.1.1 → 1.3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ext/extconf.rb +0 -6
- data/ext/rdiscount.c +16 -7
- data/lib/rdiscount.rb +1 -1
- data/rdiscount.gemspec +2 -2
- metadata +2 -2
data/ext/extconf.rb
CHANGED
|
@@ -4,11 +4,5 @@ dir_config('rdiscount')
|
|
|
4
4
|
|
|
5
5
|
HAVE_RANDOM = have_func('random')
|
|
6
6
|
HAVE_SRANDOM = have_func('srandom')
|
|
7
|
-
HAVE_FUNOPEN = have_func('funopen')
|
|
8
|
-
HAVE_FOPENCOOKIE = have_func('fopencookie')
|
|
9
|
-
|
|
10
|
-
unless HAVE_FUNOPEN || HAVE_FOPENCOOKIE
|
|
11
|
-
fail "No funopen or fopencookie support available."
|
|
12
|
-
end
|
|
13
7
|
|
|
14
8
|
create_makefile('rdiscount')
|
data/ext/rdiscount.c
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
#include <stdio.h>
|
|
2
2
|
#include "ruby.h"
|
|
3
3
|
#include "mkdio.h"
|
|
4
|
-
#include "rbstrio.h"
|
|
5
4
|
|
|
6
5
|
static VALUE rb_cRDiscount;
|
|
7
6
|
|
|
@@ -9,23 +8,30 @@ static VALUE
|
|
|
9
8
|
rb_rdiscount_to_html(int argc, VALUE *argv, VALUE self)
|
|
10
9
|
{
|
|
11
10
|
/* grab char pointer to markdown input text */
|
|
11
|
+
char *res;
|
|
12
|
+
int szres;
|
|
12
13
|
VALUE text = rb_funcall(self, rb_intern("text"), 0);
|
|
14
|
+
VALUE buf = rb_str_buf_new(1024);
|
|
13
15
|
Check_Type(text, T_STRING);
|
|
14
16
|
|
|
15
|
-
/* allocate a ruby string buffer and wrap it in a stream */
|
|
16
|
-
VALUE buf = rb_str_buf_new(4096);
|
|
17
|
-
FILE *stream = rb_str_io_new(buf);
|
|
18
|
-
|
|
19
17
|
int flags = rb_rdiscount__get_flags(self);
|
|
20
18
|
|
|
21
19
|
MMIOT *doc = mkd_string(RSTRING_PTR(text), RSTRING_LEN(text), flags);
|
|
22
|
-
markdown(doc, stream, flags);
|
|
23
20
|
|
|
24
|
-
|
|
21
|
+
if ( mkd_compile(doc, flags) ) {
|
|
22
|
+
szres = mkd_document(doc, &res);
|
|
23
|
+
|
|
24
|
+
if ( szres != EOF ) {
|
|
25
|
+
rb_str_cat(buf, res, szres);
|
|
26
|
+
rb_str_cat(buf, "\n", 1);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
mkd_cleanup(doc);
|
|
25
30
|
|
|
26
31
|
return buf;
|
|
27
32
|
}
|
|
28
33
|
|
|
34
|
+
#if 0
|
|
29
35
|
static VALUE
|
|
30
36
|
rb_rdiscount_toc_content(int argc, VALUE *argv, VALUE self)
|
|
31
37
|
{
|
|
@@ -47,6 +53,7 @@ rb_rdiscount_toc_content(int argc, VALUE *argv, VALUE self)
|
|
|
47
53
|
|
|
48
54
|
return buf;
|
|
49
55
|
}
|
|
56
|
+
#endif
|
|
50
57
|
|
|
51
58
|
int rb_rdiscount__get_flags(VALUE ruby_obj)
|
|
52
59
|
{
|
|
@@ -73,7 +80,9 @@ void Init_rdiscount()
|
|
|
73
80
|
{
|
|
74
81
|
rb_cRDiscount = rb_define_class("RDiscount", rb_cObject);
|
|
75
82
|
rb_define_method(rb_cRDiscount, "to_html", rb_rdiscount_to_html, -1);
|
|
83
|
+
#if 0
|
|
76
84
|
rb_define_method(rb_cRDiscount, "toc_content", rb_rdiscount_toc_content, -1);
|
|
85
|
+
#endif
|
|
77
86
|
}
|
|
78
87
|
|
|
79
88
|
/* vim: set ts=4 sw=4: */
|
data/lib/rdiscount.rb
CHANGED
data/rdiscount.gemspec
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Gem::Specification.new do |s|
|
|
2
2
|
s.name = 'rdiscount'
|
|
3
|
-
s.version = '1.3.1.
|
|
3
|
+
s.version = '1.3.1.2'
|
|
4
4
|
s.summary = "Fast Implementation of Gruber's Markdown in C"
|
|
5
|
-
s.date = '2009-
|
|
5
|
+
s.date = '2009-02-27'
|
|
6
6
|
s.email = 'r@tomayko.com'
|
|
7
7
|
s.homepage = 'http://github.com/rtomayko/rdiscount'
|
|
8
8
|
s.has_rdoc = true
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rtomayko-rdiscount
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.3.1.
|
|
4
|
+
version: 1.3.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ryan Tomayko
|
|
@@ -10,7 +10,7 @@ autorequire:
|
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
12
|
|
|
13
|
-
date: 2009-
|
|
13
|
+
date: 2009-02-27 00:00:00 -08:00
|
|
14
14
|
default_executable:
|
|
15
15
|
dependencies: []
|
|
16
16
|
|