Filter functions

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

Filtering is used to clean the text after generation, adding caps and removing extra punctuation. It is regexp based and will have as an input a string, previously generated by Pug.

The filtering mechanism is called automatically.

Protect sections from being filtered

Filtering is nice because it will automatically manage capitalization etc. for you. But sometimes you want to disable this mechanim for some sections: Baba Inc. is a nice company instead of Baba Inc. Is a nice company.

Use the protectString(string) js function to protect your strings from begin filtered:

will output protected.string (and not protected. String).

You should favor the protect tag which better cares for spacing.

Use the protect tag to protect structures:

will output the same.

Special characters

§ and ¤ are special characters and must just not be used in your texts:

  • § is used to mark protected sections (§…​§ marks a section) before filtering.

  • ¤ is a space automatically inserted by RosaeNLG. The filtering mechanism needs to distinguish which spaces are natural from the automatic ones, especially in the protected sections.

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