String
Accessors for setting security restrictions.
This is a nice thing if you're using RedCloth for formatting in public places (e.g. Wikis) where you don't want users to abuse HTML for bad things.
If :filter_html is set, HTML which wasn't created by the Textile processor will be escaped. Alternatively, if :sanitize_html is set, HTML can pass through the Textile processor but unauthorized tags and attributes will be removed.
If :filter_styles is set, it will also disable the style markup specifier. ('{color: red}')
If :filter_classes is set, it will also disable class attributes. ('!(classname)image!')
If :filter_ids is set, it will also disable id attributes. ('!(classnameid)image!')
Accessors for setting security restrictions.
This is a nice thing if you're using RedCloth for formatting in public places (e.g. Wikis) where you don't want users to abuse HTML for bad things.
If :filter_html is set, HTML which wasn't created by the Textile processor will be escaped. Alternatively, if :sanitize_html is set, HTML can pass through the Textile processor but unauthorized tags and attributes will be removed.
If :filter_styles is set, it will also disable the style markup specifier. ('{color: red}')
If :filter_classes is set, it will also disable class attributes. ('!(classname)image!')
If :filter_ids is set, it will also disable id attributes. ('!(classnameid)image!')
Accessors for setting security restrictions.
This is a nice thing if you're using RedCloth for formatting in public places (e.g. Wikis) where you don't want users to abuse HTML for bad things.
If :filter_html is set, HTML which wasn't created by the Textile processor will be escaped. Alternatively, if :sanitize_html is set, HTML can pass through the Textile processor but unauthorized tags and attributes will be removed.
If :filter_styles is set, it will also disable the style markup specifier. ('{color: red}')
If :filter_classes is set, it will also disable class attributes. ('!(classname)image!')
If :filter_ids is set, it will also disable id attributes. ('!(classnameid)image!')
Accessors for setting security restrictions.
This is a nice thing if you're using RedCloth for formatting in public places (e.g. Wikis) where you don't want users to abuse HTML for bad things.
If :filter_html is set, HTML which wasn't created by the Textile processor will be escaped. Alternatively, if :sanitize_html is set, HTML can pass through the Textile processor but unauthorized tags and attributes will be removed.
If :filter_styles is set, it will also disable the style markup specifier. ('{color: red}')
If :filter_classes is set, it will also disable class attributes. ('!(classname)image!')
If :filter_ids is set, it will also disable id attributes. ('!(classnameid)image!')
Deprecated accessor for toggling hard breaks.
Traditional RedCloth converted single newlines to HTML break tags, but later versions required :hard_breaks be set to enable this behavior. :hard_breaks is once again the default.
Accessor for toggling lite mode.
In lite mode, block-level rules are ignored. This means that tables, paragraphs, lists, and such aren't available. Only the inline markup for bold, italics, entities and so on.
r = RedCloth.new( "And then? She *fell*!", [:lite_mode] ) r.to_html #=> "And then? She <strong>fell</strong>!"
Accessor for toggling span caps.
Textile places `span' tags around capitalized words by default, but this wreaks havoc on Wikis. If :no_span_caps is set, this will be suppressed.
Accessors for setting security restrictions.
This is a nice thing if you're using RedCloth for formatting in public places (e.g. Wikis) where you don't want users to abuse HTML for bad things.
If :filter_html is set, HTML which wasn't created by the Textile processor will be escaped. Alternatively, if :sanitize_html is set, HTML can pass through the Textile processor but unauthorized tags and attributes will be removed.
If :filter_styles is set, it will also disable the style markup specifier. ('{color: red}')
If :filter_classes is set, it will also disable class attributes. ('!(classname)image!')
If :filter_ids is set, it will also disable id attributes. ('!(classnameid)image!')
Returns a new RedCloth object, based on string, observing any restrictions specified.
r = RedCloth.new( "h1. A *bold* man" ) #=> "h1. A *bold* man" r.to_html #=>"<h1>A <b>bold</b> man</h1>"
# File lib/redcloth/textile_doc.rb, line 67 def initialize( string, restrictions = [] ) restrictions.each { |r| method("#{r}=").call( true ) } super( string ) end
Converts special characters into HTML entities.
static VALUE redcloth_html_esc(int argc, VALUE* argv, VALUE self)
Converts special characters into LaTeX entities.
static VALUE
redcloth_latex_esc(VALUE self, VALUE str)
{
VALUE new_str = STR_NEW2("");
if (str == Qnil)
return new_str;
StringValue(str);
if (RSTRING_LEN(str) == 0)
return new_str;
char *ts = RSTRING_PTR(str), *te = RSTRING_PTR(str) + RSTRING_LEN(str);
char *t = ts, *t2 = ts;
const char *ch = NULL;
if (te <= ts) return Qnil;
while (t2 < te) {
ch = NULL;
switch (*t2)
{
case '{': ch = "#123"; break;
case '}': ch = "#125"; break;
case '\\': ch = "#92"; break;
case '#': ch = "#35"; break;
case '$': ch = "#36"; break;
case '%': ch = "#37"; break;
case '&': ch = "amp"; break;
case '_': ch = "#95"; break;
case '^': ch = "circ"; break;
case '~': ch = "tilde"; break;
case '<': ch = "lt"; break;
case '>': ch = "gt"; break;
case '\n': ch = "#10"; break;
}
if (ch != NULL)
{
if (t2 > t)
rb_str_cat(new_str, t, t2-t);
VALUE opts = rb_hash_new();
rb_hash_aset(opts, ID2SYM(rb_intern("text")), STR_NEW2(ch));
rb_str_concat(new_str, rb_funcall(self, rb_intern("entity"), 1, opts));
t = t2 + 1;
}
t2++;
}
if (t2 > t)
rb_str_cat(new_str, t, t2-t);
return new_str;
}
Transforms a Textile document with formatter
static VALUE
redcloth_to(self, formatter)
VALUE self, formatter;
{
rb_funcall(self, rb_intern("delete!"), 1, STR_NEW2("\r"));
VALUE working_copy = rb_obj_clone(self);
rb_extend_object(working_copy, formatter);
if (rb_funcall(working_copy, rb_intern("lite_mode"), 0) == Qtrue) {
return redcloth_inline2(working_copy, self, rb_hash_new());
} else {
return redcloth_transform2(working_copy, self);
}
}
Generated with the Darkfish Rdoc Generator 2.