README.rdoc in vigetlabs-acts_as_markup-1.2.1 vs README.rdoc in vigetlabs-acts_as_markup-1.3.0

- old
+ new

@@ -25,10 +25,17 @@ ActsAsMarkup.markdown_library = :bluecloth By default RDiscount will be used. +You can specify additional options to pass to the markup library by using +<tt>:markdown_options</tt>, <tt>:textile_options</tt> or <tt>:wikitext_options</tt>. +RDoc does not support any useful options. The options should be given as an +array of arguments. You can specify options for multiple languages when +allowing more than one. See each library's documentation for more details on +what options are available. + == EXAMPLES: ==== Using +acts_as_markdown+: class Post < ActiveRecrod @@ -94,10 +101,25 @@ @post.markup_language # => "markdown" @post.body.to_s # => "## Markdown Headline" @post.body.to_html # => "<h2> Markdown Headline</h2>" +==== Using options + + class Post < ActiveRecord + acts_as_markdown :body, :markdown_options => [ :filter_html ] + end + + class Post < ActiveRecord + acts_as_textile :body, :textile_options => [ [ :filter_html ] ] + end + + class Post < ActiveRecord + acts_as_wikitext :body, :wikitext_options => [ { :space_to_underscore => true } ] + end + + == REQUIREMENTS: You will need the RedCloth[http://whytheluckystiff.net/ruby/redcloth/] library for processing the Textile text, and the Wikitext[http://wikitext.rubyforge.org/] library for processing wikitext. @@ -136,10 +158,10 @@ 1. Add a "<tt>when</tt>" statement to the "<tt>case</tt>" statement in <tt>acts_as_markup</tt>. The "<tt>when</tt>" statement should match with a symbol that represents the language name in some way (e.g. "<tt>:markdown</tt>"). 2. In the "<tt>when</tt>" block you need to set the "<tt>klass</tt>" local variable and require the library and the extension file if you need one (use the special <tt>require_extensions</tt> method to require extensions). 3. Add the same lines you added to the previous "<tt>when</tt>" statement to the "<tt>:variable</tt>" "<tt>when</tt>" statement. But replace "<tt>klass</tt>" with "<tt>language_klass</tt>" (e.g. "<tt>markdown_klass</tt>"). 4. Add a relevant "<tt>when</tt>" statement to the <tt>class_eval</tt> block for the "<tt>:variable</tt>" language option. This should look something like: when /markdown/i - @#{col.to_s} = #{markdown_klass}.new(self['#{col.to_s}'].to_s) + markup_klasses[:markdown].new self[col].to_s 5. Add a convenience method (e.g. "<tt>acts_as_markdown</tt>") 6. Add an extension file to the "lib/acts_as_markup/exts/" directory if you need to modify the object in anyway. 7. Add appropriate tests (see current tests).