See also RubyForge MediaCloth page
MediaCloth is the first MediaWiki parser written in Ruby. MediaCloth is also the first true MediaWiki parser which has handwritten lexer, LALR parser, AST builder, walker and HTML generator.
MediaCloth is still in the early stages in development but it already has some capabilities working.
For example, the text
This is some text with '''bold''' and ''italic'' formating. The list is also here: * List Item 1 ** Sub list item 1 ** Sub list item 2 * List Item 2 The end ----will be transformed by MediaCloth parser and HTML generator into:
MediaCloth 0.0.1
This release is available as gem package:
gem install mediaclothLook through our download page for more files.
It's also possible to download it from SVN directly and try:
Get recent SVN snapshot
Anonymous SVN instructions
require 'mediacloth'
puts MediaCloth::wiki_to_html(input)
This is equivalent for
require 'mediacloth'
parser = MediaWikiParser.new
parser.lexer = MediaWikiLexer.new
ast = parser.parse(input)
generator = MediaWikiHTMLGenerator.new
generator.parse(ast)
puts generator.html
Look into the complete API reference for more information