Wikivert v0.3
Started: 2005-12-10 Updated: 2008-08-01
Language: PHP5
OS: Web
License: GPL
The objective of this is to convert Wiki markup into XHTML markup in very few lines of PHP code. The algorithm may not be the fastest out there, but once I was finally able to wrap my head around the concept (after 3 iterations) this is what I came up with.
A second objective is to make it easily adaptable for parsing other markup syntax. If you want to extend the markup syntax or change it entirely, you won't have to do much more than add a new Regular Expression pattern and its associated replacement HTML.
For more than a year I had used Pear's Wiki markup transformer called Text Wiki. It served me well, though it consists of more code than necessary (OO really inflates things). Thus, I decided to put myself through months of parsing algorithm pain, which has finally yielded working code.
Demo and Source
See it in action
View the source
Issues
- There might be some improper parsing issues when combining URLs with lists and other wiki elements. They'll be worked out over time.
Future
- Guidelines for transforming to markups other than XHTML
Want to Contribute?
If someone would like to work on syntax and renderings for nested lists or tables, feel free. Contact me for more information.
Files
01 Aug 2008
wikivert-0.3.tar.gz
wikivert-0.3.zip
Changelog
0.3
- ability for strikeout to contain a hyphen, underline text to contain an underscore, emphasis to contain a forward slash, strong to contain an asterisk
- "dont touch" block
Sample Syntax
Plain text
**Bold** //Emphasis// --Strikeout-- __Underline__Next paragraph of text
* List item * List item two
http://greaterscope.com(Sample link)
Rendered
Bold Emphasis Strikeout Underline
Next paragraph of text
- List item
- List item two
