RedCloth 4.0.4-x86-mswin32-60 → 4.1.0-x86-mswin32-60
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of RedCloth might be problematic. Click here for more details.
- data/CHANGELOG +18 -5
- data/Manifest +57 -0
- data/Rakefile +141 -173
- data/RedCloth.gemspec +37 -0
- data/{extras → ext}/mingw-rbconfig.rb +0 -0
- data/ext/redcloth_scan/redcloth.h +27 -20
- data/ext/redcloth_scan/redcloth_attributes.c.rl +56 -0
- data/ext/redcloth_scan/redcloth_attributes.java.rl +96 -0
- data/ext/redcloth_scan/redcloth_attributes.rl +6 -51
- data/ext/redcloth_scan/redcloth_common.c.rl +18 -0
- data/ext/redcloth_scan/redcloth_common.java.rl +18 -0
- data/ext/redcloth_scan/redcloth_common.rl +17 -27
- data/ext/redcloth_scan/redcloth_inline.c.rl +159 -0
- data/ext/redcloth_scan/redcloth_inline.java.rl +108 -0
- data/ext/redcloth_scan/redcloth_inline.rl +49 -198
- data/ext/redcloth_scan/redcloth_scan.c.rl +230 -0
- data/ext/redcloth_scan/redcloth_scan.java.rl +555 -0
- data/ext/redcloth_scan/redcloth_scan.rl +66 -282
- data/lib/redcloth.rb +6 -0
- data/lib/redcloth/erb_extension.rb +27 -0
- data/lib/redcloth/version.rb +2 -2
- data/lib/redcloth_scan.so +0 -0
- data/setup.rb +1585 -0
- data/test/basic.yml +3 -4
- data/test/code.yml +28 -2
- data/test/test_erb.rb +13 -0
- metadata +76 -43
- data/ext/redcloth_scan/redcloth_attributes.c +0 -650
- data/ext/redcloth_scan/redcloth_inline.c +0 -10494
- data/ext/redcloth_scan/redcloth_scan.c +0 -11254
- data/lib/redcloth_scan.bundle +0 -0
data/RedCloth.gemspec
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = %q{RedCloth}
|
3
|
+
s.version = "4.1.0"
|
4
|
+
s.platform = %q{x86-mswin32-60}
|
5
|
+
|
6
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
7
|
+
s.authors = ["Jason Garber"]
|
8
|
+
s.date = %q{2008-11-10}
|
9
|
+
s.default_executable = %q{redcloth}
|
10
|
+
s.description = %q{RedCloth-4.1.0 - Textile parser for Ruby. http://redcloth.org/}
|
11
|
+
s.email = %q{redcloth-upwards@rubyforge.org}
|
12
|
+
s.executables = ["redcloth"]
|
13
|
+
s.extra_rdoc_files = ["CHANGELOG", "lib/case_sensitive_require/RedCloth.rb", "lib/redcloth/erb_extension.rb", "lib/redcloth/formatters/base.rb", "lib/redcloth/formatters/html.rb", "lib/redcloth/formatters/latex.rb", "lib/redcloth/textile_doc.rb", "lib/redcloth/version.rb", "lib/redcloth.rb", "README"]
|
14
|
+
s.files = ["bin/redcloth", "CHANGELOG", "COPYING", "ext/mingw-rbconfig.rb", "ext/redcloth_scan/extconf.rb", "ext/redcloth_scan/redcloth.h", "ext/redcloth_scan/redcloth_attributes.c.rl", "ext/redcloth_scan/redcloth_attributes.java.rl", "ext/redcloth_scan/redcloth_attributes.rl", "ext/redcloth_scan/redcloth_common.c.rl", "ext/redcloth_scan/redcloth_common.java.rl", "ext/redcloth_scan/redcloth_common.rl", "ext/redcloth_scan/redcloth_inline.c.rl", "ext/redcloth_scan/redcloth_inline.java.rl", "ext/redcloth_scan/redcloth_inline.rl", "ext/redcloth_scan/redcloth_scan.c.rl", "ext/redcloth_scan/redcloth_scan.java.rl", "ext/redcloth_scan/redcloth_scan.rl", "extras/ragel_profiler.rb", "lib/case_sensitive_require/RedCloth.rb", "lib/redcloth/erb_extension.rb", "lib/redcloth/formatters/base.rb", "lib/redcloth/formatters/html.rb", "lib/redcloth/formatters/latex.rb", "lib/redcloth/formatters/latex_entities.yml", "lib/redcloth/textile_doc.rb", "lib/redcloth/version.rb", "lib/redcloth.rb", "Manifest", "Rakefile", "README", "RedCloth.gemspec", "setup.rb", "test/basic.yml", "test/code.yml", "test/definitions.yml", "test/extra_whitespace.yml", "test/filter_html.yml", "test/filter_pba.yml", "test/helper.rb", "test/html.yml", "test/images.yml", "test/instiki.yml", "test/links.yml", "test/lists.yml", "test/poignant.yml", "test/sanitize_html.yml", "test/table.yml", "test/test_custom_tags.rb", "test/test_erb.rb", "test/test_extensions.rb", "test/test_formatters.rb", "test/test_parser.rb", "test/test_restrictions.rb", "test/textism.yml", "test/threshold.yml", "test/validate_fixtures.rb", "lib/redcloth_scan.so"]
|
15
|
+
s.has_rdoc = true
|
16
|
+
s.homepage = %q{http://redcloth.org}
|
17
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "RedCloth", "--main", "README"]
|
18
|
+
s.require_paths = ["lib", "ext"]
|
19
|
+
s.required_ruby_version = Gem::Requirement.new(">= 1.8.4")
|
20
|
+
s.rubyforge_project = %q{redcloth}
|
21
|
+
s.rubygems_version = %q{1.2.0}
|
22
|
+
s.summary = %q{RedCloth-4.1.0 - Textile parser for Ruby. http://redcloth.org/}
|
23
|
+
s.test_files = ["test/test_custom_tags.rb", "test/test_erb.rb", "test/test_extensions.rb", "test/test_formatters.rb", "test/test_parser.rb", "test/test_restrictions.rb"]
|
24
|
+
|
25
|
+
if s.respond_to? :specification_version then
|
26
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
27
|
+
s.specification_version = 2
|
28
|
+
|
29
|
+
if current_version >= 3 then
|
30
|
+
s.add_development_dependency(%q<echoe>, [">= 0"])
|
31
|
+
else
|
32
|
+
s.add_dependency(%q<echoe>, [">= 0"])
|
33
|
+
end
|
34
|
+
else
|
35
|
+
s.add_dependency(%q<echoe>, [">= 0"])
|
36
|
+
end
|
37
|
+
end
|
File without changes
|
@@ -33,14 +33,17 @@ VALUE red_pass_code(VALUE, VALUE, VALUE, ID);
|
|
33
33
|
|
34
34
|
/* parser macros */
|
35
35
|
#define CLEAR_REGS() regs = rb_hash_new();
|
36
|
+
#define RESET_REG() reg = NULL
|
36
37
|
#define CAT(H) rb_str_cat(H, ts, te-ts)
|
37
38
|
#define CLEAR(H) H = rb_str_new2("")
|
38
|
-
#define
|
39
|
+
#define SET_PLAIN_BLOCK(T) plain_block = rb_str_new2(T)
|
40
|
+
#define RESET_TYPE(T) rb_hash_aset(regs, ID2SYM(rb_intern("type")), plain_block)
|
41
|
+
#define INLINE(H, T) rb_str_append(H, rb_funcall(self, rb_intern(T), 1, regs))
|
39
42
|
#define DONE(H) rb_str_append(html, H); CLEAR(H); CLEAR_REGS()
|
40
|
-
#define PASS(H, A, T) rb_str_append(H, red_pass(self, regs, ID2SYM(rb_intern(
|
41
|
-
#define PARSE_ATTR(A) red_parse_attr(self, regs, ID2SYM(rb_intern(
|
42
|
-
#define PARSE_LINK_ATTR(A) red_parse_link_attr(self, regs, ID2SYM(rb_intern(
|
43
|
-
#define PASS_CODE(H, A, T, O) rb_str_append(H, red_pass_code(self, regs, ID2SYM(rb_intern(
|
43
|
+
#define PASS(H, A, T) rb_str_append(H, red_pass(self, regs, ID2SYM(rb_intern(A)), rb_intern(T), refs))
|
44
|
+
#define PARSE_ATTR(A) red_parse_attr(self, regs, ID2SYM(rb_intern(A)))
|
45
|
+
#define PARSE_LINK_ATTR(A) red_parse_link_attr(self, regs, ID2SYM(rb_intern(A)))
|
46
|
+
#define PASS_CODE(H, A, T, O) rb_str_append(H, red_pass_code(self, regs, ID2SYM(rb_intern(A)), rb_intern(T)))
|
44
47
|
#define ADD_BLOCK() \
|
45
48
|
rb_str_append(html, red_block(self, regs, block, refs)); \
|
46
49
|
extend = Qnil; \
|
@@ -48,10 +51,11 @@ VALUE red_pass_code(VALUE, VALUE, VALUE, ID);
|
|
48
51
|
CLEAR_REGS()
|
49
52
|
#define ADD_EXTENDED_BLOCK() rb_str_append(html, red_block(self, regs, block, refs)); CLEAR(block);
|
50
53
|
#define END_EXTENDED() extend = Qnil; CLEAR_REGS();
|
54
|
+
#define IS_NOT_EXTENDED() NIL_P(extend)
|
51
55
|
#define ADD_BLOCKCODE() rb_str_append(html, red_blockcode(self, regs, block)); CLEAR(block); CLEAR_REGS()
|
52
56
|
#define ADD_EXTENDED_BLOCKCODE() rb_str_append(html, red_blockcode(self, regs, block)); CLEAR(block);
|
53
|
-
#define ASET(T, V) rb_hash_aset(regs, ID2SYM(rb_intern(
|
54
|
-
#define AINC(T) red_inc(regs, ID2SYM(rb_intern(
|
57
|
+
#define ASET(T, V) rb_hash_aset(regs, ID2SYM(rb_intern(T)), rb_str_new2(V));
|
58
|
+
#define AINC(T) red_inc(regs, ID2SYM(rb_intern(T)));
|
55
59
|
#define SET_ATTRIBUTES() \
|
56
60
|
VALUE buf = Qnil; \
|
57
61
|
SET_ATTRIBUTE("class_buf", "class"); \
|
@@ -64,26 +68,26 @@ VALUE red_pass_code(VALUE, VALUE, VALUE, ID);
|
|
64
68
|
#define TRANSFORM(T) \
|
65
69
|
if (p > reg && reg >= ts) { \
|
66
70
|
VALUE str = redcloth_transform(self, reg, p, refs); \
|
67
|
-
rb_hash_aset(regs, ID2SYM(rb_intern(
|
68
|
-
/* printf("TRANSFORM("
|
71
|
+
rb_hash_aset(regs, ID2SYM(rb_intern(T)), str); \
|
72
|
+
/* printf("TRANSFORM(" T ") '%s' (p:'%d' reg:'%d')\n", RSTRING(str)->ptr, p, reg);*/ \
|
69
73
|
} else { \
|
70
|
-
rb_hash_aset(regs, ID2SYM(rb_intern(
|
74
|
+
rb_hash_aset(regs, ID2SYM(rb_intern(T)), Qnil); \
|
71
75
|
}
|
72
76
|
#define STORE(T) \
|
73
77
|
if (p > reg && reg >= ts) { \
|
74
78
|
VALUE str = rb_str_new(reg, p-reg); \
|
75
|
-
rb_hash_aset(regs, ID2SYM(rb_intern(
|
76
|
-
/* printf("STORE("
|
79
|
+
rb_hash_aset(regs, ID2SYM(rb_intern(T)), str); \
|
80
|
+
/* printf("STORE(" T ") '%s' (p:'%d' reg:'%d')\n", RSTRING(str)->ptr, p, reg);*/ \
|
77
81
|
} else { \
|
78
|
-
rb_hash_aset(regs, ID2SYM(rb_intern(
|
82
|
+
rb_hash_aset(regs, ID2SYM(rb_intern(T)), Qnil); \
|
79
83
|
}
|
80
84
|
#define STORE_B(T) \
|
81
85
|
if (p > bck && bck >= ts) { \
|
82
86
|
VALUE str = rb_str_new(bck, p-bck); \
|
83
|
-
rb_hash_aset(regs, ID2SYM(rb_intern(
|
84
|
-
/* printf("STORE_B("
|
87
|
+
rb_hash_aset(regs, ID2SYM(rb_intern(T)), str); \
|
88
|
+
/* printf("STORE_B(" T ") '%s' (p:'%d' reg:'%d')\n", RSTRING(str)->ptr, p, reg);*/ \
|
85
89
|
} else { \
|
86
|
-
rb_hash_aset(regs, ID2SYM(rb_intern(
|
90
|
+
rb_hash_aset(regs, ID2SYM(rb_intern(T)), Qnil); \
|
87
91
|
}
|
88
92
|
#define STORE_URL(T) \
|
89
93
|
if (p > reg && reg >= ts) { \
|
@@ -100,9 +104,12 @@ VALUE red_pass_code(VALUE, VALUE, VALUE, ID);
|
|
100
104
|
te = p; \
|
101
105
|
} \
|
102
106
|
STORE(T); \
|
103
|
-
if ( !NIL_P(refs) && rb_funcall(refs, rb_intern("has_key?"), 1, rb_hash_aref(regs, ID2SYM(rb_intern(
|
104
|
-
rb_hash_aset(regs, ID2SYM(rb_intern(
|
107
|
+
if ( !NIL_P(refs) && rb_funcall(refs, rb_intern("has_key?"), 1, rb_hash_aref(regs, ID2SYM(rb_intern(T)))) ) { \
|
108
|
+
rb_hash_aset(regs, ID2SYM(rb_intern(T)), rb_hash_aref(refs, rb_hash_aref(regs, ID2SYM(rb_intern(T))))); \
|
105
109
|
}
|
110
|
+
#define STORE_LINK_ALIAS() \
|
111
|
+
rb_hash_aset(refs_found, rb_hash_aref(regs, ID2SYM(rb_intern("text"))), rb_hash_aref(regs, ID2SYM(rb_intern("href"))))
|
112
|
+
#define CLEAR_LIST() list_layout = rb_ary_new()
|
106
113
|
#define LIST_ITEM() \
|
107
114
|
int aint = 0; \
|
108
115
|
VALUE aval = rb_ary_entry(list_index, nest-1); \
|
@@ -136,11 +143,11 @@ VALUE red_pass_code(VALUE, VALUE, VALUE, ID);
|
|
136
143
|
rb_str_append(html, rb_funcall(self, rb_intern(listm), 1, regs)); \
|
137
144
|
rb_ary_store(list_layout, nest-1, rb_str_new2(list_type)); \
|
138
145
|
CLEAR_REGS(); \
|
139
|
-
ASET(first, true); \
|
146
|
+
ASET("first", "true"); \
|
140
147
|
} \
|
141
148
|
LIST_CLOSE(); \
|
142
149
|
rb_hash_aset(regs, ID2SYM(rb_intern("nest")), INT2NUM(RARRAY(list_layout)->len)); \
|
143
|
-
ASET(type, li_open)
|
150
|
+
ASET("type", "li_open")
|
144
151
|
#define LIST_CLOSE() \
|
145
152
|
while (nest < RARRAY(list_layout)->len) \
|
146
153
|
{ \
|
@@ -0,0 +1,56 @@
|
|
1
|
+
/*
|
2
|
+
* redcloth_attributes.c.rl
|
3
|
+
*
|
4
|
+
* Copyright (C) 2008 Jason Garber
|
5
|
+
*/
|
6
|
+
#include <ruby.h>
|
7
|
+
#include "redcloth.h"
|
8
|
+
|
9
|
+
%%{
|
10
|
+
|
11
|
+
machine redcloth_attributes;
|
12
|
+
include redcloth_common "redcloth_common.c.rl";
|
13
|
+
include redcloth_attributes "redcloth_attributes.rl";
|
14
|
+
|
15
|
+
}%%
|
16
|
+
|
17
|
+
%% write data nofinal;
|
18
|
+
|
19
|
+
|
20
|
+
VALUE
|
21
|
+
redcloth_attribute_parser(machine, self, p, pe)
|
22
|
+
int machine;
|
23
|
+
VALUE self;
|
24
|
+
char *p, *pe;
|
25
|
+
{
|
26
|
+
int cs, act;
|
27
|
+
char *ts, *te, *reg, *bck, *eof;
|
28
|
+
VALUE regs = rb_hash_new();
|
29
|
+
VALUE buf = Qnil;
|
30
|
+
|
31
|
+
%% write init;
|
32
|
+
|
33
|
+
cs = machine;
|
34
|
+
|
35
|
+
%% write exec;
|
36
|
+
|
37
|
+
return regs;
|
38
|
+
}
|
39
|
+
|
40
|
+
VALUE
|
41
|
+
redcloth_attributes(self, str)
|
42
|
+
VALUE self, str;
|
43
|
+
{
|
44
|
+
StringValue(str);
|
45
|
+
int cs = redcloth_attributes_en_inline;
|
46
|
+
return redcloth_attribute_parser(cs, self, RSTRING_PTR(str), RSTRING_PTR(str) + RSTRING_LEN(str) + 1);
|
47
|
+
}
|
48
|
+
|
49
|
+
VALUE
|
50
|
+
redcloth_link_attributes(self, str)
|
51
|
+
VALUE self, str;
|
52
|
+
{
|
53
|
+
StringValue(str);
|
54
|
+
int cs = redcloth_attributes_en_link_says;
|
55
|
+
return redcloth_attribute_parser(cs, self, RSTRING_PTR(str), RSTRING_PTR(str) + RSTRING_LEN(str) + 1);
|
56
|
+
}
|
@@ -0,0 +1,96 @@
|
|
1
|
+
/*
|
2
|
+
* redcloth_attributes.rl
|
3
|
+
*
|
4
|
+
* Copyright (C) 2008 Jason Garber
|
5
|
+
*/
|
6
|
+
import java.io.IOException;
|
7
|
+
|
8
|
+
import org.jruby.Ruby;
|
9
|
+
import org.jruby.RubyArray;
|
10
|
+
import org.jruby.RubyClass;
|
11
|
+
import org.jruby.RubyHash;
|
12
|
+
import org.jruby.RubyModule;
|
13
|
+
import org.jruby.RubyNumeric;
|
14
|
+
import org.jruby.RubyObject;
|
15
|
+
import org.jruby.RubyString;
|
16
|
+
import org.jruby.RubySymbol;
|
17
|
+
import org.jruby.anno.JRubyMethod;
|
18
|
+
import org.jruby.runtime.Block;
|
19
|
+
import org.jruby.runtime.CallbackFactory;
|
20
|
+
import org.jruby.runtime.builtin.IRubyObject;
|
21
|
+
import org.jruby.exceptions.RaiseException;
|
22
|
+
import org.jruby.runtime.load.BasicLibraryService;
|
23
|
+
|
24
|
+
import org.jruby.util.ByteList;
|
25
|
+
|
26
|
+
public class RedclothAttributes extends RedclothScanService.Base {
|
27
|
+
|
28
|
+
%%{
|
29
|
+
|
30
|
+
machine redcloth_attributes;
|
31
|
+
include redcloth_common "redcloth_common.java.rl";
|
32
|
+
include redcloth_attributes "redcloth_attributes.rl";
|
33
|
+
|
34
|
+
}%%
|
35
|
+
|
36
|
+
%% write data nofinal;
|
37
|
+
|
38
|
+
public void SET_ATTRIBUTES() {
|
39
|
+
SET_ATTRIBUTE("class_buf", "class");
|
40
|
+
SET_ATTRIBUTE("id_buf", "id");
|
41
|
+
SET_ATTRIBUTE("lang_buf", "lang");
|
42
|
+
SET_ATTRIBUTE("style_buf", "style");
|
43
|
+
}
|
44
|
+
|
45
|
+
public void SET_ATTRIBUTE(String B, String A) {
|
46
|
+
buf = ((RubyHash)regs).aref(runtime.newSymbol(B));
|
47
|
+
if(!buf.isNil()) {
|
48
|
+
((RubyHash)regs).aset(runtime.newSymbol(A), buf);
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
52
|
+
private int machine;
|
53
|
+
private IRubyObject buf;
|
54
|
+
|
55
|
+
public RedclothAttributes(int machine, IRubyObject self, byte[] data, int p, int pe) {
|
56
|
+
this.runtime = self.getRuntime();
|
57
|
+
this.self = self;
|
58
|
+
|
59
|
+
// This is GROSS but necessary for EOF matching
|
60
|
+
this.data = new byte[pe+1];
|
61
|
+
System.arraycopy(data, p, this.data, 0, pe);
|
62
|
+
this.data[pe] = 0;
|
63
|
+
|
64
|
+
this.p = 0;
|
65
|
+
this.pe = pe+1;
|
66
|
+
this.eof = this.pe;
|
67
|
+
this.orig_p = 0;
|
68
|
+
this.orig_pe = this.pe;
|
69
|
+
|
70
|
+
this.regs = RubyHash.newHash(runtime);
|
71
|
+
this.buf = runtime.getNil();
|
72
|
+
this.machine = machine;
|
73
|
+
}
|
74
|
+
|
75
|
+
public IRubyObject parse() {
|
76
|
+
%% write init;
|
77
|
+
|
78
|
+
cs = machine;
|
79
|
+
|
80
|
+
%% write exec;
|
81
|
+
|
82
|
+
return regs;
|
83
|
+
}
|
84
|
+
|
85
|
+
public static IRubyObject attributes(IRubyObject self, IRubyObject str) {
|
86
|
+
ByteList bl = str.convertToString().getByteList();
|
87
|
+
int cs = redcloth_attributes_en_inline;
|
88
|
+
return new RedclothAttributes(cs, self, bl.bytes, bl.begin, bl.realSize).parse();
|
89
|
+
}
|
90
|
+
|
91
|
+
public static IRubyObject link_attributes(IRubyObject self, IRubyObject str) {
|
92
|
+
ByteList bl = str.convertToString().getByteList();
|
93
|
+
int cs = redcloth_attributes_en_link_says;
|
94
|
+
return new RedclothAttributes(cs, self, bl.bytes, bl.begin, bl.realSize).parse();
|
95
|
+
}
|
96
|
+
}
|
@@ -3,17 +3,13 @@
|
|
3
3
|
*
|
4
4
|
* Copyright (C) 2008 Jason Garber
|
5
5
|
*/
|
6
|
-
#include <ruby.h>
|
7
|
-
#include "redcloth.h"
|
8
|
-
|
9
6
|
%%{
|
10
7
|
|
11
8
|
machine redcloth_attributes;
|
12
|
-
include redcloth_common "redcloth_common.rl";
|
13
9
|
|
14
|
-
C2_CLAS = ( "(" ( [^)#]+ >A %{ STORE(class_buf) } )? ("#" [^)]+ >A %{STORE(id_buf)} )? ")" ) ;
|
15
|
-
C2_LNGE = ( "[" [^\]]+ >A %{ STORE(lang_buf) } "]" ) ;
|
16
|
-
C2_STYL = ( "{" [^}]+ >A %{ STORE(style_buf) } "}" ) ;
|
10
|
+
C2_CLAS = ( "(" ( [^)#]+ >A %{ STORE("class_buf"); } )? ("#" [^)]+ >A %{STORE("id_buf");} )? ")" ) ;
|
11
|
+
C2_LNGE = ( "[" [^\]]+ >A %{ STORE("lang_buf"); } "]" ) ;
|
12
|
+
C2_STYL = ( "{" [^}]+ >A %{ STORE("style_buf"); } "}" ) ;
|
17
13
|
C2 = ( C2_CLAS | C2_STYL | C2_LNGE )+ ;
|
18
14
|
|
19
15
|
mtext_with_attributes = ( C2 mtext >A %T ) >X ;
|
@@ -24,8 +20,8 @@
|
|
24
20
|
|
25
21
|
*|;
|
26
22
|
|
27
|
-
link_text_with_attributes = C2 "."* " "* ( mtext+ ) >A %{ STORE(name) } ;
|
28
|
-
link_text_without_attributes = ( mtext+ ) >B %{ STORE_B(name_without_attributes) } ;
|
23
|
+
link_text_with_attributes = C2 "."* " "* ( mtext+ ) >A %{ STORE("name"); } ;
|
24
|
+
link_text_without_attributes = ( mtext+ ) >B %{ STORE_B("name_without_attributes"); } ;
|
29
25
|
|
30
26
|
link_says := |*
|
31
27
|
|
@@ -34,45 +30,4 @@
|
|
34
30
|
|
35
31
|
*|;
|
36
32
|
|
37
|
-
}
|
38
|
-
|
39
|
-
%% write data nofinal;
|
40
|
-
|
41
|
-
|
42
|
-
VALUE
|
43
|
-
redcloth_attribute_parser(machine, self, p, pe)
|
44
|
-
int machine;
|
45
|
-
VALUE self;
|
46
|
-
char *p, *pe;
|
47
|
-
{
|
48
|
-
int cs, act;
|
49
|
-
char *ts, *te, *reg, *bck, *eof;
|
50
|
-
VALUE regs = rb_hash_new();
|
51
|
-
VALUE buf = Qnil;
|
52
|
-
|
53
|
-
%% write init;
|
54
|
-
|
55
|
-
cs = machine;
|
56
|
-
|
57
|
-
%% write exec;
|
58
|
-
|
59
|
-
return regs;
|
60
|
-
}
|
61
|
-
|
62
|
-
VALUE
|
63
|
-
redcloth_attributes(self, str)
|
64
|
-
VALUE self, str;
|
65
|
-
{
|
66
|
-
StringValue(str);
|
67
|
-
int cs = redcloth_attributes_en_inline;
|
68
|
-
return redcloth_attribute_parser(cs, self, RSTRING_PTR(str), RSTRING_PTR(str) + RSTRING_LEN(str) + 1);
|
69
|
-
}
|
70
|
-
|
71
|
-
VALUE
|
72
|
-
redcloth_link_attributes(self, str)
|
73
|
-
VALUE self, str;
|
74
|
-
{
|
75
|
-
StringValue(str);
|
76
|
-
int cs = redcloth_attributes_en_link_says;
|
77
|
-
return redcloth_attribute_parser(cs, self, RSTRING_PTR(str), RSTRING_PTR(str) + RSTRING_LEN(str) + 1);
|
78
|
-
}
|
33
|
+
}%%;
|
@@ -0,0 +1,18 @@
|
|
1
|
+
%%{
|
2
|
+
|
3
|
+
machine redcloth_common;
|
4
|
+
include redcloth_common "redcloth_common.rl";
|
5
|
+
|
6
|
+
action esc { rb_str_cat_escaped(self, block, ts, te); }
|
7
|
+
action esc_pre { rb_str_cat_escaped_for_preformatted(self, block, ts, te); }
|
8
|
+
action ignore { rb_str_append(block, rb_funcall(self, rb_intern("ignore"), 1, regs)); }
|
9
|
+
|
10
|
+
# conditionals
|
11
|
+
action starts_line {
|
12
|
+
p == orig_p || *(p-1) == '\r' || *(p-1) == '\n' || *(p-1) == '\f'
|
13
|
+
}
|
14
|
+
action starts_phrase {
|
15
|
+
p == orig_p || *(p-1) == '\r' || *(p-1) == '\n' || *(p-1) == '\f' || *(p-1) == ' '
|
16
|
+
}
|
17
|
+
|
18
|
+
}%%;
|
@@ -0,0 +1,18 @@
|
|
1
|
+
%%{
|
2
|
+
|
3
|
+
machine redcloth_common;
|
4
|
+
include redcloth_common "redcloth_common.rl";
|
5
|
+
|
6
|
+
action esc { strCatEscaped(self, block, data, ts, te); }
|
7
|
+
action esc_pre { strCatEscapedForPreformatted(self, block, data, ts, te); }
|
8
|
+
action ignore { ((RubyString)block).append(self.callMethod(runtime.getCurrentContext(), "ignore", regs)); }
|
9
|
+
|
10
|
+
# conditionals
|
11
|
+
action starts_line {
|
12
|
+
p == orig_p || data[(p-1)] == '\r' || data[(p-1)] == '\n' || data[(p-1)] == '\f'
|
13
|
+
}
|
14
|
+
action starts_phrase {
|
15
|
+
p == orig_p || data[(p-1)] == '\r' || data[(p-1)] == '\n' || data[(p-1)] == '\f' || data[(p-1)] == ' '
|
16
|
+
}
|
17
|
+
|
18
|
+
}%%;
|
@@ -4,12 +4,9 @@
|
|
4
4
|
|
5
5
|
action A { reg = p; }
|
6
6
|
action B { bck = p; }
|
7
|
-
action T { STORE(text); }
|
8
|
-
action X { CLEAR_REGS();
|
7
|
+
action T { STORE("text"); }
|
8
|
+
action X { CLEAR_REGS(); RESET_REG(); }
|
9
9
|
action cat { CAT(block); }
|
10
|
-
action esc { rb_str_cat_escaped(self, block, ts, te); }
|
11
|
-
action esc_pre { rb_str_cat_escaped_for_preformatted(self, block, ts, te); }
|
12
|
-
action ignore { rb_str_append(block, rb_funcall(self, rb_intern("ignore"), 1, regs)); }
|
13
10
|
|
14
11
|
# simple
|
15
12
|
LF = ( '\n' ) ;
|
@@ -17,28 +14,28 @@
|
|
17
14
|
EOF = 0 ;
|
18
15
|
|
19
16
|
# textile modifiers
|
20
|
-
A_LEFT = "<" %{ ASET(align, left) } ;
|
21
|
-
A_RIGHT = ">" %{ ASET(align, right) } ;
|
22
|
-
A_JUSTIFIED = "<>" %{ ASET(align, justify) } ;
|
23
|
-
A_CENTER = "=" %{ ASET(align, center) } ;
|
24
|
-
A_PADLEFT = "(" >A %{ AINC(padding-left) } ;
|
25
|
-
A_PADRIGHT = ")" >A %{ AINC(padding-right) } ;
|
17
|
+
A_LEFT = "<" %{ ASET("align", "left"); } ;
|
18
|
+
A_RIGHT = ">" %{ ASET("align", "right"); } ;
|
19
|
+
A_JUSTIFIED = "<>" %{ ASET("align", "justify"); } ;
|
20
|
+
A_CENTER = "=" %{ ASET("align", "center"); } ;
|
21
|
+
A_PADLEFT = "(" >A %{ AINC("padding-left"); } ;
|
22
|
+
A_PADRIGHT = ")" >A %{ AINC("padding-right"); } ;
|
26
23
|
A_HLGN = ( A_LEFT | A_RIGHT | A_JUSTIFIED | A_CENTER | A_PADLEFT | A_PADRIGHT ) ;
|
27
24
|
A_LIMIT = ( A_LEFT | A_CENTER | A_RIGHT ) ;
|
28
|
-
A_VLGN = ( "-" %{ ASET(vertical-align, middle) } | "^" %{ ASET(vertical-align, top) } | "~" %{ ASET(vertical-align, bottom) } ) ;
|
29
|
-
C_CLAS = ( "(" ( [^)#]+ >A %{ STORE(class) } )? ("#" [^)]+ >A %{STORE(id)} )? ")" ) ;
|
30
|
-
C_LNGE = ( "[" [^\]]+ >A %{ STORE(lang) } "]" ) ;
|
31
|
-
C_STYL = ( "{" [^}]+ >A %{ STORE(style) } "}" ) ;
|
32
|
-
S_CSPN = ( "\\" [0-9]+ >A %{ STORE(colspan) } ) ;
|
33
|
-
S_RSPN = ( "/" [0-9]+ >A %{ STORE(rowspan) } ) ;
|
34
|
-
D_HEADER = "_" %{ ASET(th, true) } ;
|
25
|
+
A_VLGN = ( "-" %{ ASET("vertical-align", "middle"); } | "^" %{ ASET("vertical-align", "top"); } | "~" %{ ASET("vertical-align", "bottom"); } ) ;
|
26
|
+
C_CLAS = ( "(" ( [^)#]+ >A %{ STORE("class"); } )? ("#" [^)]+ >A %{STORE("id");} )? ")" ) ;
|
27
|
+
C_LNGE = ( "[" [^\]]+ >A %{ STORE("lang"); } "]" ) ;
|
28
|
+
C_STYL = ( "{" [^}]+ >A %{ STORE("style"); } "}" ) ;
|
29
|
+
S_CSPN = ( "\\" [0-9]+ >A %{ STORE("colspan"); } ) ;
|
30
|
+
S_RSPN = ( "/" [0-9]+ >A %{ STORE("rowspan"); } ) ;
|
31
|
+
D_HEADER = "_" %{ ASET("th", "true"); } ;
|
35
32
|
A = ( ( A_HLGN | A_VLGN )* ) ;
|
36
33
|
A2 = ( A_LIMIT? ) ;
|
37
34
|
S = ( S_CSPN | S_RSPN )* ;
|
38
35
|
C = ( C_CLAS | C_STYL | C_LNGE )* ;
|
39
36
|
D = ( D_HEADER ) ;
|
40
37
|
N_CONT = "_" %{ list_continue = 1; };
|
41
|
-
N_NUM = digit+ >A %{ STORE(start) };
|
38
|
+
N_NUM = digit+ >A %{ STORE("start"); };
|
42
39
|
N = ( N_CONT | N_NUM )? ;
|
43
40
|
PUNCT = ( "!" | '"' | "#" | "$" | "%" | "&" | "'" | "," | "-" | "." | "/" | ":" | ";" | "=" | "?" | "\\" | "^" | "`" | "|" | "~" | "[" | "]" | "(" | ")" | "<" ) ;
|
44
41
|
dotspace = ("." " "*) ;
|
@@ -105,17 +102,10 @@
|
|
105
102
|
uri = (target | absolute_uri | absolute_path | rel_path) ;
|
106
103
|
|
107
104
|
# common
|
108
|
-
title = ( '(' default+ >A %{ STORE(title) } :> ')' ) ;
|
105
|
+
title = ( '(' default+ >A %{ STORE("title"); } :> ')' ) ;
|
109
106
|
word = ( alnum | safe | " " ) ;
|
110
107
|
mspace = ( ( " " | "\t" | LF )+ ) -- LF{2} ;
|
111
108
|
mtext = ( chars (mspace chars)* ) ;
|
112
109
|
|
113
|
-
# conditionals
|
114
|
-
action starts_line {
|
115
|
-
p == orig_p || *(p-1) == '\r' || *(p-1) == '\n' || *(p-1) == '\f'
|
116
|
-
}
|
117
|
-
action starts_phrase {
|
118
|
-
p == orig_p || *(p-1) == '\r' || *(p-1) == '\n' || *(p-1) == '\f' || *(p-1) == ' '
|
119
|
-
}
|
120
110
|
|
121
111
|
}%%;
|