Style and tricks

This is the documentation for 1.5.1 version, which is not the latest version. Consider upgrading to 2.0.0.

Missing space

Sometimes it looks like Pug forgets to add a space where it should, especially when using conditions. You end up with concatenated words. This is a known topic. See https://pugjs.org/language/plain-text.html: Whitespace Control section. You should use an empty piped line (a pipe with either spaces or nothing after it) to force a space in the output.

  |
  | bla
  |

Horizontal ellipsis ( and …​)

Three dots (…​) are automatically transformed into . You can also put directly in your mixins.

Capitalization is not automatic after because it is not systematic:

The first word after an ellipsis is capitalized if it begins a new grammatical sentence.

— Chicago Manual of Style 13.51

When assembling, knowing which elements are empty

When you list elements, it is sometimes (but very rarely) useful to be able to know which elements are empty and which are not.

The list of the non empty elements:

  • is sent to separators, when they are mixins and take an object parameter (see exemple)

  • is made available in listInfo.nonEmpty in the itemz > item structure

will output either first, second and also third or first and second depending on WITH_3 flag.

  • When in a a eachz structure, elements are objects, while when in an itemz > item structure, elements are integers.

  • When you read listInfo.nonEmpty or params.nonEmpty, it can be undefined: this happens when RosaeNLG is actually testing if the elements are empty or not. RosaeNLG will make a second call with xxx.nonEmpty properly populated. Thus just test and ignore if undefined.