We have cleaned up unknown link (the markup language used to create articles in Zena) to make it more testable and easier to expand. In the process, we added support for pretty code.
For example, this would be an addition to zazen to display “hello world!” each time someone types “hello” :
Zazen::Parser.add_rule( /hello/ ) do
"hello world!"
end
Another silly example would be to underline every word starting with a capital letter:
Zazen::Parser.add_rule( /([A-Z]+\w*)/ ) do |parser|
"<span style='text-decoration:underline;'>#{parser[0]}</span>"
end
And when you need to render crazy stuff pumped from the database and using partials, you start to wonder “how do I access the calling context ?” Use the ‘helper’ :
Zazen::Parser.add_rule( /TOC/ ) do |parser|
parser.helper.make_toc
end
That’s it for now !
Gaspard Bucher