RedCloth 4.2.4-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.

Files changed (62) hide show
  1. data/.gemtest +0 -0
  2. data/.gitignore +26 -0
  3. data/.rspec +1 -0
  4. data/CHANGELOG +235 -0
  5. data/COPYING +18 -0
  6. data/Gemfile +7 -0
  7. data/README +198 -0
  8. data/Rakefile +16 -0
  9. data/bin/redcloth +28 -0
  10. data/doc/textile_reference.html +631 -0
  11. data/lib/case_sensitive_require/RedCloth.rb +6 -0
  12. data/lib/redcloth.rb +44 -0
  13. data/lib/redcloth/erb_extension.rb +27 -0
  14. data/lib/redcloth/formatters/base.rb +63 -0
  15. data/lib/redcloth/formatters/html.rb +345 -0
  16. data/lib/redcloth/formatters/latex.rb +322 -0
  17. data/lib/redcloth/formatters/latex_entities.yml +2414 -0
  18. data/lib/redcloth/textile_doc.rb +103 -0
  19. data/lib/redcloth/version.rb +34 -0
  20. data/lib/tasks/pureruby.rake +17 -0
  21. data/redcloth.gemspec +47 -0
  22. data/spec/benchmark_spec.rb +15 -0
  23. data/spec/custom_tags_spec.rb +50 -0
  24. data/spec/erb_spec.rb +10 -0
  25. data/spec/extension_spec.rb +26 -0
  26. data/spec/fixtures/basic.yml +1028 -0
  27. data/spec/fixtures/code.yml +257 -0
  28. data/spec/fixtures/definitions.yml +82 -0
  29. data/spec/fixtures/extra_whitespace.yml +64 -0
  30. data/spec/fixtures/filter_html.yml +177 -0
  31. data/spec/fixtures/filter_pba.yml +20 -0
  32. data/spec/fixtures/html.yml +348 -0
  33. data/spec/fixtures/images.yml +279 -0
  34. data/spec/fixtures/instiki.yml +38 -0
  35. data/spec/fixtures/links.yml +291 -0
  36. data/spec/fixtures/lists.yml +462 -0
  37. data/spec/fixtures/poignant.yml +89 -0
  38. data/spec/fixtures/sanitize_html.yml +42 -0
  39. data/spec/fixtures/table.yml +434 -0
  40. data/spec/fixtures/textism.yml +509 -0
  41. data/spec/fixtures/threshold.yml +762 -0
  42. data/spec/formatters/class_filtered_html_spec.rb +7 -0
  43. data/spec/formatters/filtered_html_spec.rb +7 -0
  44. data/spec/formatters/html_no_breaks_spec.rb +9 -0
  45. data/spec/formatters/html_spec.rb +13 -0
  46. data/spec/formatters/id_filtered_html_spec.rb +7 -0
  47. data/spec/formatters/latex_spec.rb +13 -0
  48. data/spec/formatters/lite_mode_html_spec.rb +7 -0
  49. data/spec/formatters/no_span_caps_html_spec.rb +7 -0
  50. data/spec/formatters/sanitized_html_spec.rb +7 -0
  51. data/spec/formatters/style_filtered_html_spec.rb +7 -0
  52. data/spec/parser_spec.rb +102 -0
  53. data/spec/spec_helper.rb +36 -0
  54. data/tasks/compile.rake +47 -0
  55. data/tasks/gems.rake +37 -0
  56. data/tasks/ragel_extension_task.rb +127 -0
  57. data/tasks/release.rake +15 -0
  58. data/tasks/rspec.rake +13 -0
  59. data/tasks/rvm.rake +78 -0
  60. data/test/ragel_profiler.rb +73 -0
  61. data/test/validate_fixtures.rb +74 -0
  62. metadata +166 -0
