Shopify/liquid — pull request #78 by meineerde (2011-10-17 19:51:22+00:00)
Title: More extensible include

This pull request make the bundled include tag more modular to allow other implementations with complex more template concepts to hook into it.

My specific use-case here is the introduction of Liquid into ChiliProject (a Redmine fork). We want to use the liquid include to include wiki pages. The templates here are ActiveRecord models. As an additional challenge, the templates are also required to be parsed with Textile. Our basic rendering pipeline goes like

Text ~> Liquid parser ~> Textile parser ~> HTML

During the inclusion phase, we need to make sure that the context is updated with the correct, well, context. E.g. we need to render each page with the correct project drop in the context, as we allow cross-project includes and need to properly resolve the targets of sub-includes.

See the full example at https://github.com/meineerde/chiliproject/blob/issues/unstable/604-liquid/lib/chili_project/liquid/tags/include.rb