Diazo (software)

From Wikipedia, the free encyclopedia
Jump to: navigation, search
Diazo
Developer(s) Paul Everitt, Laurence Rowe and Martin Aspeli
Stable release 1.0rc4 / November 2, 2011; 2 years ago (2011-11-02)[1]
Preview release b477fc5 / February 26, 2012; 2 years ago (2012-02-26)[2]
Operating system Cross-platform
Platform Python
License New BSD
Website diazo.org

Diazo, previously named xdv, is a general-purpose, open source website theming tool. It is written in Python and generates XSLT. Diazo creates a separation between theme pages (static HTML) and transformation rules (Diazo's own domain specific language based in XML), allowing web designers to work on templates in plain HTML, without knowledge of XSLT or special template-related codes.

Diazo creates a themed site by using user-defined rules to combine vanilla content from a dynamic website together with a static HTML theme. The rules file (conventionally named rules.xml) has directives which, for example, may replace the contents of an HTML node in the theme with the contents of one in the content.

Web server support[edit]

The Diazo compiler generates XSLT, which can be deployed on any proxying web server with an XSLT processor such as Apache (using mod_transform), Varnish, or WSGI.

WSGI also has more direct Diazo support: the DiazoMiddleware filter will compile and cache Diazo themes on the fly.

Nginx has an XSLT processor,[3] but, as of March 2012, it requires the unthemed website (the content) to use strict XHTML. The strict requirement can be relaxed, however, if a patched version of Nginx is used.[4][5]

History and naming[edit]

Diazo was originally a reimplementation of an earlier software called Deliverance. Where Deliverance would do handle the HTML transformation in Python, Diazo generates XSLT which can then be used to defer the actual transformation to faster XSLT engines.

The name change to Diazo (from xdv) was announced at the Plone conference 2010. A major motivation for the name change was to reduce ambiguity, as the XDV name was used by both collective.xdv (a Plone-specific theming package, now called plone.app.theming) and by the stand alone XDV tools (now called Diazo). Also dv.xdvserver was renamed to DiazoMiddleware.

Diazo is based on DVNG, a prototype version of xdv. Diazo originally implemented only a subset of the features in Deliverance, but now has similar features, although their configuration language is not completely compatible. Diazo has become the defacto standard for theming in Plone 4 and is included in Plone 4.2 and later.

Directives[edit]

The basic directives of Diazo include: replace (replace a node or attribute in the theme with that from content), before and after (insert a node before or after another), drop (delete a node or attribute), strip (remove a tag but not its child nodes), merge, and copy.

A node, node's children or attribute, can be selected with either XPath selectors or CSS3 selectors. CSS selectors are replaced by the equivalent XPath selector during the pre-processing step of the compiler.

Advanced features include: conditions based on content nodes or paths, with grouping and nesting; multiple, conditional themes; modifying the theme or content on the fly; inline XSL directives; Doctype changes; XInclude protocol.

External links[edit]

References[edit]

  1. ^ https://pypi.python.org/pypi/diazo
  2. ^ https://github.com/plone/diazo/
  3. ^ http://wiki.nginx.org/HttpXsltModule
  4. ^ nginx-xslt-html-parser, Laurence Rowe
  5. ^ Nginx with html xslt support (html-xslt on Google code), patches Nginx 0.7.67 from 15 June 2010