BBRedCloth 0.8.8 → 0.9.0.alpha1
Sign up to get free protection for your applications and to get access to all the features.
- data/BBRedCloth.gemspec +8 -8
- data/CHANGELOG +160 -3
- data/Manifest +0 -18
- data/README.textile +17 -2
- data/Rakefile +14 -12
- data/ext/redcloth_scan/redcloth.h +42 -16
- data/ext/redcloth_scan/redcloth_attributes.c +373 -379
- data/ext/redcloth_scan/redcloth_bbcode.c +57 -56
- data/ext/redcloth_scan/redcloth_bbcode_inline.c +22 -21
- data/ext/redcloth_scan/redcloth_inline.c +7488 -9996
- data/ext/redcloth_scan/redcloth_scan.c +22693 -8756
- data/lib/redcloth.rb +7 -0
- data/lib/redcloth/formatters/base.rb +26 -20
- data/lib/redcloth/formatters/html.rb +39 -96
- data/lib/redcloth/formatters/latex.rb +11 -11
- data/lib/redcloth/textile_doc.rb +0 -5
- data/lib/redcloth/version.rb +4 -4
- data/test/basic.yml +118 -13
- data/test/code.yml +15 -7
- data/test/html.yml +38 -1
- data/test/images.yml +51 -0
- data/test/links.yml +35 -1
- data/test/lists.yml +180 -1
- data/test/table.yml +86 -0
- data/test/test_restrictions.rb +0 -4
- data/test/textism.yml +2 -16
- data/test/threshold.yml +4 -19
- metadata +14 -31
- data/ext/mingw-rbconfig.rb +0 -176
- data/ext/redcloth_scan/redcloth_attributes.c.rl +0 -56
- data/ext/redcloth_scan/redcloth_attributes.java.rl +0 -96
- data/ext/redcloth_scan/redcloth_attributes.rl +0 -33
- data/ext/redcloth_scan/redcloth_bbcode.c.rl +0 -60
- data/ext/redcloth_scan/redcloth_bbcode.rl +0 -127
- data/ext/redcloth_scan/redcloth_bbcode_inline.c.rl +0 -72
- data/ext/redcloth_scan/redcloth_bbcode_inline.rl +0 -85
- data/ext/redcloth_scan/redcloth_common.c.rl +0 -19
- data/ext/redcloth_scan/redcloth_common.java.rl +0 -18
- data/ext/redcloth_scan/redcloth_common.rl +0 -111
- data/ext/redcloth_scan/redcloth_inline.c.rl +0 -205
- data/ext/redcloth_scan/redcloth_inline.java.rl +0 -108
- data/ext/redcloth_scan/redcloth_inline.rl +0 -176
- data/ext/redcloth_scan/redcloth_scan.c.rl +0 -236
- data/ext/redcloth_scan/redcloth_scan.java.rl +0 -555
- data/ext/redcloth_scan/redcloth_scan.rl +0 -426
- data/extras/ragel_profiler.rb +0 -73
data/BBRedCloth.gemspec
CHANGED
@@ -2,25 +2,25 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "BBRedCloth"
|
5
|
-
s.version = "0.
|
5
|
+
s.version = "0.9.0.alpha1"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Ryan Alyea"]
|
9
|
-
s.date = "
|
10
|
-
s.description = "BBRedCloth-0.
|
9
|
+
s.date = "2021-01-02"
|
10
|
+
s.description = "BBRedCloth-0.9.0.alpha1 - Textile parser for Ruby. Includes BBCode additions.\nhttp://redcloth.org/"
|
11
11
|
s.email = "ryan@fangamer.com"
|
12
12
|
s.executables = ["redcloth"]
|
13
13
|
s.extensions = ["ext/redcloth_scan/extconf.rb"]
|
14
14
|
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.textile"]
|
15
|
-
s.files = ["bin/redcloth", "CHANGELOG", "COPYING", "ext/
|
15
|
+
s.files = ["bin/redcloth", "CHANGELOG", "COPYING", "ext/redcloth_scan/extconf.rb", "ext/redcloth_scan/redcloth.h", "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.textile", "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", "BBRedCloth.gemspec", "ext/redcloth_scan/redcloth_attributes.c", "ext/redcloth_scan/redcloth_inline.c", "ext/redcloth_scan/redcloth_scan.c", "ext/redcloth_scan/redcloth_bbcode.c", "ext/redcloth_scan/redcloth_bbcode_inline.c"]
|
16
16
|
s.homepage = "http://redcloth.org"
|
17
|
-
s.rdoc_options = ["--line-numbers", "--
|
17
|
+
s.rdoc_options = ["--line-numbers", "--title", "BBRedCloth", "--main", "README.textile"]
|
18
18
|
s.require_paths = ["lib", "ext", "lib/case_sensitive_require"]
|
19
19
|
s.required_ruby_version = Gem::Requirement.new(">= 1.8.4")
|
20
20
|
s.rubyforge_project = "bbredcloth"
|
21
|
-
s.rubygems_version = "1.8.
|
22
|
-
s.summary = "BBRedCloth-0.
|
23
|
-
s.test_files = ["test/
|
21
|
+
s.rubygems_version = "1.8.23.2"
|
22
|
+
s.summary = "BBRedCloth-0.9.0.alpha1 - Textile parser for Ruby. Includes BBCode additions. http://redcloth.org/"
|
23
|
+
s.test_files = ["test/test_formatters.rb", "test/test_custom_tags.rb", "test/test_extensions.rb", "test/test_restrictions.rb", "test/test_erb.rb", "test/test_parser.rb"]
|
24
24
|
|
25
25
|
if s.respond_to? :specification_version then
|
26
26
|
s.specification_version = 3
|
data/CHANGELOG
CHANGED
@@ -1,4 +1,161 @@
|
|
1
|
-
|
1
|
+
== 4.3.1 / May 17th, 2016
|
2
|
+
|
3
|
+
* Fix additional case for CVE-2012-6684 [Joshua Siler]
|
4
|
+
|
5
|
+
== 4.3.0 / April 29th, 2016
|
6
|
+
|
7
|
+
* Remove JRuby and Windows cross compilation and support
|
8
|
+
* Add Ruby 2.2.3 testing and support
|
9
|
+
|
10
|
+
* include CVE-2012-6684 fix [Tomas Pospisek]
|
11
|
+
* fix by [Antonio Terceiro]
|
12
|
+
* see http://sources.debian.net/src/ruby-redcloth/4.2.9-4/debian/patches/0001-Filter-out-javascript-links-when-using-filter_html-o.patch/
|
13
|
+
* vulnerability reported by [Kousuke Ebihara]
|
14
|
+
* see http://co3k.org/blog/redcloth-unfixed-xss-en
|
15
|
+
|
16
|
+
== 4.2.9.1 / February 24, 2015
|
17
|
+
|
18
|
+
* Lazy-load latex_entities.yml [Charlie Somerville]
|
19
|
+
|
20
|
+
== 4.2.9 / November 25, 2011
|
21
|
+
|
22
|
+
* Fix RbConfig / Config warning in Ruby 1.9.3. [Steve Purcell, Robert Gleeson, and unclaimedbaggage]
|
23
|
+
* Use RSTRING_NOT_MODIFIED header for Rubinius [Dirkjan Bussink]
|
24
|
+
|
25
|
+
== 4.2.8 / August 17, 2011
|
26
|
+
|
27
|
+
* Do not treat warnings as errors so it compiles cleanly. [Tomasz Wałkuski]
|
28
|
+
|
29
|
+
== 4.2.7 / February 10, 2011
|
30
|
+
|
31
|
+
* Fixed typo in gemspec to make case-sensitive require work. [Gabe da Silveira]
|
32
|
+
* Tested installing the gem and requiring it with both cases on Ubuntu 8.04, 10.10 and OS X Version 10.6.6.
|
33
|
+
* Have spaces around the en-dash in LaTeX [Benjamin Quorning]
|
34
|
+
* Turned double-quote close to smart quotes in LaTeX [Jonathan D. Blake]
|
35
|
+
|
36
|
+
=== 4.2.6 / February 9, 2011
|
37
|
+
|
38
|
+
* Add case-sensitive require back into the gemspec.
|
39
|
+
* Fix rdoc options in gemspec.
|
40
|
+
|
41
|
+
=== 4.2.5 / February 7, 2011
|
42
|
+
|
43
|
+
* Fix bundler and rubygems-test incompatibilities. Working around bug:
|
44
|
+
https://github.com/carlhuda/bundler/issues/issue/1021
|
45
|
+
|
46
|
+
=== 4.2.4 / February 7, 2011
|
47
|
+
|
48
|
+
* Add .gemtest to opt-in to rubygems-test program (gem install rubygems-test to participate)
|
49
|
+
* Allow attributes to be set on hr and br tags [Jesse Stormier]
|
50
|
+
* Fix dangling <li> [Stephen Bannasch]
|
51
|
+
* Switch to bundler and rake-compiler for gem management/compilation
|
52
|
+
* Fix invalid YAML for Ruby 1.9.2 [Aaron Patterson]
|
53
|
+
|
54
|
+
=== 4.2.3 / March 1, 2010
|
55
|
+
|
56
|
+
* Allow quotes in styles so you can do things like listing font-families. [Jason Garber]
|
57
|
+
* Fix uninitialized constant Gem::Specification::PLATFORM_CROSS_TARGETS in Rails [Jason Garber]
|
58
|
+
* Allow uppercase letters in class and ID attributes [Jason Garber]
|
59
|
+
* Fix compatibility with newer Echoe, by using full-name for Platform [Flameeyes]
|
60
|
+
* Fixes for PPC/PPC64 [Flameeyes]
|
61
|
+
* Added a modified copy of 'Textile Reference' to a doc folder [codesponge]
|
62
|
+
* Add footnote return links [Jonathan Rudenberg]
|
63
|
+
* Add bug report link to the README
|
64
|
+
|
65
|
+
=== 4.2.2 / June 30, 2009
|
66
|
+
|
67
|
+
* Fix regression where percent wasn't accepted in style attribute. [Jason Garber]
|
68
|
+
|
69
|
+
=== 4.2.1 / June 16, 2009
|
70
|
+
|
71
|
+
* Fix regression where period wasn't accepted in style attribute. [Jason Garber]
|
72
|
+
|
73
|
+
=== 4.2.0 / June 10, 2009
|
74
|
+
|
75
|
+
* Fixed image with title, href, and text afterward not being made a link. [Jason Garber]
|
76
|
+
|
77
|
+
* Pass string encoding through in Ruby 1.9. [Jason Garber]
|
78
|
+
|
79
|
+
* Allow two-letter acronyms. [Jason Garber]
|
80
|
+
|
81
|
+
* Removed vertical alignment in lists. It doesn't make sense and it conflicts with other things. [Jason Garber]
|
82
|
+
|
83
|
+
* Allow table cells to be empty. [Jason Garber]
|
84
|
+
|
85
|
+
* Resolve conflict between table signature and blocks beginning with t. [Jason Garber]
|
86
|
+
|
87
|
+
* Enable code signature to capture trailing space when in square brackets. [Jason Garber]
|
88
|
+
|
89
|
+
* Allow emphasized phrases to include underscores. [Jason Garber]
|
90
|
+
|
91
|
+
* Include an ending question mark in a citation. [Jason Garber]
|
92
|
+
|
93
|
+
* Fix <notextile> blocks being included in following paragraph. [Jason Garber]
|
94
|
+
|
95
|
+
* Preserve leading whitespace in pre and bc blocks. [Jason Garber]
|
96
|
+
|
97
|
+
* Don't add hard break after preexisting <br />. [Jason Garber]
|
98
|
+
|
99
|
+
* Switched tests from Test::Unit to Rspec. [Jason Garber]
|
100
|
+
|
101
|
+
* Accept multiline content in table cells. [Jason Garber]
|
102
|
+
|
103
|
+
* Change to list attributes so you can give style/class to list items (taken from PyTextile). Breaks backwards compatibility.
|
104
|
+
|
105
|
+
Before, the style applied to the first list item applied to the entire list. Now, class/id/style placed
|
106
|
+
before the list applies to the list element and after the hash or asterisk applies to the list item. For
|
107
|
+
example:
|
108
|
+
<ul id="groceries">
|
109
|
+
(#groceries)# Milk <li>milk</li>
|
110
|
+
# Eggs <li>eggs</li>
|
111
|
+
#(optional) granola <li class="optional">granola</li>
|
112
|
+
</ul>
|
113
|
+
|
114
|
+
* Separated attributes out to have their own mark/store variable and regs. This way, they won't conflict with captured text or backtracked text. [Jason Garber]
|
115
|
+
|
116
|
+
* Added a RedCloth::EXTENSION_LANGUAGE constant so you can tell what version of the parser you are using. [Jason Garber]
|
117
|
+
|
118
|
+
* Added a NotCompiledError to give a friendlier message when people just unpack RedCloth into their projects. [Jason Garber]
|
119
|
+
|
120
|
+
* Added a pure-ruby version of the parser for times when you can't compile the C or Java extensions. You should avoid using it if at all possible because it is 32 times slower (and has some other problems, too)! [Jason Garber]
|
121
|
+
|
122
|
+
* Ignore spaces and tabs on blank lines between blocks. #120 [Jason Garber]
|
123
|
+
|
124
|
+
* Allow HTML tags with quoted attributes to be inside link text. To do this, I had to remove the possibility that attributes in HTML tags could have spaces around the equals sign or unquoted attributes. This change also greatly expands the complexity of the state machine, so compilation takes a long time. Sorry. [Jason Garber]
|
125
|
+
|
126
|
+
* Many improvements to the LaTeX formatter by Bil Kleb, a NASA scientist who's been working with LaTeX for 20 years. Thanks, Bil!
|
127
|
+
|
128
|
+
=== 4.1.9 / February 20, 2009
|
129
|
+
|
130
|
+
* Make compatible with Ruby 1.9.
|
131
|
+
|
132
|
+
* Image URLs and image titles can now contain parentheses. #71
|
133
|
+
|
134
|
+
* Handle caps properly in link titles. #77
|
135
|
+
|
136
|
+
* Remove extra preformatted line breaks after extended block code. #79
|
137
|
+
|
138
|
+
* Fix inline <notextile> being recognized as block <notextile>. #81
|
139
|
+
|
140
|
+
* Allow leading spaces on lists for backward compatibility with RedCloth 3.x. #89
|
141
|
+
|
142
|
+
* Recognize deleted phrases when they start at the beginning of a line. #83
|
143
|
+
|
144
|
+
* Fix escaped <code> tag when it has the class attribute and is in a <pre> tag. #95
|
145
|
+
|
146
|
+
* Fix dimensions and primes for LaTeX. #103
|
147
|
+
|
148
|
+
* Don't allow square brackets inside lang attribute so double square brackets are interpreted like Textile 2 and RedCloth 3. #101
|
149
|
+
|
150
|
+
* Improve LaTeX output for tables. #96
|
151
|
+
|
152
|
+
* Fix bad parsing of bracketed image links (which would hang the interpreter in some cases). #97
|
153
|
+
|
154
|
+
* Handle links containing parentheses. Brackets are no longer required. #82 [Ryan Alyea]
|
155
|
+
|
156
|
+
* Made italics use the correct LaTeX tag: textit rather than emph. #98
|
157
|
+
|
158
|
+
* Fixed custom block signatures calling built-in Ruby String methods. #92
|
2
159
|
|
3
160
|
* Mentioned the three supported platforms and what's necessary to build RedCloth in the README file.
|
4
161
|
|
@@ -25,7 +182,7 @@
|
|
25
182
|
To compile the jruby version of the gem: jruby -S rake compile
|
26
183
|
|
27
184
|
* Added textilize ERB utility method. [edraut]
|
28
|
-
Use it in an ERB template like this: <%=t my_textile_string %> or
|
185
|
+
Use it in an ERB template like this: <%=t my_textile_string %> or
|
29
186
|
<%=r %{Some *textile* if you please!} %>
|
30
187
|
|
31
188
|
* Fix extended blockcode stripping whitespace following blank line. #78
|
@@ -120,4 +277,4 @@
|
|
120
277
|
|
121
278
|
* Over 500 tests prevent regression
|
122
279
|
|
123
|
-
* It's 40 times faster than the previous version.
|
280
|
+
* It's 40 times faster than the previous version.
|
data/Manifest
CHANGED
@@ -1,26 +1,8 @@
|
|
1
1
|
bin/redcloth
|
2
2
|
CHANGELOG
|
3
3
|
COPYING
|
4
|
-
ext/mingw-rbconfig.rb
|
5
4
|
ext/redcloth_scan/extconf.rb
|
6
5
|
ext/redcloth_scan/redcloth.h
|
7
|
-
ext/redcloth_scan/redcloth_attributes.c.rl
|
8
|
-
ext/redcloth_scan/redcloth_attributes.java.rl
|
9
|
-
ext/redcloth_scan/redcloth_attributes.rl
|
10
|
-
ext/redcloth_scan/redcloth_bbcode.c.rl
|
11
|
-
ext/redcloth_scan/redcloth_bbcode.rl
|
12
|
-
ext/redcloth_scan/redcloth_bbcode_inline.rl
|
13
|
-
ext/redcloth_scan/redcloth_bbcode_inline.c.rl
|
14
|
-
ext/redcloth_scan/redcloth_common.c.rl
|
15
|
-
ext/redcloth_scan/redcloth_common.java.rl
|
16
|
-
ext/redcloth_scan/redcloth_common.rl
|
17
|
-
ext/redcloth_scan/redcloth_inline.c.rl
|
18
|
-
ext/redcloth_scan/redcloth_inline.java.rl
|
19
|
-
ext/redcloth_scan/redcloth_inline.rl
|
20
|
-
ext/redcloth_scan/redcloth_scan.c.rl
|
21
|
-
ext/redcloth_scan/redcloth_scan.java.rl
|
22
|
-
ext/redcloth_scan/redcloth_scan.rl
|
23
|
-
extras/ragel_profiler.rb
|
24
6
|
lib/case_sensitive_require/RedCloth.rb
|
25
7
|
lib/redcloth/erb_extension.rb
|
26
8
|
lib/redcloth/formatters/base.rb
|
data/README.textile
CHANGED
@@ -9,9 +9,24 @@ License:: MIT
|
|
9
9
|
|
10
10
|
(See http://redcloth.org/textile/ for a Textile reference.)
|
11
11
|
|
12
|
+
h2. Latest Updates
|
13
|
+
|
14
|
+
Holy crap, it's 2021?
|
15
|
+
|
16
|
+
* Updated version to 0.9.0.alpha1. The minor version bump is due to minor breaking changes listed below.
|
17
|
+
* Cherry-picked every major update from RedCloth until this post, which RedCloth has not been updated since 2018. (Nothing wrong with that. Don't fix what ain't broke.) I did not port the RSpec, gem-building, or other new meta elements. But the base engine is still the same so there's no need because the gem-building at least originally was for building on Windows and Java which BBRedCloth does not support.
|
18
|
+
* Includes CVE-2012-6684. Although I highly, *highly* recommend using an html sanitizer on top of this because Textile lets you some EVIL things in CSS.
|
19
|
+
* YouTube and Vimeo support was removed. It used the super old flash version anyway.
|
20
|
+
* Removed the swear filter, it wasn't perfect.
|
21
|
+
* All tests pass. NOTE: Malformed BBCode currently produces non-ideal but valid and secure HTML code. Don't mess up your BBCode and it's all fine.
|
22
|
+
* Confirmed working on Ruby 3.0.0
|
23
|
+
* If you are using BBRedCloth, simply including the pre-packaged gem file is fine. Due to the reliance on Ragel, you cannot just include a Github project.
|
24
|
+
** Since I have not yet ported the build system, you need the last version of echoe gem and Ruby 1.9.3 to actually build the gem using @rake package@. Sorry, not sorry. You can still build Ruby 1.9.3 on macOS Big Sur if you remove or use the super insecure old OpenSSL 1.0.2t, so it's not like super-hard.
|
25
|
+
** Once you have the .gem file, later version of Ruby such as 3.0.0 can then build the native extension normally like any gem.
|
26
|
+
|
12
27
|
h2. BBRedCloth
|
13
28
|
|
14
|
-
BBRedCloth is a Ruby library for converting Textile into HTML. While fundamentally based on RedCloth, it also contains the ability to convert
|
29
|
+
BBRedCloth is a Ruby library for converting Textile into HTML. While fundamentally based on RedCloth, it also contains the ability to convert standard "BBCode" also, which is useful for forums which use this style of markup since, well... forever. As a drop-in replacement for RedCloth, it plays well such that Textile and BBCode can work side-by-side without much effort for the implementer.
|
15
30
|
|
16
31
|
h2. Installing
|
17
32
|
|
@@ -26,7 +41,7 @@ It will install the appropriate Ruby gem. JRuby is not supported, nor is the pur
|
|
26
41
|
If you wish to use BBRedCloth in your Rails 3 project, just add the following to your Gemfile:
|
27
42
|
|
28
43
|
<pre>
|
29
|
-
gem 'BBRedCloth', :
|
44
|
+
gem 'BBRedCloth', require:'redcloth'
|
30
45
|
</pre>
|
31
46
|
|
32
47
|
== Compiling
|
data/Rakefile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require './lib/redcloth/version'
|
2
2
|
require 'rubygems'
|
3
|
-
gem 'echoe', '>=
|
3
|
+
gem 'echoe', '>= 4.1'
|
4
4
|
require 'echoe'
|
5
5
|
|
6
6
|
# Platform missing from Echoe >= 3.2?
|
@@ -51,9 +51,9 @@ e = Echoe.new('BBRedCloth', RedCloth::VERSION.to_s) do |p|
|
|
51
51
|
p.ruby_version = '>=1.8.4'
|
52
52
|
p.extension_pattern = nil
|
53
53
|
|
54
|
-
if Platform.gcc?
|
54
|
+
if Echoe::Platform.gcc?
|
55
55
|
p.platform = 'x86-mswin32-60'
|
56
|
-
elsif Platform.java?
|
56
|
+
elsif Echoe::Platform.java?
|
57
57
|
p.platform = 'universal-java'
|
58
58
|
end
|
59
59
|
|
@@ -86,16 +86,18 @@ def move_extensions
|
|
86
86
|
Dir["ext/**/*.{bundle,so,jar}"].each { |file| mv file, "lib/" }
|
87
87
|
end
|
88
88
|
|
89
|
-
def java_classpath_arg
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
rescue LoadError
|
96
|
-
ENV['JRUBY_PARENT_CLASSPATH'] || ENV['JRUBY_HOME'] && FileList["#{ENV['JRUBY_HOME']}/lib/*.jar"].join(File::PATH_SEPARATOR)
|
89
|
+
def java_classpath_arg # myriad of ways to discover JRuby classpath
|
90
|
+
begin
|
91
|
+
cpath = Java::java.lang.System.getProperty('java.class.path').split(File::PATH_SEPARATOR)
|
92
|
+
cpath += Java::java.lang.System.getProperty('sun.boot.class.path').split(File::PATH_SEPARATOR)
|
93
|
+
jruby_cpath = cpath.compact.join(File::PATH_SEPARATOR)
|
94
|
+
rescue => e
|
97
95
|
end
|
98
|
-
|
96
|
+
unless jruby_cpath
|
97
|
+
jruby_cpath = ENV['JRUBY_PARENT_CLASSPATH'] || ENV['JRUBY_HOME'] &&
|
98
|
+
FileList["#{ENV['JRUBY_HOME']}/lib/*.jar"].join(File::PATH_SEPARATOR)
|
99
|
+
end
|
100
|
+
jruby_cpath ? "-cp \"#{jruby_cpath}\"" : ""
|
99
101
|
end
|
100
102
|
|
101
103
|
ext = "ext/redcloth_scan"
|
@@ -21,8 +21,8 @@
|
|
21
21
|
// For Ruby 1.9
|
22
22
|
#ifdef HAVE_RUBY_ENCODING_H
|
23
23
|
#include "ruby/encoding.h"
|
24
|
-
#define STR_NEW(p,n) rb_enc_str_new((p),(n),
|
25
|
-
#define STR_NEW2(p) rb_enc_str_new((p),strlen(p),
|
24
|
+
#define STR_NEW(p,n) rb_enc_str_new((p),(n),rb_enc_from_index(ENCODING_GET(self)))
|
25
|
+
#define STR_NEW2(p) rb_enc_str_new((p),strlen(p),rb_enc_from_index(ENCODING_GET(self)))
|
26
26
|
|
27
27
|
// For Ruby 1.8
|
28
28
|
#else
|
@@ -46,6 +46,7 @@ VALUE redcloth_inline2(VALUE, VALUE, VALUE);
|
|
46
46
|
VALUE redcloth_attribute_parser(int, VALUE, char *, char *);
|
47
47
|
VALUE redcloth_attributes(VALUE, VALUE);
|
48
48
|
VALUE redcloth_link_attributes(VALUE, VALUE);
|
49
|
+
VALUE red_parse_title(VALUE, VALUE, VALUE);
|
49
50
|
VALUE redcloth_transform(VALUE, char *, char *, VALUE);
|
50
51
|
VALUE redcloth_transform2(VALUE, VALUE);
|
51
52
|
void red_inc(VALUE, VALUE);
|
@@ -68,10 +69,14 @@ VALUE redcloth_bbcode_inline2(VALUE, VALUE, VALUE);
|
|
68
69
|
else { /*VALUE test = STR_NEW(ts,te-ts); printf("\nred_passthrough_else() '%s'\n", RSTRING(test)->ptr);*/ F }
|
69
70
|
#define UNLESS_DISABLED_ATTRIBUTE(T, F) \
|
70
71
|
if (!(rb_funcall(rb_funcall(self, rb_intern("disable_inline"), 0),rb_intern("include?"), 1,ID2SYM(rb_intern(#T))) == Qtrue)) { F } //if !(rb_funcall(rb_funcall(self, rb_intern("disable_inline"), 0),rb_intern("include?"), 1,ID2SYM(rb_intern(#T))) == Qtrue) { F }
|
71
|
-
#define CLEAR_REGS() regs = rb_hash_new();
|
72
|
+
#define CLEAR_REGS() regs = rb_hash_new(); attr_regs = rb_hash_new();
|
72
73
|
#define RESET_REG() reg = NULL
|
74
|
+
#define MARK() reg = p;
|
75
|
+
#define MARK_B() bck = p;
|
76
|
+
#define MARK_ATTR() attr_reg = p;
|
73
77
|
#define CAT(H) rb_str_cat(H, ts, te-ts)
|
74
78
|
#define CLEAR(H) H = STR_NEW2("")
|
79
|
+
#define RSTRIP_BANG(H) rb_funcall(H, rb_intern("rstrip!"), 0)
|
75
80
|
#define SET_PLAIN_BLOCK(T) plain_block = STR_NEW2(T)
|
76
81
|
#define RESET_TYPE(T) rb_hash_aset(regs, ID2SYM(rb_intern("type")), plain_block)
|
77
82
|
#define INLINE(H, T) rb_str_append(H, rb_funcall(self, rb_intern(T), 1, regs))
|
@@ -80,7 +85,8 @@ VALUE redcloth_bbcode_inline2(VALUE, VALUE, VALUE);
|
|
80
85
|
#define PASS(H, A, T) rb_str_append(H, red_pass(self, regs, ID2SYM(rb_intern(A)), rb_intern(T), refs))
|
81
86
|
#define PARSE_ATTR(A) red_parse_attr(self, regs, ID2SYM(rb_intern(A)))
|
82
87
|
#define PARSE_LINK_ATTR(A) red_parse_link_attr(self, regs, ID2SYM(rb_intern(A)))
|
83
|
-
#define
|
88
|
+
#define PARSE_IMAGE_ATTR(A) red_parse_image_attr(self, regs, ID2SYM(rb_intern(A)))
|
89
|
+
#define PASS_CODE(H, A, T) rb_str_append(H, red_pass_code(self, regs, ID2SYM(rb_intern(A)), rb_intern(T)))
|
84
90
|
#define ADD_BLOCK() \
|
85
91
|
rb_str_append(html, red_block(self, regs, block, refs)); \
|
86
92
|
extend = Qnil; \
|
@@ -88,20 +94,21 @@ VALUE redcloth_bbcode_inline2(VALUE, VALUE, VALUE);
|
|
88
94
|
CLEAR_REGS()
|
89
95
|
#define ADD_EXTENDED_BLOCK() rb_str_append(html, red_block(self, regs, block, refs)); CLEAR(block); rb_hash_aset(regs,ID2SYM(rb_intern("fallback")),Qnil);
|
90
96
|
#define END_EXTENDED() extend = Qnil; CLEAR_REGS();
|
91
|
-
#define IS_NOT_EXTENDED() NIL_P(extend)
|
92
97
|
#define ADD_BLOCKCODE() rb_str_append(html, red_blockcode(self, regs, block)); CLEAR(block); CLEAR_REGS()
|
93
98
|
#define ADD_EXTENDED_BLOCKCODE() rb_str_append(html, red_blockcode(self, regs, block)); CLEAR(block);
|
94
99
|
#define ASET(T, V) rb_hash_aset(regs, ID2SYM(rb_intern(T)), STR_NEW2(V));
|
95
|
-
#define
|
100
|
+
#define ATTR_SET(T, V) rb_hash_aset(attr_regs, ID2SYM(rb_intern(T)), STR_NEW2(V));
|
101
|
+
#define ATTR_INC(T) red_inc(attr_regs, ID2SYM(rb_intern(T)));
|
102
|
+
#define INC(N) N++;
|
96
103
|
#define SET_ATTRIBUTES() \
|
97
|
-
VALUE buf = Qnil; \
|
98
104
|
SET_ATTRIBUTE("class_buf", "class"); \
|
99
105
|
SET_ATTRIBUTE("id_buf", "id"); \
|
100
106
|
SET_ATTRIBUTE("lang_buf", "lang"); \
|
101
|
-
SET_ATTRIBUTE("style_buf", "style");
|
107
|
+
SET_ATTRIBUTE("style_buf", "style"); \
|
108
|
+
rb_funcall(regs, rb_intern("merge!"), 1, attr_regs); \
|
109
|
+
attr_regs = rb_hash_new();
|
102
110
|
#define SET_ATTRIBUTE(B, A) \
|
103
|
-
|
104
|
-
if (buf != Qnil) rb_hash_aset(regs, ID2SYM(rb_intern(A)), buf);
|
111
|
+
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))));
|
105
112
|
#define TRANSFORM(T) \
|
106
113
|
if (p > reg && reg >= ts) { \
|
107
114
|
VALUE str = redcloth_transform(self, reg, p, refs); \
|
@@ -127,6 +134,15 @@ VALUE redcloth_bbcode_inline2(VALUE, VALUE, VALUE);
|
|
127
134
|
rb_hash_aset(regs, ID2SYM(rb_intern(T)), Qnil); \
|
128
135
|
}
|
129
136
|
#define BBCODE_ENABLED() rb_funcall(self, rb_intern("bbcode"), 0) == Qtrue
|
137
|
+
#define STORE_ATTR(T) \
|
138
|
+
if (p > attr_reg && attr_reg >= ts) { \
|
139
|
+
VALUE str = STR_NEW(attr_reg, p-attr_reg); \
|
140
|
+
rb_hash_aset(attr_regs, ID2SYM(rb_intern(T)), str); \
|
141
|
+
/*printf("STORE_B(" T ") '%s' (p:'%s' reg:'%s')\n", RSTRING_PTR(str), p, reg);*/ \
|
142
|
+
} else { \
|
143
|
+
rb_hash_aset(attr_regs, ID2SYM(rb_intern(T)), Qnil); \
|
144
|
+
}
|
145
|
+
|
130
146
|
#define STORE_URL(T) \
|
131
147
|
if (p > reg && reg >= ts) { \
|
132
148
|
char punct = 1; \
|
@@ -135,7 +151,7 @@ VALUE redcloth_bbcode_inline2(VALUE, VALUE, VALUE);
|
|
135
151
|
case ')': \
|
136
152
|
{ /*needed to keep inside chars scoped for less memory usage*/\
|
137
153
|
char *temp_p = p - 1; \
|
138
|
-
char level = -1; \
|
154
|
+
signed char level = -1; \
|
139
155
|
while (temp_p > reg) { \
|
140
156
|
switch(*(temp_p - 1)) { \
|
141
157
|
case '(': ++level; break; \
|
@@ -162,20 +178,24 @@ VALUE redcloth_bbcode_inline2(VALUE, VALUE, VALUE);
|
|
162
178
|
#define STORE_LINK_ALIAS() \
|
163
179
|
rb_hash_aset(refs_found, rb_hash_aref(regs, ID2SYM(rb_intern("text"))), rb_hash_aref(regs, ID2SYM(rb_intern("href"))))
|
164
180
|
#define CLEAR_LIST() list_layout = rb_ary_new()
|
165
|
-
#define
|
181
|
+
#define SET_LIST_TYPE(T) list_type = T;
|
182
|
+
#define NEST() nest ++;
|
183
|
+
#define RESET_NEST() nest = 0;
|
184
|
+
#define LIST_LAYOUT() \
|
166
185
|
int aint = 0; \
|
167
186
|
VALUE aval = rb_ary_entry(list_index, nest-1); \
|
168
187
|
if (aval != Qnil) aint = NUM2INT(aval); \
|
169
|
-
if (strcmp(list_type, "ol") == 0) \
|
188
|
+
if (strcmp(list_type, "ol") == 0 && nest > 0) \
|
170
189
|
{ \
|
171
190
|
rb_ary_store(list_index, nest-1, INT2NUM(aint + 1)); \
|
172
191
|
} \
|
173
192
|
if (nest > RARRAY_LEN(list_layout)) \
|
174
193
|
{ \
|
194
|
+
SET_ATTRIBUTES(); \
|
175
195
|
sprintf(listm, "%s_open", list_type); \
|
176
|
-
if (list_continue
|
196
|
+
if (!NIL_P(rb_hash_aref(regs, ID2SYM(rb_intern("list_continue"))))) \
|
177
197
|
{ \
|
178
|
-
list_continue
|
198
|
+
rb_hash_aset(regs, ID2SYM(rb_intern("list_continue")), Qnil); \
|
179
199
|
rb_hash_aset(regs, ID2SYM(rb_intern("start")), rb_ary_entry(list_index, nest-1)); \
|
180
200
|
} \
|
181
201
|
else \
|
@@ -198,8 +218,13 @@ VALUE redcloth_bbcode_inline2(VALUE, VALUE, VALUE);
|
|
198
218
|
ASET("first", "true"); \
|
199
219
|
} \
|
200
220
|
LIST_CLOSE(); \
|
221
|
+
if (nest != 0) LIST_ITEM_CLOSE(); \
|
222
|
+
CLEAR_REGS(); \
|
201
223
|
rb_hash_aset(regs, ID2SYM(rb_intern("nest")), INT2NUM(RARRAY_LEN(list_layout))); \
|
202
|
-
ASET("type", "li_open")
|
224
|
+
ASET("type", "li_open");
|
225
|
+
#define LIST_ITEM_CLOSE() \
|
226
|
+
if ( rb_hash_aref(regs, ID2SYM(rb_intern("first"))) == Qnil ) \
|
227
|
+
rb_str_append(html, rb_funcall(self, rb_intern("li_close"), 1, regs));
|
203
228
|
#define LIST_CLOSE() \
|
204
229
|
while (nest < RARRAY_LEN(list_layout)) \
|
205
230
|
{ \
|
@@ -209,6 +234,7 @@ VALUE redcloth_bbcode_inline2(VALUE, VALUE, VALUE);
|
|
209
234
|
{ \
|
210
235
|
StringValue(end_list); \
|
211
236
|
sprintf(listm, "%s_close", RSTRING_PTR(end_list)); \
|
237
|
+
LIST_ITEM_CLOSE(); \
|
212
238
|
rb_str_append(html, rb_funcall(self, rb_intern(listm), 1, regs)); \
|
213
239
|
} \
|
214
240
|
}
|