Skip to main content

Each Tag

Learn how to write Yumdocs templates with each tags.

Tip

Make sure you understand expressions before experimenting with each tags.

About the Playground

The examples below are live to allow you to experiment. Most limitations come from the fact that the web editor for input.docx has few capabilities compared to Microsoft Word. But note that you can download input.docx, improve layouts in Word and run yumdocs input.docx data.json output.docx in a terminal window as explained in our CLI Tutorial.

The each tag is a statement (or instruction) followed by an array between delimiters {{ and }}, i.e. {{#each <array>}}. In Yumdocs, statements are prefixed with a hash #, unless configured otherwise. The array is a actually an expression which value is an array. The #each tag is an opening tag, which requires a closing tag, i.e. {{#endeach}}. Yumdocs repeats the content between the opening tag and the closing tag for each item in the array.

In the following example, organization.members is an array of three persons and the expression {{firstName + " " + lastName}} is repeated for each person.

Loading...