RedCloth 4.1.1-universal-java → 4.1.9-universal-java
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 +36 -0
- data/COPYING +1 -1
- data/README +32 -17
- data/Rakefile +1 -0
- data/RedCloth.gemspec +32 -138
- data/ext/redcloth_scan/redcloth.h +53 -22
- data/ext/redcloth_scan/redcloth_attributes.c.rl +2 -3
- data/ext/redcloth_scan/redcloth_attributes.java.rl +5 -6
- data/ext/redcloth_scan/redcloth_attributes.rl +2 -2
- data/ext/redcloth_scan/redcloth_common.rl +5 -1
- data/ext/redcloth_scan/redcloth_inline.c.rl +48 -14
- data/ext/redcloth_scan/redcloth_inline.java.rl +36 -4
- data/ext/redcloth_scan/redcloth_inline.rl +11 -12
- data/ext/redcloth_scan/redcloth_scan.c.rl +12 -14
- data/ext/redcloth_scan/redcloth_scan.java.rl +25 -3
- data/ext/redcloth_scan/redcloth_scan.rl +7 -12
- data/lib/redcloth/formatters/base.rb +26 -20
- data/lib/redcloth/formatters/html.rb +22 -30
- data/lib/redcloth/formatters/latex.rb +45 -17
- data/lib/redcloth/textile_doc.rb +1 -3
- data/lib/redcloth/version.rb +1 -1
- data/lib/redcloth_scan.jar +0 -0
- data/test/basic.yml +16 -2
- data/test/code.yml +6 -7
- data/test/html.yml +15 -1
- data/test/images.yml +23 -0
- data/test/links.yml +27 -1
- data/test/lists.yml +19 -1
- data/test/table.yml +73 -4
- data/test/test_custom_tags.rb +13 -1
- data/test/test_erb.rb +1 -1
- data/test/test_extensions.rb +1 -1
- data/test/test_formatters.rb +1 -1
- data/test/test_parser.rb +1 -1
- data/test/test_restrictions.rb +1 -1
- data/test/textism.yml +1 -1
- data/test/threshold.yml +1 -3
- data/test/validate_fixtures.rb +2 -1
- metadata +7 -16
data/CHANGELOG
CHANGED
@@ -1,3 +1,39 @@
|
|
1
|
+
=== 4.1.9 / February 20, 2009
|
2
|
+
|
3
|
+
* Make compatible with Ruby 1.9.
|
4
|
+
|
5
|
+
* Image URLs and image titles can now contain parentheses. #71
|
6
|
+
|
7
|
+
* Handle caps properly in link titles. #77
|
8
|
+
|
9
|
+
* Remove extra preformatted line breaks after extended block code. #79
|
10
|
+
|
11
|
+
* Fix inline <notextile> being recognized as block <notextile>. #81
|
12
|
+
|
13
|
+
* Allow leading spaces on lists for backward compatibility with RedCloth 3.x. #89
|
14
|
+
|
15
|
+
* Recognize deleted phrases when they start at the beginning of a line. #83
|
16
|
+
|
17
|
+
* Fix escaped <code> tag when it has the class attribute and is in a <pre> tag. #95
|
18
|
+
|
19
|
+
* Fix dimensions and primes for LaTeX. #103
|
20
|
+
|
21
|
+
* Don't allow square brackets inside lang attribute so double square brackets are interpreted like Textile 2 and RedCloth 3. #101
|
22
|
+
|
23
|
+
* Improve LaTeX output for tables. #96
|
24
|
+
|
25
|
+
* Fix bad parsing of bracketed image links (which would hang the interpreter in some cases). #97
|
26
|
+
|
27
|
+
* Handle links containing parentheses. Brackets are no longer required. #82 [Ryan Alyea]
|
28
|
+
|
29
|
+
* Made italics use the correct LaTeX tag: textit rather than emph. #98
|
30
|
+
|
31
|
+
* Fixed custom block signatures calling built-in Ruby String methods. #92
|
32
|
+
|
33
|
+
* Mentioned the three supported platforms and what's necessary to build RedCloth in the README file.
|
34
|
+
|
35
|
+
* Fixed a require problem that caused an error when you would gem check --test RedCloth. #91
|
36
|
+
|
1
37
|
=== 4.1.1 / November 19, 2008
|
2
38
|
|
3
39
|
* Added 'lib/case_sensitive_require' back into gemspec. It got left out in the conversion to echoe, so "require 'RedCloth'" didn't work. #88
|
data/COPYING
CHANGED
data/README
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Homepage:: http://redcloth.org
|
4
4
|
Author:: Jason Garber
|
5
|
-
Copyright:: (c)
|
5
|
+
Copyright:: (c) 2009 Jason Garber
|
6
6
|
License:: MIT
|
7
7
|
|
8
8
|
(See http://redcloth.org/textile/ for a Textile reference.)
|
@@ -15,10 +15,38 @@ RedCloth is a Ruby library for converting Textile into HTML.
|
|
15
15
|
|
16
16
|
RedCloth can be installed via RubyGems:
|
17
17
|
|
18
|
-
|
18
|
+
gem install RedCloth
|
19
|
+
|
20
|
+
It will install the appropriate Ruby, JRuby, or Win32 gem. If using JRuby, version 1.1.5 or greater is required.
|
21
|
+
|
22
|
+
== Compiling
|
23
|
+
|
24
|
+
If you just want to use RedCloth, you do NOT need to build/compile it. It is compiled from C sources automatically when you install the gem on the ruby platform. Binary gems are provided for JRuby and Win32 platforms.
|
25
|
+
|
26
|
+
RedCloth can be compiled with <tt>rake compile</tt>. Ragel 6.3 or greater and the
|
27
|
+
echoe gem are needed to build, compile, and package RedCloth. Again, Ragel and echoe are NOT needed to simply use RedCloth.
|
28
|
+
|
29
|
+
You can cross-compile for JRuby with rake java compile and for Win32 with rake mingw compile.
|
30
|
+
|
31
|
+
== Using RedCloth
|
32
|
+
|
33
|
+
RedCloth is simply an extension of the String class, which can handle
|
34
|
+
Textile formatting. Use it like a String and output HTML with its
|
35
|
+
RedCloth#to_html method.
|
36
|
+
|
37
|
+
Simple use:
|
38
|
+
text = "This is *my* text."
|
39
|
+
RedCloth.new(text).to_html
|
40
|
+
|
41
|
+
Multi-line example:
|
42
|
+
|
43
|
+
doc = RedCloth.new <<EOD
|
44
|
+
h2. Test document
|
45
|
+
|
46
|
+
Just a simple test.
|
47
|
+
EOD
|
48
|
+
puts doc.to_html
|
19
49
|
|
20
|
-
Or can be compiled from its Ragel source with <tt>rake compile</tt>. Ragel 6.2
|
21
|
-
or greater is required to build RedCloth.
|
22
50
|
|
23
51
|
== What is Textile?
|
24
52
|
|
@@ -140,17 +168,4 @@ Styles are applied with curly braces.
|
|
140
168
|
table{border:1px solid black}.
|
141
169
|
{background:#ddd;color:red}. |a|red|row|
|
142
170
|
|
143
|
-
== Using RedCloth
|
144
|
-
|
145
|
-
RedCloth is simply an extension of the String class, which can handle
|
146
|
-
Textile formatting. Use it like a String and output HTML with its
|
147
|
-
RedCloth#to_html method.
|
148
|
-
|
149
|
-
doc = RedCloth.new "
|
150
|
-
|
151
|
-
h2. Test document
|
152
|
-
|
153
|
-
Just a simple test."
|
154
|
-
|
155
|
-
puts doc.to_html
|
156
171
|
|
data/Rakefile
CHANGED
@@ -14,6 +14,7 @@ e = Echoe.new('RedCloth', RedCloth::VERSION.to_s) do |p|
|
|
14
14
|
p.ignore_pattern = /^(pkg|site|projects|doc|log)|CVS|\.log/
|
15
15
|
p.ruby_version = '>=1.8.4'
|
16
16
|
p.extension_pattern = nil
|
17
|
+
p.development_dependencies = [] # remove echoe from development dependencies
|
17
18
|
|
18
19
|
if Platform.gcc?
|
19
20
|
p.platform = 'x86-mswin32-60'
|
data/RedCloth.gemspec
CHANGED
@@ -1,142 +1,36 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
1
2
|
|
2
|
-
|
3
|
-
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{RedCloth}
|
5
|
+
s.version = "4.1.9"
|
6
|
+
s.platform = %q{universal-java}
|
4
7
|
|
5
|
-
|
6
|
-
|
8
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
9
|
+
s.authors = ["Jason Garber"]
|
10
|
+
s.date = %q{2009-02-20}
|
11
|
+
s.default_executable = %q{redcloth}
|
12
|
+
s.description = %q{RedCloth-4.1.9 - Textile parser for Ruby. http://redcloth.org/}
|
13
|
+
s.email = %q{redcloth-upwards@rubyforge.org}
|
14
|
+
s.executables = ["redcloth"]
|
15
|
+
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"]
|
16
|
+
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", "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", "RedCloth.gemspec", "lib/redcloth_scan.jar"]
|
17
|
+
s.has_rdoc = true
|
18
|
+
s.homepage = %q{http://redcloth.org}
|
19
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "RedCloth", "--main", "README"]
|
20
|
+
s.require_paths = ["lib", "ext", "lib/case_sensitive_require"]
|
21
|
+
s.required_ruby_version = Gem::Requirement.new(">= 1.8.4")
|
22
|
+
s.rubyforge_project = %q{redcloth}
|
23
|
+
s.rubygems_version = %q{1.3.1}
|
24
|
+
s.summary = %q{RedCloth-4.1.9 - Textile parser for Ruby. http://redcloth.org/}
|
25
|
+
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"]
|
7
26
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
version: !ruby/object:Gem::Version
|
12
|
-
version: 4.1.1
|
13
|
-
post_install_message:
|
14
|
-
date: 2008-11-19 05:00:00 +00:00
|
15
|
-
files:
|
16
|
-
- bin/redcloth
|
17
|
-
- CHANGELOG
|
18
|
-
- COPYING
|
19
|
-
- ext/mingw-rbconfig.rb
|
20
|
-
- ext/redcloth_scan/extconf.rb
|
21
|
-
- ext/redcloth_scan/redcloth.h
|
22
|
-
- ext/redcloth_scan/redcloth_attributes.c.rl
|
23
|
-
- ext/redcloth_scan/redcloth_attributes.java.rl
|
24
|
-
- ext/redcloth_scan/redcloth_attributes.rl
|
25
|
-
- ext/redcloth_scan/redcloth_common.c.rl
|
26
|
-
- ext/redcloth_scan/redcloth_common.java.rl
|
27
|
-
- ext/redcloth_scan/redcloth_common.rl
|
28
|
-
- ext/redcloth_scan/redcloth_inline.c.rl
|
29
|
-
- ext/redcloth_scan/redcloth_inline.java.rl
|
30
|
-
- ext/redcloth_scan/redcloth_inline.rl
|
31
|
-
- ext/redcloth_scan/redcloth_scan.c.rl
|
32
|
-
- ext/redcloth_scan/redcloth_scan.java.rl
|
33
|
-
- ext/redcloth_scan/redcloth_scan.rl
|
34
|
-
- extras/ragel_profiler.rb
|
35
|
-
- lib/case_sensitive_require/RedCloth.rb
|
36
|
-
- lib/redcloth/erb_extension.rb
|
37
|
-
- lib/redcloth/formatters/base.rb
|
38
|
-
- lib/redcloth/formatters/html.rb
|
39
|
-
- lib/redcloth/formatters/latex.rb
|
40
|
-
- lib/redcloth/formatters/latex_entities.yml
|
41
|
-
- lib/redcloth/textile_doc.rb
|
42
|
-
- lib/redcloth/version.rb
|
43
|
-
- lib/redcloth.rb
|
44
|
-
- Manifest
|
45
|
-
- Rakefile
|
46
|
-
- README
|
47
|
-
- setup.rb
|
48
|
-
- test/basic.yml
|
49
|
-
- test/code.yml
|
50
|
-
- test/definitions.yml
|
51
|
-
- test/extra_whitespace.yml
|
52
|
-
- test/filter_html.yml
|
53
|
-
- test/filter_pba.yml
|
54
|
-
- test/helper.rb
|
55
|
-
- test/html.yml
|
56
|
-
- test/images.yml
|
57
|
-
- test/instiki.yml
|
58
|
-
- test/links.yml
|
59
|
-
- test/lists.yml
|
60
|
-
- test/poignant.yml
|
61
|
-
- test/sanitize_html.yml
|
62
|
-
- test/table.yml
|
63
|
-
- test/test_custom_tags.rb
|
64
|
-
- test/test_erb.rb
|
65
|
-
- test/test_extensions.rb
|
66
|
-
- test/test_formatters.rb
|
67
|
-
- test/test_parser.rb
|
68
|
-
- test/test_restrictions.rb
|
69
|
-
- test/textism.yml
|
70
|
-
- test/threshold.yml
|
71
|
-
- test/validate_fixtures.rb
|
72
|
-
- RedCloth.gemspec
|
73
|
-
- lib/redcloth_scan.jar
|
74
|
-
rubygems_version: 1.2.0
|
75
|
-
rdoc_options:
|
76
|
-
- --line-numbers
|
77
|
-
- --inline-source
|
78
|
-
- --title
|
79
|
-
- RedCloth
|
80
|
-
- --main
|
81
|
-
- README
|
27
|
+
if s.respond_to? :specification_version then
|
28
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
29
|
+
s.specification_version = 2
|
82
30
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
|
-
version:
|
91
|
-
requirements:
|
92
|
-
- - '>='
|
93
|
-
- !ruby/object:Gem::Version
|
94
|
-
version: "1.2"
|
95
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
96
|
-
version:
|
97
|
-
requirements:
|
98
|
-
- - '>='
|
99
|
-
- !ruby/object:Gem::Version
|
100
|
-
version: 1.8.4
|
101
|
-
require_paths:
|
102
|
-
- lib
|
103
|
-
- ext
|
104
|
-
- lib/case_sensitive_require
|
105
|
-
specification_version: 2
|
106
|
-
test_files:
|
107
|
-
- test/test_custom_tags.rb
|
108
|
-
- test/test_erb.rb
|
109
|
-
- test/test_extensions.rb
|
110
|
-
- test/test_formatters.rb
|
111
|
-
- test/test_parser.rb
|
112
|
-
- test/test_restrictions.rb
|
113
|
-
dependencies:
|
114
|
-
- !ruby/object:Gem::Dependency
|
115
|
-
type: :development
|
116
|
-
name: echoe
|
117
|
-
version_requirement:
|
118
|
-
version_requirements: !ruby/object:Gem::Requirement
|
119
|
-
version:
|
120
|
-
requirements:
|
121
|
-
- - '>='
|
122
|
-
- !ruby/object:Gem::Version
|
123
|
-
version: "0"
|
124
|
-
description: RedCloth-4.1.1 - Textile parser for Ruby. http://redcloth.org/
|
125
|
-
email: redcloth-upwards@rubyforge.org
|
126
|
-
authors:
|
127
|
-
- Jason Garber
|
128
|
-
extra_rdoc_files:
|
129
|
-
- CHANGELOG
|
130
|
-
- lib/case_sensitive_require/RedCloth.rb
|
131
|
-
- lib/redcloth/erb_extension.rb
|
132
|
-
- lib/redcloth/formatters/base.rb
|
133
|
-
- lib/redcloth/formatters/html.rb
|
134
|
-
- lib/redcloth/formatters/latex.rb
|
135
|
-
- lib/redcloth/textile_doc.rb
|
136
|
-
- lib/redcloth/version.rb
|
137
|
-
- lib/redcloth.rb
|
138
|
-
- README
|
139
|
-
requirements: []
|
140
|
-
|
141
|
-
rubyforge_project: redcloth
|
142
|
-
autorequire:
|
31
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
32
|
+
else
|
33
|
+
end
|
34
|
+
else
|
35
|
+
end
|
36
|
+
end
|
@@ -1,14 +1,30 @@
|
|
1
1
|
#ifndef redcloth_h
|
2
2
|
#define redcloth_h
|
3
3
|
|
4
|
-
|
5
|
-
#
|
6
|
-
#define RSTRING_LEN(
|
4
|
+
#ifndef RARRAY_LEN
|
5
|
+
#define RARRAY_LEN(arr) RARRAY(arr)->len
|
6
|
+
#define RSTRING_LEN(str) RSTRING(str)->len
|
7
|
+
#define RSTRING_PTR(str) RSTRING(str)->ptr
|
7
8
|
#endif
|
8
|
-
|
9
|
-
|
9
|
+
|
10
|
+
|
11
|
+
// Different string conversions for ruby 1.8 and ruby 1.9. For 1.9,
|
12
|
+
// we need to set the encoding of the string.
|
13
|
+
|
14
|
+
// For Ruby 1.9
|
15
|
+
#ifdef HAVE_RUBY_ENCODING_H
|
16
|
+
#include "ruby/encoding.h"
|
17
|
+
#define STR_NEW(p,n) rb_enc_str_new((p),(n),rb_utf8_encoding())
|
18
|
+
#define STR_NEW2(p) rb_enc_str_new((p),strlen(p),rb_utf8_encoding())
|
19
|
+
|
20
|
+
// For Ruby 1.8
|
21
|
+
#else
|
22
|
+
#define STR_NEW(p,n) rb_str_new((p),(n))
|
23
|
+
#define STR_NEW2(p) rb_str_new2((p))
|
24
|
+
|
10
25
|
#endif
|
11
26
|
|
27
|
+
|
12
28
|
/* variable defs */
|
13
29
|
#ifndef redcloth_scan_c
|
14
30
|
extern VALUE super_ParseError, mRedCloth, super_RedCloth;
|
@@ -23,6 +39,7 @@ VALUE redcloth_inline2(VALUE, VALUE, VALUE);
|
|
23
39
|
VALUE redcloth_attribute_parser(int, VALUE, char *, char *);
|
24
40
|
VALUE redcloth_attributes(VALUE, VALUE);
|
25
41
|
VALUE redcloth_link_attributes(VALUE, VALUE);
|
42
|
+
VALUE red_parse_title(VALUE, VALUE);
|
26
43
|
VALUE redcloth_transform(VALUE, char *, char *, VALUE);
|
27
44
|
VALUE redcloth_transform2(VALUE, VALUE);
|
28
45
|
void red_inc(VALUE, VALUE);
|
@@ -35,14 +52,16 @@ VALUE red_pass_code(VALUE, VALUE, VALUE, ID);
|
|
35
52
|
#define CLEAR_REGS() regs = rb_hash_new();
|
36
53
|
#define RESET_REG() reg = NULL
|
37
54
|
#define CAT(H) rb_str_cat(H, ts, te-ts)
|
38
|
-
#define CLEAR(H) H =
|
39
|
-
#define
|
55
|
+
#define CLEAR(H) H = STR_NEW2("")
|
56
|
+
#define RSTRIP_BANG(H) rb_funcall(H, rb_intern("rstrip!"), 0)
|
57
|
+
#define SET_PLAIN_BLOCK(T) plain_block = STR_NEW2(T)
|
40
58
|
#define RESET_TYPE(T) rb_hash_aset(regs, ID2SYM(rb_intern("type")), plain_block)
|
41
59
|
#define INLINE(H, T) rb_str_append(H, rb_funcall(self, rb_intern(T), 1, regs))
|
42
60
|
#define DONE(H) rb_str_append(html, H); CLEAR(H); CLEAR_REGS()
|
43
61
|
#define PASS(H, A, T) rb_str_append(H, red_pass(self, regs, ID2SYM(rb_intern(A)), rb_intern(T), refs))
|
44
62
|
#define PARSE_ATTR(A) red_parse_attr(self, regs, ID2SYM(rb_intern(A)))
|
45
63
|
#define PARSE_LINK_ATTR(A) red_parse_link_attr(self, regs, ID2SYM(rb_intern(A)))
|
64
|
+
#define PARSE_IMAGE_ATTR(A) red_parse_image_attr(self, regs, ID2SYM(rb_intern(A)))
|
46
65
|
#define PASS_CODE(H, A, T, O) rb_str_append(H, red_pass_code(self, regs, ID2SYM(rb_intern(A)), rb_intern(T)))
|
47
66
|
#define ADD_BLOCK() \
|
48
67
|
rb_str_append(html, red_block(self, regs, block, refs)); \
|
@@ -54,38 +73,36 @@ VALUE red_pass_code(VALUE, VALUE, VALUE, ID);
|
|
54
73
|
#define IS_NOT_EXTENDED() NIL_P(extend)
|
55
74
|
#define ADD_BLOCKCODE() rb_str_append(html, red_blockcode(self, regs, block)); CLEAR(block); CLEAR_REGS()
|
56
75
|
#define ADD_EXTENDED_BLOCKCODE() rb_str_append(html, red_blockcode(self, regs, block)); CLEAR(block);
|
57
|
-
#define ASET(T, V) rb_hash_aset(regs, ID2SYM(rb_intern(T)),
|
76
|
+
#define ASET(T, V) rb_hash_aset(regs, ID2SYM(rb_intern(T)), STR_NEW2(V));
|
58
77
|
#define AINC(T) red_inc(regs, ID2SYM(rb_intern(T)));
|
59
78
|
#define SET_ATTRIBUTES() \
|
60
|
-
VALUE buf = Qnil; \
|
61
79
|
SET_ATTRIBUTE("class_buf", "class"); \
|
62
80
|
SET_ATTRIBUTE("id_buf", "id"); \
|
63
81
|
SET_ATTRIBUTE("lang_buf", "lang"); \
|
64
82
|
SET_ATTRIBUTE("style_buf", "style");
|
65
83
|
#define SET_ATTRIBUTE(B, A) \
|
66
|
-
|
67
|
-
if (buf != Qnil) rb_hash_aset(regs, ID2SYM(rb_intern(A)), buf);
|
84
|
+
if (rb_hash_aref(regs, ID2SYM(rb_intern(B))) != Qnil) rb_hash_aset(regs, ID2SYM(rb_intern(A)), rb_hash_aref(regs, ID2SYM(rb_intern(B))));
|
68
85
|
#define TRANSFORM(T) \
|
69
86
|
if (p > reg && reg >= ts) { \
|
70
87
|
VALUE str = redcloth_transform(self, reg, p, refs); \
|
71
88
|
rb_hash_aset(regs, ID2SYM(rb_intern(T)), str); \
|
72
|
-
|
89
|
+
/*printf("TRANSFORM(" T ") '%s' (p:'%s' reg:'%s')\n", RSTRING_PTR(str), p, reg);*/ \
|
73
90
|
} else { \
|
74
91
|
rb_hash_aset(regs, ID2SYM(rb_intern(T)), Qnil); \
|
75
92
|
}
|
76
93
|
#define STORE(T) \
|
77
94
|
if (p > reg && reg >= ts) { \
|
78
|
-
VALUE str =
|
95
|
+
VALUE str = STR_NEW(reg, p-reg); \
|
79
96
|
rb_hash_aset(regs, ID2SYM(rb_intern(T)), str); \
|
80
|
-
|
97
|
+
/*printf("STORE(" T ") '%s' (p:'%s' reg:'%s')\n", RSTRING_PTR(str), p, reg);*/ \
|
81
98
|
} else { \
|
82
99
|
rb_hash_aset(regs, ID2SYM(rb_intern(T)), Qnil); \
|
83
100
|
}
|
84
101
|
#define STORE_B(T) \
|
85
102
|
if (p > bck && bck >= ts) { \
|
86
|
-
VALUE str =
|
103
|
+
VALUE str = STR_NEW(bck, p-bck); \
|
87
104
|
rb_hash_aset(regs, ID2SYM(rb_intern(T)), str); \
|
88
|
-
|
105
|
+
/*printf("STORE_B(" T ") '%s' (p:'%s' reg:'%s')\n", RSTRING_PTR(str), p, reg);*/ \
|
89
106
|
} else { \
|
90
107
|
rb_hash_aset(regs, ID2SYM(rb_intern(T)), Qnil); \
|
91
108
|
}
|
@@ -94,8 +111,22 @@ VALUE red_pass_code(VALUE, VALUE, VALUE, ID);
|
|
94
111
|
char punct = 1; \
|
95
112
|
while (p > reg && punct == 1) { \
|
96
113
|
switch (*(p - 1)) { \
|
114
|
+
case ')': \
|
115
|
+
{ /*needed to keep inside chars scoped for less memory usage*/\
|
116
|
+
char *temp_p = p - 1; \
|
117
|
+
char level = -1; \
|
118
|
+
while (temp_p > reg) { \
|
119
|
+
switch(*(temp_p - 1)) { \
|
120
|
+
case '(': ++level; break; \
|
121
|
+
case ')': --level; break; \
|
122
|
+
} \
|
123
|
+
--temp_p; \
|
124
|
+
} \
|
125
|
+
if (level == 0) { punct = 0; } else { --p; } \
|
126
|
+
} \
|
127
|
+
break; \
|
97
128
|
case '!': case '"': case '#': case '$': case '%': case ']': case '[': case '&': case '\'': \
|
98
|
-
case '*': case '+': case ',': case '-': case '.': case '
|
129
|
+
case '*': case '+': case ',': case '-': case '.': case '(': case ':': \
|
99
130
|
case ';': case '=': case '?': case '@': case '\\': case '^': case '_': \
|
100
131
|
case '`': case '|': case '~': p--; break; \
|
101
132
|
default: punct = 0; \
|
@@ -118,7 +149,7 @@ VALUE red_pass_code(VALUE, VALUE, VALUE, ID);
|
|
118
149
|
{ \
|
119
150
|
rb_ary_store(list_index, nest-1, INT2NUM(aint + 1)); \
|
120
151
|
} \
|
121
|
-
if (nest >
|
152
|
+
if (nest > RARRAY_LEN(list_layout)) \
|
122
153
|
{ \
|
123
154
|
sprintf(listm, "%s_open", list_type); \
|
124
155
|
if (list_continue == 1) \
|
@@ -141,17 +172,17 @@ VALUE red_pass_code(VALUE, VALUE, VALUE, ID);
|
|
141
172
|
} \
|
142
173
|
rb_hash_aset(regs, ID2SYM(rb_intern("nest")), INT2NUM(nest)); \
|
143
174
|
rb_str_append(html, rb_funcall(self, rb_intern(listm), 1, regs)); \
|
144
|
-
rb_ary_store(list_layout, nest-1,
|
175
|
+
rb_ary_store(list_layout, nest-1, STR_NEW2(list_type)); \
|
145
176
|
CLEAR_REGS(); \
|
146
177
|
ASET("first", "true"); \
|
147
178
|
} \
|
148
179
|
LIST_CLOSE(); \
|
149
|
-
rb_hash_aset(regs, ID2SYM(rb_intern("nest")), INT2NUM(
|
180
|
+
rb_hash_aset(regs, ID2SYM(rb_intern("nest")), INT2NUM(RARRAY_LEN(list_layout))); \
|
150
181
|
ASET("type", "li_open")
|
151
182
|
#define LIST_CLOSE() \
|
152
|
-
while (nest <
|
183
|
+
while (nest < RARRAY_LEN(list_layout)) \
|
153
184
|
{ \
|
154
|
-
rb_hash_aset(regs, ID2SYM(rb_intern("nest")), INT2NUM(
|
185
|
+
rb_hash_aset(regs, ID2SYM(rb_intern("nest")), INT2NUM(RARRAY_LEN(list_layout))); \
|
155
186
|
VALUE end_list = rb_ary_pop(list_layout); \
|
156
187
|
if (!NIL_P(end_list)) \
|
157
188
|
{ \
|