[ANN] RedCloth 2.0.5 -- A Textile Humane Web Text Generator

  • Thread starter why the lucky stiff
  • Start date
W

why the lucky stiff

from a smoking kite on its way down:

RedCloth 2.0.5. Available in RAA.
http://rubyforge.org/frs/download.php/514/redcloth-2.0.5.tar.gz

RedCloth is a module for using Textile in Ruby. Textile is a text
format. A very simple text format. Another stab at making readable
text that can be converted to HTML.

This release contains numerous new features which make RedCloth better
suited to wikis (such as the gorgeous Instiki product). This version
introduces a safe mode, which can filter out html and/or css from
incoming Textile documents. You can turn on this feature either by
passing in the restrictions to RedCloth:

textile = "h2{color: red}. Test <b>document</b>" +
"<notextile></notextile>\n<b>"
restrictions = [:filter_html, :filter_styles]

RedCloth.new(textile, restrictions).to_html
# => "<h2>Test &lt;b&gt;document&lt;/b&gt; <br />\n&lt;b&gt;</h2>"

Alternatively, you can set the restrictions through accessors to your
RedCloth instance.

textile = "h2{color: red}. Test <b>document</b>" +
"<notextile></notextile>\n<b>"

r = RedCloth.new(textile)
r.filter_html = true
r.filter_styles = true
# => "<h2>Test &lt;b&gt;document&lt;/b&gt; <br />\n&lt;b&gt;</h2>"

Thanks to Florian Gross for this marvelous patch!

This version also features line folding, as suggested by Jim Menard.
Line folding allows RedCloth to treat lines with a single newline
between them as a complete sentence. Blank lines are then treated as
paragraph breaks.

An example:

r = RedCloth.new( <<RED )
RedCloth is a module for using Textile in Ruby.
Textile is a text format. A very simple text
format. Another stab at making readable text that
can be converted to HTML.

This release contains numerous new features which
make RedCloth better suited to Wikis (such as the
gorgeous Instiki product).
RED

r.fold_lines = true
r.to_html
# => "<p>RedCloth is a module for using Textile
in Ruby. Textile is a text format. A very
simple text format. Another stab at
making readable text that can be converted
to <span class=\"caps\">HTML</span>.
</p>\n\n\t<p>This release contains numerous
new features which make RedCloth better
suited to Wikis (such as the gorgeous
Instiki product). </p>"

Jim sent in a number of bugfixes as well:

* Problem with em-dashes at the start of blocks.
* Footnotes were broken.

Many *starches*, Jim! And everyone who has bugged me about docs:
thankyou. I'm on it.

_why
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,233
Members
46,820
Latest member
GilbertoA5

Latest Threads

Top