Pug & Why pug

This is the documentation for 3.0.3 version, which is not the latest version. Consider upgrading to 4.3.1.

A classic templating engine is a good basis to build a NLG system (at least for template-based NLG systems). It brings the ability to easily build html/xml structures, which is handy even when doing NLG, and brings out of the box features like conditions, switch/case etc. which are essential too in a NLG system.

Pug is a templating engine designed for node or browser execution. It is fast, robust and feature-rich - and I like the syntax.

Thus RosaeNLG is based on pug.

RosaeNLG templates are basically pug templates where you use RosaeNLG structures and mixins to complete the standard pug syntax.

RosaeNLG templates make a heavy use of those pug structures:

  • if / else

  • case / when

  • mixins

  • inline JavaScript (with -)

Also, there is generally not that much html/xml structure in NLG templates; texts are rather produced as a flow, which means that a you RosaeNLG templates will make a heavy use of | and often look like that:

  | #[+callAMixin] bla
  | some text
  | #[+callAnotherMixin] etc.

Some nice pug documentation: