parity-RedCloth 4.2.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +7 -0
  2. data/.gemtest +0 -0
  3. data/.rspec +1 -0
  4. data/CHANGELOG +265 -0
  5. data/COPYING +18 -0
  6. data/Gemfile +7 -0
  7. data/README.rdoc +215 -0
  8. data/Rakefile +18 -0
  9. data/bin/redcloth +28 -0
  10. data/doc/textile_reference.html +631 -0
  11. data/ext/redcloth_scan/extconf.rb +6 -0
  12. data/ext/redcloth_scan/redcloth.h +220 -0
  13. data/ext/redcloth_scan/redcloth_attributes.c +650 -0
  14. data/ext/redcloth_scan/redcloth_inline.c +8153 -0
  15. data/ext/redcloth_scan/redcloth_scan.c +24407 -0
  16. data/lib/case_sensitive_require/RedCloth.rb +6 -0
  17. data/lib/redcloth/erb_extension.rb +27 -0
  18. data/lib/redcloth/formatters/base.rb +63 -0
  19. data/lib/redcloth/formatters/html.rb +352 -0
  20. data/lib/redcloth/formatters/latex.rb +331 -0
  21. data/lib/redcloth/formatters/latex_entities.yml +2414 -0
  22. data/lib/redcloth/textile_doc.rb +113 -0
  23. data/lib/redcloth/version.rb +34 -0
  24. data/lib/redcloth.rb +45 -0
  25. data/lib/tasks/pureruby.rake +17 -0
  26. data/redcloth.gemspec +54 -0
  27. data/spec/benchmark_spec.rb +15 -0
  28. data/spec/custom_tags_spec.rb +50 -0
  29. data/spec/erb_spec.rb +10 -0
  30. data/spec/extension_spec.rb +26 -0
  31. data/spec/fixtures/basic.yml +1028 -0
  32. data/spec/fixtures/code.yml +257 -0
  33. data/spec/fixtures/definitions.yml +82 -0
  34. data/spec/fixtures/extra_whitespace.yml +64 -0
  35. data/spec/fixtures/filter_html.yml +177 -0
  36. data/spec/fixtures/filter_pba.yml +20 -0
  37. data/spec/fixtures/html.yml +348 -0
  38. data/spec/fixtures/images.yml +279 -0
  39. data/spec/fixtures/instiki.yml +38 -0
  40. data/spec/fixtures/links.yml +291 -0
  41. data/spec/fixtures/lists.yml +462 -0
  42. data/spec/fixtures/poignant.yml +89 -0
  43. data/spec/fixtures/sanitize_html.yml +42 -0
  44. data/spec/fixtures/table.yml +434 -0
  45. data/spec/fixtures/textism.yml +509 -0
  46. data/spec/fixtures/threshold.yml +762 -0
  47. data/spec/formatters/class_filtered_html_spec.rb +7 -0
  48. data/spec/formatters/filtered_html_spec.rb +7 -0
  49. data/spec/formatters/html_no_breaks_spec.rb +9 -0
  50. data/spec/formatters/html_spec.rb +13 -0
  51. data/spec/formatters/id_filtered_html_spec.rb +7 -0
  52. data/spec/formatters/latex_spec.rb +13 -0
  53. data/spec/formatters/lite_mode_html_spec.rb +7 -0
  54. data/spec/formatters/no_span_caps_html_spec.rb +7 -0
  55. data/spec/formatters/sanitized_html_spec.rb +7 -0
  56. data/spec/formatters/style_filtered_html_spec.rb +7 -0
  57. data/spec/parser_spec.rb +102 -0
  58. data/spec/spec_helper.rb +36 -0
  59. data/tasks/compile.rake +47 -0
  60. data/tasks/gems.rake +37 -0
  61. data/tasks/ragel_extension_task.rb +127 -0
  62. data/tasks/release.rake +15 -0
  63. data/tasks/rspec.rake +13 -0
  64. data/tasks/rvm.rake +79 -0
  65. metadata +239 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 39a57ffefdc12dae2d96fddca2271b5d31a05304
