Sha256: 62f795a675e6e5752402659f5a5cb85a624a9e0b78cd18bf628433a838145ab1
Contents?: true
Size: 1.95 KB
Versions: 2
Compression:
Stored size: 1.95 KB
Contents
Ruby implementation of the MediaWiki markup language. Supports --------------------------------------------------- * Variables, Templates {{ ... }} * Links o External Links [ ... ] o Internal Links, Images [[ ... ]] + (see also pipe trick) * Wikimedia Markup o == Headings == o Lists (*#;:) o bold ('''), italic ('') or both (''''') o Horizontal rule (----) o Tables o Table of Contents [__NOTOC__, __FORCETOC__, __TOC__] * <code>,<nowiki>,<pre> (disable wiki markup) o space at the beginning of a line (<pre>) * <ref> and <references/> support * html sanitization Install --------------------------------------------------- git clone git://github.com/nricciar/wikicloth.git cd wikicloth/ rake gem sudo gem install pkg/wikicloth-0.5.0.gem Usage --------------------------------------------------- @wiki = WikiCloth::Parser.new({ :data => "<nowiki>{{test}}</nowiki> ''Hello {{test}}!''\n", :params => { "test" => "World" } }) @wiki.to_html => "<p>{{test}} <i>Hello World!</i></p>" Advanced Usage --------------------------------------------------- Most features of WikiCloth can be overriden as needed... class WikiParser < WikiCloth::Parser url_for do |page| "javascript:alert('You clicked on: #{page}');" end link_attributes_for do |page| { :href => url_for(page) } end include_resource do |resource,options| case resource when "date" Time.now.to_s else params[resource] unless params[resource].nil? end end end @wiki = WikiParser.new({ :params => { "PAGENAME" => "Testing123" }, :data => "[[ Hello World ]] From {{ PAGENAME }} on {{ date }}\n" }) @wiki.to_html => <p> <a href="javascript:alert('You clicked on: Hello World');">Hello World</a> From Testing123 on Wed Jul 08 22:23:44 -0400 2009 </p>
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
wikicloth-0.6.1 | README |
wikicloth-0.6.0 | README |