Xup is a lightweight Ruby DSL that allows you to programatically write almost any kind of document. Since it is pure Ruby, it’s blazing fast compared to other markup engines. It is also highly extensible and it is designed specifically in that way.
Xup provides two default engines to write HTML and YAML documents, but you can easily write your own ones.