README.textile
October 23, 2013 ยท View on GitHub
h1. WikiCloth "!https://api.travis-ci.org/nricciar/wikicloth.png!":https://travis-ci.org/nricciar/wikicloth
Ruby implementation of the MediaWiki markup language.
h2. Supports
- Variables, Templates {{ ... }}
- Links ** External Links [ ... ] ** Internal Links, Images [[ ... ]]
- Markup
** == Headings ==
** Lists (*#;:)
** bold (
'''), italic ('') or both (''''') ** Horizontal rule (----) ** "Tables":https://github.com/nricciar/wikicloth/wiki/Tables ** Table of Contents [NOTOC, FORCETOC, TOC] ,, (disable wiki markup)andsupport- "html sanitization":https://github.com/nricciar/wikicloth/wiki/Html-Sanitization
For more information about the MediaWiki markup see "https://www.mediawiki.org/wiki/Markup_spec":https://www.mediawiki.org/wiki/Markup_spec
h2. Install
git clone git://github.com/nricciar/wikicloth.git
cd wikicloth/
rake install
h2. Usage
@wiki = WikiCloth::Parser.new({
:data => "{{test}} ''Hello {{test}}!''\n",
:params => { "test" => "World" } })
@wiki.to_html => "{{test}} Hello World!
"
h2. 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
template do |template|
"Hello {{{1}}}" if template == "hello"
end
external_link do |url,text|
"#{text.blank? ? url : text}"
end
end
@wiki = WikiParser.new({
:params => { "PAGENAME" => "Testing123" },
:data => "{{hello|world}} From {{ PAGENAME }} -- [www.google.com]";
})
@wiki.to_html =>
Hello world From Testing123 -- http://www.google.com