Control blank links in conditional content

Conditional Sections covered how to add or remove content from the final document.

When a conditional section returns false and content is removed, there is sometimes a blank line left behind.

Blank lines can be controlled by changing the way you lay out the conditional sections in your templates.

Important: To understand these examples, turn on the hidden characters within your editor to reveal where the paragraph markers  are located in your template.

Controlling the appearance of blank lines

The examples below use conditions sections that will always evaluate as either true or false, but they could equally be <<cs_ statements that are controlled by data.

Example 1

The first example illustrates a single line version of a conditional section.

Because <<cs_true>> returns true, the relevant text will appear.

The <<cs_false>> returns false, and a blank line remains even though the text is removed.

When the <<cs_ and <<es_ fields are on the same line, Docmosis will include or remove everything between the fields.

Because the paragraph marker is outside the fields, it will always remain in the final document which causes the blank line.

blankLineRemains

Example 2

This three line version leaves no blank line when the conditional statement returns false.

When a <<cs_ or <<es_ appears on a line of its own, Docmosis will completely remove the line including the trailing paragraph marker.

The relevant line between the <<cs_ and <<es_ is on its own line.  Docmosis will include or remove everything between the fields.

Because the paragraph marker is between the fields, it will also be included or removed.

blankLineRemoved

Using conditional sections in numbered/bulleted lists

The following example reinforces the need to place <<cs_ and <<es_ on lines of their own when used within either bulleted or numbered lists.

Example 3

The <<cs_ and <<es_ should not be part of the list itself.

 

Correct Example

 

Incorrect Example

Summary

To avoid unwanted blank lines:

  1. Make sure the <<cs_ and <<es_ are on lines of their own ending in paragraph markers. There should be no trailing spaces after the paragraph markers.
  2. Keep conditional text on separate lines as “paragraphs” ending in paragraph markers. Do not use line breaks ↵ at the end of the text.

Feedback

Invalid Input

Sorry, this field will only accept letters and numbers, and not special characters, to limit spam. Please also consider contacting support@docmosis.com if you need help with this article.

Sorry, this field will only accept letters and numbers, and not special characters, to limit spam.

Invalid Input