File without changes
@@ -0,0 +1,26 @@
1
+ *.log
2
+ *.rbc
3
+ *.sw?
4
+ .bundle
5
+ .DS_Store
6
+ coverage
7
+ doc/rdoc/*
8
+ ext/redcloth_scan/*.bundle
9
+ ext/redcloth_scan/*.class
10
+ ext/redcloth_scan/*.jar
11
+ ext/redcloth_scan/*.java
12
+ ext/redcloth_scan/*.so
13
+ ext/redcloth_scan/*.[co]
14
+ ext/redcloth_scan/extconf.rb
15
+ ext/redcloth_scan/Makefile
16
+ ext/redcloth_scan/redcloth_*.rb
17
+ lib/*.bundle
18
+ lib/*.jar
19
+ lib/*.so
20
+ lib/**/*.so
21
+ lib/redcloth_scan.rb
22
+ pkg
23
+ rdoc
24
+ release
25
+ tmp
26
+ Gemfile.lock
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
@@ -0,0 +1,235 @@
1
+ === 4.2.4 / February 7, 2011
2
+
3
+ * Add .gemtest to opt-in to rubygems-test program (gem install rubygems-test to participate)
4
+ * Allow attributes to be set on hr and br tags [Jesse Stormier]
5
+ * Fix dangling <li> [Stephen Bannasch]
6
+ * Switch to bundler and rake-compiler for gem management/compilation
7
+ * Fix invalid YAML for Ruby 1.9.2 [Aaron Patterson]
8
+
9
+ === 4.2.3 / March 1, 2010
10
+
11
+ * Allow quotes in styles so you can do things like listing font-families. [Jason Garber]
12
+ * Fix uninitialized constant Gem::Specification::PLATFORM_CROSS_TARGETS in Rails [Jason Garber]
13
+ * Allow uppercase letters in class and ID attributes [Jason Garber]
14
+ * Fix compatibility with newer Echoe, by using full-name for Platform [Flameeyes]
15
+ * Fixes for PPC/PPC64 [Flameeyes]
16
+ * Added a modified copy of 'Textile Reference' to a doc folder [codesponge]
17
+ * Add footnote return links [Jonathan Rudenberg]
18
+ * Add bug report link to the README
19
+
20
+ === 4.2.2 / June 30, 2009
21
+
22
+ * Fix regression where percent wasn't accepted in style attribute. [Jason Garber]
23
+
24
+ === 4.2.1 / June 16, 2009
25
+
26
+ * Fix regression where period wasn't accepted in style attribute. [Jason Garber]
27
+
28
+ === 4.2.0 / June 10, 2009
29
+
30
+ * Fixed image with title, href, and text afterward not being made a link. [Jason Garber]
31
+
32
+ * Pass string encoding through in Ruby 1.9. [Jason Garber]
33
+
34
+ * Allow two-letter acronyms. [Jason Garber]
35
+
36
+ * Removed vertical alignment in lists. It doesn't make sense and it conflicts with other things. [Jason Garber]
37
+
38
+ * Allow table cells to be empty. [Jason Garber]
39
+
40
+ * Resolve conflict between table signature and blocks beginning with t. [Jason Garber]
41
+
42
+ * Enable code signature to capture trailing space when in square brackets. [Jason Garber]
43
+
44
+ * Allow emphasized phrases to include underscores. [Jason Garber]
45
+
46
+ * Include an ending question mark in a citation. [Jason Garber]
47
+
48
+ * Fix <notextile> blocks being included in following paragraph. [Jason Garber]
49
+
50
+ * Preserve leading whitespace in pre and bc blocks. [Jason Garber]
51
+
52
+ * Don't add hard break after preexisting <br />. [Jason Garber]
53
+
54
+ * Switched tests from Test::Unit to Rspec. [Jason Garber]
55
+
56
+ * Accept multiline content in table cells. [Jason Garber]
57
+
58
+ * Change to list attributes so you can give style/class to list items (taken from PyTextile). Breaks backwards compatibility.
59
+
60
+ Before, the style applied to the first list item applied to the entire list. Now, class/id/style placed
61
+ before the list applies to the list element and after the hash or asterisk applies to the list item. For
62
+ example:
63
+ <ul id="groceries">
64
+ (#groceries)# Milk <li>milk</li>
65
+ # Eggs <li>eggs</li>
66
+ #(optional) granola <li class="optional">granola</li>
67
+ </ul>
68
+
69
+ * 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]
70
+
71
+ * Added a RedCloth::EXTENSION_LANGUAGE constant so you can tell what version of the parser you are using. [Jason Garber]
72
+
73
+ * Added a NotCompiledError to give a friendlier message when people just unpack RedCloth into their projects. [Jason Garber]
74
+
75
+ * 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]
76
+
77
+ * Ignore spaces and tabs on blank lines between blocks. #120 [Jason Garber]
78
+
79
+ * 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]
80
+
81
+ * Many improvements to the LaTeX formatter by Bil Kleb, a NASA scientist who's been working with LaTeX for 20 years. Thanks, Bil!
82
+
83
+ === 4.1.9 / February 20, 2009
84
+
85
+ * Make compatible with Ruby 1.9.
86
+
87
+ * Image URLs and image titles can now contain parentheses. #71
88
+
89
+ * Handle caps properly in link titles. #77
90
+
91
+ * Remove extra preformatted line breaks after extended block code. #79
92
+
93
+ * Fix inline <notextile> being recognized as block <notextile>. #81
94
+
95
+ * Allow leading spaces on lists for backward compatibility with RedCloth 3.x. #89
96
+
97
+ * Recognize deleted phrases when they start at the beginning of a line. #83
98
+
99
+ * Fix escaped <code> tag when it has the class attribute and is in a <pre> tag. #95
100
+
101
+ * Fix dimensions and primes for LaTeX. #103
102
+
103
+ * Don't allow square brackets inside lang attribute so double square brackets are interpreted like Textile 2 and RedCloth 3. #101
104
+
105
+ * Improve LaTeX output for tables. #96
106
+
107
+ * Fix bad parsing of bracketed image links (which would hang the interpreter in some cases). #97
108
+
109
+ * Handle links containing parentheses. Brackets are no longer required. #82 [Ryan Alyea]
110
+
111
+ * Made italics use the correct LaTeX tag: textit rather than emph. #98
112
+
113
+ * Fixed custom block signatures calling built-in Ruby String methods. #92
114
+
115
+ * Mentioned the three supported platforms and what's necessary to build RedCloth in the README file.
116
+
117
+ * Fixed a require problem that caused an error when you would gem check --test RedCloth. #91
118
+
119
+ === 4.1.1 / November 19, 2008
120
+
121
+ * Added 'lib/case_sensitive_require' back into gemspec. It got left out in the conversion to echoe, so "require 'RedCloth'" didn't work. #88
122
+
123
+ * Fixed <embed> being recognized as a block-level element when using the twice-cooked method of flash embedding. #87
124
+
125
+ * Added horizontal rules from RedCloth 3. Three or more asterisks, dashes, or underscores between blocks triggers the HR tag.
126
+
127
+ * echoe was not being properly registered as a development dependency; a bug in RubyGems was making it a runtime dependency
128
+
129
+ * Fixed "No definition for redcloth_to Installing RDoc documentation"
130
+
131
+ * Fixed wrong platform names when cross-compiling java and win32 versions
132
+
133
+ === 4.1.0 / October 31, 2008
134
+
135
+ * JRuby support! [olabini]
136
+ To run the tests with JRuby, you only need to: jruby -S rake
137
+ To compile the jruby version of the gem: jruby -S rake compile
138
+
139
+ * Added textilize ERB utility method. [edraut]
140
+ Use it in an ERB template like this: <%=t my_textile_string %> or
141
+ <%=r %{Some *textile* if you please!} %>
142
+
143
+ * Fix extended blockcode stripping whitespace following blank line. #78
144
+
145
+
146
+ === 4.0.4 / October 1, 2008
147
+
148
+ * Added some very basic support for images in LaTeX. [virtualfunction]
149
+
150
+ * Fixed missed caps and inline modifiers wrapped in parentheses. #43, #45
151
+
152
+ * Removed indication of quotes explicitly with square brackets. Textile 2.0 does not support this and it wasn't in RedCloth 3. #46
153
+
154
+ * Made percent signs less greedy. They must surround a phrase or else they must be surrounded with square brackets, just like sup, sub, and del phrases. #47
155
+
156
+ * Reduced link eagerness so it wouldn't include preceding quoted phrases. #48
157
+
158
+ * Fixed compatibility issues with Ruby 1.9 [Keita Yamaguchi]. #52, 53, 54
159
+
160
+ * Fixed an error when a link was badly nested in parentheses. #55
161
+
162
+ * Fixed an error on superscript/subscript parenthetical phrase. #56
163
+
164
+ * Fixed bold phrases starting with a number being recognized as unordered lists. #60
165
+
166
+ * Fixed behavior of unclosed (multi-paragraph) quotes and incorrect handling of links inside double quotations. #59, #63
167
+
168
+ * Fixed empty block HTML disappearing. #64
169
+
170
+
171
+ === 4.0.3 / August 18, 2008
172
+
173
+ * Fix NoMethodError: private method gsub!' called for nil:NilClass when two dimensions followed by a space. #38
174
+
175
+ * Fixed unititialized constant RedCloth::TextileDoc with Rails 2.1. Came from a workaround for Rails bug #320 that was applied even when not necessary. #42
176
+
177
+
178
+ === 4.0.2 / August 15, 2008
179
+
180
+ * Fixed link references/aliases not being recognized when they include hyphens. #36
181
+
182
+ * Dimensions in feet and inches use correct typographic characters. #25
183
+
184
+ * Limit overzealous superscript and subscript. Sup/sub phrases must be surrounded by spaces or square brackets, as in Textile 2. #35
185
+
186
+ * Fixed HTML before tables causing the opening table tag to be emitted twice. #33
187
+
188
+ * Cleaned up unused code that was causing a warning. #28
189
+
190
+ * Workaround for Rails 2.1 bug that loads a previous version of RedCloth before loading the unpacked gem. Has since been fixed in edge rails. #30
191
+
192
+ * Added a RedCloth::VERSION.to_s and .== methods so you can puts and compare RedCloth::VERSION just like in previous RedCloth releases. #26
193
+
194
+ * Fixed HTML block ending tags terminating blocks prematurely. #22
195
+
196
+
197
+ === 4.0.1 / July 24, 2008
198
+
199
+ * Fixed lines starting with dashes being recognized as a definition list when there were no definitions.
200
+
201
+ * Created alias RedCloth.rb so Rails 2.1 gem dependency works on case-sensitive operating systems .
202
+ * Fixed parsing sentences that had two em dashes surrounded by spaces from becoming del phrases. #19
203
+
204
+ * Fixed links including prior quoted phrases. #17
205
+
206
+
207
+ === 4.0.0 / July 21, 2008
208
+
209
+ * New SuperRedCloth (RedCloth 4.0) is a total rewrite using Ragel for the parsing.
210
+
211
+ * Markdown support has been removed.
212
+
213
+ * Single newlines become <br> tags, just as in traditional RedCloth and other Textile parsers.
214
+
215
+ * HTML special characters are automatically escaped inside code signatures, like Textile 2. This means you can simply write @<br />@ and the symbols are escaped whereas in RedCloth 3 you had to write @&lt;br /&gt;@ to make the code fragment readable.
216
+
217
+ * The restrictions parameter is observed just like previous versions (except :hard_breaks is now the default).
218
+
219
+ * Arguments to RedCloth#to_html are called so extensions made for prior versions can work. Note: extensions need to be included rather than defined directly within the RedCloth class as was previously possible.
220
+
221
+ * Custom block tags can be implemented as in the previous version, though the means of implementing them differs.
222
+
223
+ * HTML embedded in the Textile input does not often need to be escaped from Textile parsing.
224
+
225
+ * The parser will not wrap lines that begin with a space in paragraph tags.
226
+
227
+ * Rudimentary support for LaTeX is built in.
228
+
229
+ * RedCloth::VERSION on a line by itself inserts the version number into the output.
230
+
231
+ * Output (less newlines and tabs) is identical to Textile 2 except a few cases where the RedCloth way was preferable.
232
+
233
+ * Over 500 tests prevent regression
234
+
235
+ * It's 40 times faster than the previous version.
data/COPYING ADDED
@@ -0,0 +1,18 @@
1
+ Copyright (c) 2011 Jason Garber
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to
5
+ deal in the Software without restriction, including without limitation the
6
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
+ sell copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16
+ THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source :rubygems
2
+ gemspec
3
+
4
+ group :development do
5
+ gem 'rvm'
6
+ gem 'rake-compiler', '~> 0.7.1'
7
+ end
data/README ADDED
@@ -0,0 +1,198 @@
1
+ = RedCloth - Textile parser for Ruby
2
+
3
+ Homepage:: http://redcloth.org
4
+ Author:: Jason Garber
5
+ Copyright:: (c) 2009 Jason Garber
6
+ License:: MIT
7
+
8
+ (See http://redcloth.org/textile/ for a Textile reference.)
9
+
10
+ = RedCloth
11
+
12
+ RedCloth is a Ruby library for converting Textile into HTML.
13
+
14
+ == Installing
15
+
16
+ RedCloth can be installed via RubyGems:
17
+
18
+ gem install RedCloth
19
+
20
+ It will install the appropriate Ruby, JRuby, or Win32 gem. If using JRuby,
21
+ version 1.1.5 or greater is required.
22
+
23
+ == Compiling
24
+
25
+ If you just want to use RedCloth, you do NOT need to build/compile it. It is
26
+ compiled from C sources automatically when you install the gem on the ruby
27
+ platform. Precompiled binary gems are provided for JRuby and Win32 platforms.
28
+
29
+ RedCloth can be compiled with <tt>rake compile</tt>. Ragel 6.3 or greater is
30
+ required. Again, Ragel is NOT needed to simply use RedCloth.
31
+
32
+ === Supported platforms
33
+
34
+ By default, the rake compile task builds a native C extension (MRI 1.8 or 1.9)
35
+ or Java extension (JRuby 1.3). A pure Ruby version can also be generated, but
36
+ it's super slow and Ruby 1.8-only. The JRuby and pure-Ruby extensions don't
37
+ support multi-byte characters. Cross-compiling for win32 uses rake-compiler.
38
+
39
+ The RedCloth::EXTENSION_LANGUAGE constant indicates in which language your
40
+ copy of RedCloth is compiled.
41
+
42
+ === Compiling gems
43
+
44
+ To compile MRI, JRuby, and win32 gems, you need rvm and rake-compiler. These
45
+ and other dependencies can be installed with bundler. Then rake build:all
46
+ takes care of compiling and packaging all gems.
47
+
48
+ # gem install bundler
49
+ # bundle install
50
+ # rake-compiler cross-ruby VERSION=1.8.6-p398
51
+ # rake-compiler cross-ruby VERSION=1.9.1-p243
52
+ # rake build:all
53
+
54
+ == Bugs
55
+
56
+ Please submit bugs to http://jgarber.lighthouseapp.com/projects/13054-redcloth/overview
57
+
58
+ == Using RedCloth
59
+
60
+ RedCloth is simply an extension of the String class that can handle
61
+ Textile formatting. Use it like a String and output HTML with its
62
+ RedCloth#to_html method.
63
+
64
+ Simple use:
65
+ text = "This is *my* text."
66
+ RedCloth.new(text).to_html
67
+
68
+ Multi-line example:
69
+
70
+ doc = RedCloth.new <<EOD
71
+ h2. Test document
72
+
73
+ Just a simple test.
74
+ EOD
75
+ puts doc.to_html
76
+
77
+
78
+ == What is Textile?
79
+
80
+ Textile is a simple formatting style for text
81
+ documents, loosely based on some HTML conventions.
82
+
83
+ == Sample Textile Text
84
+
85
+ h2. This is a title
86
+
87
+ h3. This is a subhead
88
+
89
+ This is a bit of paragraph.
90
+
91
+ bq. This is a blockquote.
92
+
93
+ = Writing Textile
94
+
95
+ A Textile document consists of paragraphs. Paragraphs
96
+ can be specially formatted by adding a small instruction
97
+ to the beginning of the paragraph.
98
+
99
+ h3. Header 3.
100
+ bq. Blockquote.
101
+ # Numeric list.
102
+ * Bulleted list.
103
+
104
+ == Quick Phrase Modifiers
105
+
106
+ Quick phrase modifiers are also included, to allow formatting
107
+ of small portions of text within a paragraph.
108
+
109
+ _emphasis_
110
+ __italicized__
111
+ *strong*
112
+ **bold**
113
+ ??citation??
114
+ -deleted text-
115
+ +inserted text+
116
+ ^superscript^
117
+ ~subscript~
118
+ @code@
119
+ %(classname)span%
120
+
121
+ ==notextile== (leave text alone)
122
+
123
+ == Links
124
+
125
+ To make a hypertext link, put the link text in "quotation
126
+ marks" followed immediately by a colon and the URL of the link.
127
+
128
+ Optional: text in (parentheses) following the link text,
129
+ but before the closing quotation mark, will become a title
130
+ attribute for the link, visible as a tool tip when a cursor is above it.
131
+
132
+ Example:
133
+
134
+ "This is a link (This is a title)":http://www.textism.com
135
+
136
+ Will become:
137
+
138
+ <a href="http://www.textism.com" title="This is a title">This is a link</a>
139
+
140
+ == Images
141
+
142
+ To insert an image, put the URL for the image inside exclamation marks.
143
+
144
+ Optional: text that immediately follows the URL in (parentheses) will
145
+ be used as the Alt text for the image. Images on the web should always
146
+ have descriptive Alt text for the benefit of readers using non-graphical
147
+ browsers.
148
+
149
+ Optional: place a colon followed by a URL immediately after the
150
+ closing ! to make the image into a link.
151
+
152
+ Example:
153
+
154
+ !http://www.textism.com/common/textist.gif(Textist)!
155
+
156
+ Will become:
157
+
158
+ <img src="http://www.textism.com/common/textist.gif" alt="Textist" />
159
+
160
+ With a link:
161
+
162
+ !/common/textist.gif(Textist)!:http://textism.com
163
+
164
+ Will become:
165
+
166
+ <a href="http://textism.com"><img src="/common/textist.gif" alt="Textist" /></a>
167
+
168
+ == Defining Acronyms
169
+
170
+ HTML allows authors to define acronyms via the tag. The definition appears as a
171
+ tool tip when a cursor hovers over the acronym. A crucial aid to clear writing,
172
+ this should be used at least once for each acronym in documents where they appear.
173
+
174
+ To quickly define an acronym in Textile, place the full text in (parentheses)
175
+ immediately following the acronym.
176
+
177
+ Example:
178
+
179
+ ACLU(American Civil Liberties Union)
180
+
181
+ Will become:
182
+
183
+ <acronym title="American Civil Liberties Union">ACLU</acronym>
184
+
185
+ == Adding Tables
186
+
187
+ In Textile, simple tables can be added by separating each column by
188
+ a pipe.
189
+
190
+ |a|simple|table|row|
191
+ |And|Another|table|row|
192
+
193
+ Styles are applied with curly braces.
194
+
195
+ table{border:1px solid black}.
196
+ {background:#ddd;color:red}. |a|red|row|
197
+
198
+