Presentation Pattern Catalog

release: $Release$

2   Deletion

2-1   Delete Element Pattern

2-1-1   Description

If presentation logic is empty, the element is not printed out. This pattern is named 'Delete Element Pattern' or 'Dummy Element Pattern.'

2-1-2   Situation

This pattern enables you to delete dummy element in presentation data.

2-1-3   Example Code

Presentation Data:
<ul>
  <li>foo</li>
  <li id="dummy">bar</li>
</ul>
Presentation Logic:
/* delete dummy element */
#dummy {
  logic: {
  }
}
Output Script:
<ul>
  <li>foo</li>
</ul>

2-1-4   Supplement

Kwartz directive 'id="dummy:str"' lets you to use this pattern without presentation logic file.

Presentation Data:
<ul>
  <li>foo</li>
  <li id="dummy:d1">bar</li>
</ul>

2-2   Delete Tag Pattern

2-2-1   Description

If you use only _cont and don't use _stag and _cont, you can remove start and end tags of the element. This pattern is named 'Delete Tag Pattern' or 'Dummy Tag Pattern.'

2-2-2   Situation

This pattern is very useful if you want to print tags according to condition.

2-2-3   Example Code

Presentation Data:
<a href="..." id="mark:next">Next</a>
Presentation Logic:
/* delete tags when url is empty */
#next {
  attrs:  "href" url;
  logic: {
    if !url || url.empty?
      _cont
    else
      _stag
      _cont
      _etag
    end
  }
}
Output Script:
<%     if !url || url.empty? %>
Next<%     else %>
<a href="<%= url %>">Next</a>
<%     end %>