4
+ data.tar.gz: 2d5864312d0ff36e76bf74a9248183d7e71c95c9
5
+ SHA512:
6
+ metadata.gz: 290d2a07332e818e7277c3e1e481b65767576bfdab35c83b156f9578df525d4dc2e5014f56ac7b215d741078996ec793909f74f3fd749078a3c2449c8538cb61
7
+ data.tar.gz: b6bbf72bbd53ab30bc1f5380fb3cb357e80d275fa834978d1480d6c0ac9b8702e42d9498f2bee2cee63b800845dc8844ed4e3582e6efc027897e721027440e9c
data/.gemtest ADDED
File without changes
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/CHANGELOG ADDED
@@ -0,0 +1,265 @@
1
+ == Head
2
+
3
+ * Lazy-load latex_entities.yml [Charlie Somerville]
4
+
5
+ == 4.2.9 / November 25, 2011
6
+
7
+ * Fix RbConfig / Config warning in Ruby 1.9.3. [Steve Purcell, Robert Gleeson, and unclaimedbaggage]
8
+ * Use RSTRING_NOT_MODIFIED header for Rubinius [Dirkjan Bussink]
9
+
10
+ == 4.2.8 / August 17, 2011
11
+
12
+ * Do not treat warnings as errors so it compiles cleanly. [Tomasz Wałkuski]
13
+
14
+ == 4.2.7 / February 10, 2011
15
+
16
+ * Fixed typo in gemspec to make case-sensitive require work. [Gabe da Silveira]
17
+ * Tested installing the gem and requiring it with both cases on Ubuntu 8.04, 10.10 and OS X Version 10.6.6.
18
+ * Have spaces around the en-dash in LaTeX [Benjamin Quorning]
19
+ * Turned double-quote close to smart quotes in LaTeX [Jonathan D. Blake]
20
+
21
+ === 4.2.6 / February 9, 2011
22
+
23
+ * Add case-sensitive require back into the gemspec.
24
+ * Fix rdoc options in gemspec.
25
+
26
+ === 4.2.5 / February 7, 2011
27
+
28
+ * Fix bundler and rubygems-test incompatibilities. Working around bug:
29
+ https://github.com/carlhuda/bundler/issues/issue/1021
30
+
31
+ === 4.2.4 / February 7, 2011
32
+
33
+ * Add .gemtest to opt-in to rubygems-test program (gem install rubygems-test to participate)
34
+ * Allow attributes to be set on hr and br tags [Jesse Stormier]
35
+ * Fix dangling <li> [Stephen Bannasch]
36
+ * Switch to bundler and rake-compiler for gem management/compilation
37
+ * Fix invalid YAML for Ruby 1.9.2 [Aaron Patterson]
38
+
39
+ === 4.2.3 / March 1, 2010
40
+
41
+ * Allow quotes in styles so you can do things like listing font-families. [Jason Garber]
42
+ * Fix uninitialized constant Gem::Specification::PLATFORM_CROSS_TARGETS in Rails [Jason Garber]
43
+ * Allow uppercase letters in class and ID attributes [Jason Garber]
44
+ * Fix compatibility with newer Echoe, by using full-name for Platform [Flameeyes]
45
+ * Fixes for PPC/PPC64 [Flameeyes]
46
+ * Added a modified copy of 'Textile Reference' to a doc folder [codesponge]
47
+ * Add footnote return links [Jonathan Rudenberg]
48
+ * Add bug report link to the README
49
+
50
+ === 4.2.2 / June 30, 2009
51
+
52
+ * Fix regression where percent wasn't accepted in style attribute. [Jason Garber]
53
+
54
+ === 4.2.1 / June 16, 2009
55
+
56
+ * Fix regression where period wasn't accepted in style attribute. [Jason Garber]
57
+
58
+ === 4.2.0 / June 10, 2009
59
+
60
+ * Fixed image with title, href, and text afterward not being made a link. [Jason Garber]
61
+
62
+ * Pass string encoding through in Ruby 1.9. [Jason Garber]
63
+
64
+ * Allow two-letter acronyms. [Jason Garber]
65
+
66
+ * Removed vertical alignment in lists. It doesn't make sense and it conflicts with other things. [Jason Garber]
67
+
68
+ * Allow table cells to be empty. [Jason Garber]
69
+
70
+ * Resolve conflict between table signature and blocks beginning with t. [Jason Garber]
71
+
72
+ * Enable code signature to capture trailing space when in square brackets. [Jason Garber]
73
+
74
+ * Allow emphasized phrases to include underscores. [Jason Garber]
75
+
76
+ * Include an ending question mark in a citation. [Jason Garber]
77
+
78
+ * Fix <notextile> blocks being included in following paragraph. [Jason Garber]
79
+
80
+ * Preserve leading whitespace in pre and bc blocks. [Jason Garber]
81
+
82
+ * Don't add hard break after preexisting <br />. [Jason Garber]
83
+
84
+ * Switched tests from Test::Unit to Rspec. [Jason Garber]
85
+
86
+ * Accept multiline content in table cells. [Jason Garber]
87
+
88
+ * Change to list attributes so you can give style/class to list items (taken from PyTextile). Breaks backwards compatibility.
89
+
90
+ Before, the style applied to the first list item applied to the entire list. Now, class/id/style placed
91
+ before the list applies to the list element and after the hash or asterisk applies to the list item. For
92
+ example:
93
+ <ul id="groceries">
94
+ (#groceries)# Milk <li>milk</li>
95
+ # Eggs <li>eggs</li>
96
+ #(optional) granola <li class="optional">granola</li>
97
+ </ul>
98
+
99
+ * 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]
100
+
101
+ * Added a RedCloth::EXTENSION_LANGUAGE constant so you can tell what version of the parser you are using. [Jason Garber]
102
+
103
+ * Added a NotCompiledError to give a friendlier message when people just unpack RedCloth into their projects. [Jason Garber]
104
+
105
+ * 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]
106
+
107
+ * Ignore spaces and tabs on blank lines between blocks. #120 [Jason Garber]
108
+
109
+ * 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]
110
+
111
+ * Many improvements to the LaTeX formatter by Bil Kleb, a NASA scientist who's been working with LaTeX for 20 years. Thanks, Bil!
112
+
113
+ === 4.1.9 / February 20, 2009
114
+
115
+ * Make compatible with Ruby 1.9.
116
+
117
+ * Image URLs and image titles can now contain parentheses. #71
118
+
119
+ * Handle caps properly in link titles. #77
120
+
121
+ * Remove extra preformatted line breaks after extended block code. #79
122
+
123
+ * Fix inline <notextile> being recognized as block <notextile>. #81
124
+
125
+ * Allow leading spaces on lists for backward compatibility with RedCloth 3.x. #89
126
+
127
+ * Recognize deleted phrases when they start at the beginning of a line. #83
128
+
129
+ * Fix escaped <code> tag when it has the class attribute and is in a <pre> tag. #95
130
+
131
+ * Fix dimensions and primes for LaTeX. #103
132
+
133
+ * Don't allow square brackets inside lang attribute so double square brackets are interpreted like Textile 2 and RedCloth 3. #101
134
+
135
+ * Improve LaTeX output for tables. #96
136
+
137
+ * Fix bad parsing of bracketed image links (which would hang the interpreter in some cases). #97
138
+
139
+ * Handle links containing parentheses. Brackets are no longer required. #82 [Ryan Alyea]
140
+
141
+ * Made italics use the correct LaTeX tag: textit rather than emph. #98
142
+
143
+ * Fixed custom block signatures calling built-in Ruby String methods. #92
144
+
145
+ * Mentioned the three supported platforms and what's necessary to build RedCloth in the README file.
146
+
147
+ * Fixed a require problem that caused an error when you would gem check --test RedCloth. #91
148
+
149
+ === 4.1.1 / November 19, 2008
150
+
151
+ * Added 'lib/case_sensitive_require' back into gemspec. It got left out in the conversion to echoe, so "require 'RedCloth'" didn't work. #88
152
+
153
+ * Fixed <embed> being recognized as a block-level element when using the twice-cooked method of flash embedding. #87
154
+
155
+ * Added horizontal rules from RedCloth 3. Three or more asterisks, dashes, or underscores between blocks triggers the HR tag.
156
+
157
+ * echoe was not being properly registered as a development dependency; a bug in RubyGems was making it a runtime dependency
158
+
159
+ * Fixed "No definition for redcloth_to Installing RDoc documentation"
160
+
161
+ * Fixed wrong platform names when cross-compiling java and win32 versions
162
+
163
+ === 4.1.0 / October 31, 2008
164
+
165
+ * JRuby support! [olabini]
166
+ To run the tests with JRuby, you only need to: jruby -S rake
167
+ To compile the jruby version of the gem: jruby -S rake compile
168
+
169
+ * Added textilize ERB utility method. [edraut]
170
+ Use it in an ERB template like this: <%=t my_textile_string %> or
171
+ <%=r %{Some *textile* if you please!} %>
172
+
173
+ * Fix extended blockcode stripping whitespace following blank line. #78
174
+
175
+
176
+ === 4.0.4 / October 1, 2008
177
+
178
+ * Added some very basic support for images in LaTeX. [virtualfunction]
179
+
180
+ * Fixed missed caps and inline modifiers wrapped in parentheses. #43, #45
181
+
182
+ * Removed indication of quotes explicitly with square brackets. Textile 2.0 does not support this and it wasn't in RedCloth 3. #46
183
+
184
+ * 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
185
+
186
+ * Reduced link eagerness so it wouldn't include preceding quoted phrases. #48
187
+
188
+ * Fixed compatibility issues with Ruby 1.9 [Keita Yamaguchi]. #52, 53, 54
189
+
190
+ * Fixed an error when a link was badly nested in parentheses. #55
191
+
192
+ * Fixed an error on superscript/subscript parenthetical phrase. #56
193
+
194
+ * Fixed bold phrases starting with a number being recognized as unordered lists. #60
195
+
196
+ * Fixed behavior of unclosed (multi-paragraph) quotes and incorrect handling of links inside double quotations. #59, #63
197
+
198
+ * Fixed empty block HTML disappearing. #64
199
+
200
+
201
+ === 4.0.3 / August 18, 2008
202
+
203
+ * Fix NoMethodError: private method gsub!' called for nil:NilClass when two dimensions followed by a space. #38
204
+
205
+ * 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
206
+
207
+
208
+ === 4.0.2 / August 15, 2008
209
+
210
+ * Fixed link references/aliases not being recognized when they include hyphens. #36
211
+
212
+ * Dimensions in feet and inches use correct typographic characters. #25
213
+
214
+ * Limit overzealous superscript and subscript. Sup/sub phrases must be surrounded by spaces or square brackets, as in Textile 2. #35
215
+
216
+ * Fixed HTML before tables causing the opening table tag to be emitted twice. #33
217
+
218
+ * Cleaned up unused code that was causing a warning. #28
219
+
220
+ * 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
221
+
222
+ * Added a RedCloth::VERSION.to_s and .== methods so you can puts and compare RedCloth::VERSION just like in previous RedCloth releases. #26
223
+
224
+ * Fixed HTML block ending tags terminating blocks prematurely. #22
225
+
226
+
227
+ === 4.0.1 / July 24, 2008
228
+
229
+ * Fixed lines starting with dashes being recognized as a definition list when there were no definitions.
230
+
231
+ * Created alias RedCloth.rb so Rails 2.1 gem dependency works on case-sensitive operating systems .
232
+ * Fixed parsing sentences that had two em dashes surrounded by spaces from becoming del phrases. #19
233
+
234
+ * Fixed links including prior quoted phrases. #17
235
+
236
+
237
+ === 4.0.0 / July 21, 2008
238
+
239
+ * New SuperRedCloth (RedCloth 4.0) is a total rewrite using Ragel for the parsing.
240
+
241
+ * Markdown support has been removed.
242
+
243
+ * Single newlines become <br> tags, just as in traditional RedCloth and other Textile parsers.
244
+
245
+ * 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.
246
+
247
+ * The restrictions parameter is observed just like previous versions (except :hard_breaks is now the default).
248
+
249
+ * 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.
250
+
251
+ * Custom block tags can be implemented as in the previous version, though the means of implementing them differs.
252
+
253
+ * HTML embedded in the Textile input does not often need to be escaped from Textile parsing.
254
+
255
+ * The parser will not wrap lines that begin with a space in paragraph tags.
256
+
257
+ * Rudimentary support for LaTeX is built in.
258
+
259
+ * RedCloth::VERSION on a line by itself inserts the version number into the output.
260
+
261
+ * Output (less newlines and tabs) is identical to Textile 2 except a few cases where the RedCloth way was preferable.
262
+
263
+ * Over 500 tests prevent regression
264
+
265
+ * 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 'https://rubygems.org'
2
+ gemspec
3
+
4
+ group :compilation do
5
+ gem 'rvm', '~> 1.2.6'
6
+ gem 'rake-compiler', '~> 0.7.1'
7
+ end
data/README.rdoc ADDED
@@ -0,0 +1,215 @@
1
+ = RedCloth - Textile parser for Ruby
2
+
3
+ Homepage:: http://redcloth.org
4
+ Author:: Jason Garber
5
+ Copyright:: (c) 2011 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
+ == RedCloth needs new maintainers
15
+
16
+ The {owner of this gem since 2007}[https://github.com/jgarber] is unable to
17
+ keep fixing bugs or work on the next major release, {RedCloth
18
+ 5}[https://github.com/jgarber/redcloth-parslet]. He's looking for one or more
19
+ developers who can:
20
+
21
+ <b>Current version</b>
22
+
23
+ * Fix any urgent {bugs}[http://jgarber.lighthouseapp.com/projects/13054-redcloth/overview] in RedCloth 4.x. You'll probably need to know Ragel and understand Ruby extensions in C and perhaps Java.
24
+ * Precompile the gem for Windows and JRuby or fix broken cross-compilation to automate the process
25
+ * Cut releases on the 4.x series.
26
+
27
+ <b>Future version</b>
28
+
29
+ * Complete {redcloth-parslet}[https://github.com/jgarber/redcloth-parslet], which will be a major release and replace this repository when finished. You need to understand the Parslet DSL, which can be learned in a couple hours.
30
+ * Meet or exceed the current level of unit and integration testing. Unit testing of the individual patterns makes it much easier to develop and maintain than the old parser.
31
+ * Release RedCloth 5.0 to much fanfare.
32
+
33
+ == Installing
34
+
35
+ RedCloth can be installed via RubyGems:
36
+
37
+ gem install RedCloth
38
+
39
+ It will install the appropriate Ruby, JRuby, or Win32 gem. If using JRuby,
40
+ version 1.1.5 or greater is required.
41
+
42
+ == Compiling
43
+
44
+ If you just want to use RedCloth, you do NOT need to build/compile it. It is
45
+ compiled from C sources automatically when you install the gem on the ruby
46
+ platform. Precompiled binary gems are provided for JRuby and Win32 platforms.
47
+
48
+ RedCloth can be compiled with <tt>rake compile</tt>. Ragel 6.3 or greater is
49
+ required. Again, Ragel is NOT needed to simply use RedCloth.
50
+
51
+ === Supported platforms
52
+
53
+ By default, the rake compile task builds a native C extension (MRI 1.8 or 1.9)
54
+ or Java extension (JRuby 1.3). A pure Ruby version can also be generated, but
55
+ it's super slow and Ruby 1.8-only. The JRuby and pure-Ruby extensions don't
56
+ support multi-byte characters. Cross-compiling for win32 uses rake-compiler.
57
+
58
+ The RedCloth::EXTENSION_LANGUAGE constant indicates in which language your
59
+ copy of RedCloth is compiled.
60
+
61
+ === Compiling gems
62
+
63
+ To compile MRI, JRuby, and win32 gems, you need rvm and rake-compiler. These
64
+ and other dependencies can be installed with bundler. Then rake build:all
65
+ takes care of compiling and packaging all gems.
66
+
67
+ 1. gem install bundler
68
+ 2. bundle install
69
+ 3. rake-compiler cross-ruby VERSION=1.8.6-p398
70
+ 4. rake-compiler cross-ruby VERSION=1.9.1-p243
71
+ 5. rake build:all
72
+
73
+ == Bugs
74
+
75
+ Please submit bugs to http://jgarber.lighthouseapp.com/projects/13054-redcloth/overview
76
+
77
+ == Using RedCloth
78
+
79
+ RedCloth is simply an extension of the String class that can handle
80
+ Textile formatting. Use it like a String and output HTML with its
81
+ RedCloth#to_html method.
82
+
83
+ Simple use:
84
+ text = "This is *my* text."
85
+ RedCloth.new(text).to_html
86
+
87
+ Multi-line example:
88
+
89
+ doc = RedCloth.new <<EOD
90
+ h2. Test document
91
+
92
+ Just a simple test.
93
+ EOD
94
+ puts doc.to_html
95
+
96
+
97
+ == What is Textile?
98
+
99
+ Textile is a simple formatting style for text
100
+ documents, loosely based on some HTML conventions.
101
+
102
+ == Sample Textile Text
103
+
104
+ h2. This is a title
105
+
106
+ h3. This is a subhead
107
+
108
+ This is a bit of paragraph.
109
+
110
+ bq. This is a blockquote.
111
+
112
+ = Writing Textile
113
+
114
+ A Textile document consists of paragraphs. Paragraphs
115
+ can be specially formatted by adding a small instruction
116
+ to the beginning of the paragraph.
117
+
118
+ h3. Header 3.
119
+ bq. Blockquote.
120
+ # Numeric list.
121
+ * Bulleted list.
122
+
123
+ == Quick Phrase Modifiers
124
+
125
+ Quick phrase modifiers are also included, to allow formatting
126
+ of small portions of text within a paragraph.
127
+
128
+ _emphasis_
129
+ __italicized__
130
+ *strong*
131
+ **bold**
132
+ ??citation??
133
+ -deleted text-
134
+ +inserted text+
135
+ ^superscript^
136
+ ~subscript~
137
+ @code@
138
+ %(classname)span%
139
+
140
+ ==notextile== (leave text alone)
141
+
142
+ == Links
143
+
144
+ To make a hypertext link, put the link text in "quotation
145
+ marks" followed immediately by a colon and the URL of the link.
146
+
147
+ Optional: text in (parentheses) following the link text,
148
+ but before the closing quotation mark, will become a title
149
+ attribute for the link, visible as a tool tip when a cursor is above it.
150
+
151
+ Example:
152
+
153
+ "This is a link (This is a title)":http://www.textism.com
154
+
155
+ Will become:
156
+
157
+ <a href="http://www.textism.com" title="This is a title">This is a link</a>
158
+
159
+ == Images
160
+
161
+ To insert an image, put the URL for the image inside exclamation marks.
162
+
163
+ Optional: text that immediately follows the URL in (parentheses) will
164
+ be used as the Alt text for the image. Images on the web should always
165
+ have descriptive Alt text for the benefit of readers using non-graphical
166
+ browsers.
167
+
168
+ Optional: place a colon followed by a URL immediately after the
169
+ closing ! to make the image into a link.
170
+
171
+ Example:
172
+
173
+ !http://www.textism.com/common/textist.gif(Textist)!
174
+
175
+ Will become:
176
+
177
+ <img src="http://www.textism.com/common/textist.gif" alt="Textist" />
178
+
179
+ With a link:
180
+
181
+ !/common/textist.gif(Textist)!:http://textism.com
182
+
183
+ Will become:
184
+
185
+ <a href="http://textism.com"><img src="/common/textist.gif" alt="Textist" /></a>
186
+
187
+ == Defining Acronyms
188
+
189
+ HTML allows authors to define acronyms via the tag. The definition appears as a
190
+ tool tip when a cursor hovers over the acronym. A crucial aid to clear writing,
191
+ this should be used at least once for each acronym in documents where they appear.
192
+
193
+ To quickly define an acronym in Textile, place the full text in (parentheses)
194
+ immediately following the acronym.
195
+
196
+ Example:
197
+
198
+ ACLU(American Civil Liberties Union)
199
+
200
+ Will become:
201
+
202
+ <acronym title="American Civil Liberties Union">ACLU</acronym>
203
+
204
+ == Adding Tables
205
+
206
+ In Textile, simple tables can be added by separating each column by
207
+ a pipe.
208
+
209
+ |a|simple|table|row|
210
+ |And|Another|table|row|
211
+
212
+ Styles are applied with curly braces.
213
+
214
+ table{border:1px solid black}.
215
+ {background:#ddd;color:red}. |a|red|row|
data/Rakefile ADDED
@@ -0,0 +1,18 @@
1
+ # encoding: utf-8
2
+ require 'rubygems'
3
+ require 'bundler'
4
+ ENV['RUBYOPT'] = nil # Necessary to prevent Bundler from *&^%$#ing up rake-compiler.
5
+
6
+ require 'rake/clean'
7
+
8
+ if File.directory? "ragel"
9
+ Bundler.setup
10
+ Bundler::GemHelper.install_tasks
11
+ Dir['tasks/**/*.rake'].each { |rake| load File.expand_path(rake) }
12
+ else
13
+ # Omit generation/compile tasks and dependencies. In a gem package
14
+ # we only need tasks and dependencies required for running specs.
15
+ Bundler.settings.without = [:compilation]
16
+ Bundler.setup(:default, :development)
17
+ load 'tasks/rspec.rake'
18
+ end
data/bin/redcloth ADDED
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env ruby
2
+ $:.unshift(File.dirname(__FILE__) + '/../lib/')
3
+ require 'optparse'
4
+ require 'redcloth'
5
+
6
+ if %w(--version -v).include? ARGV.first
7
+ puts "#{RedCloth::NAME} #{RedCloth::VERSION}"
8
+ exit(0)
9
+ end
10
+
11
+ output_as = "html"
12
+ opts = OptionParser.new do |opts|
13
+ opts.banner = "Usage: redcloth [options] [redcloth_formatted.txt]"
14
+ opts.separator "If no file specified, STDIN will be used. If you are typing input, you can send an EOF by pressing ^D (^Z on Windows)"
15
+ opts.separator ""
16
+ opts.on("-o", "--output STYLE", "Output format (defaults to #{output_as})") do |o|
17
+ output_as = o
18
+ end
19
+ end
20
+ opts.parse! ARGV
21
+
22
+ red = RedCloth.new( ARGF.read )
23
+ out_meth = "to_#{ output_as }"
24
+ if red.respond_to? out_meth
25
+ puts red.method( out_meth ).call
26
+ else
27
+ abort "** No to_#{ output_as } method found for the `#{ output_as }' format"
28
+ end