title: Is defined in twig ternary
body: <p>Consider <code>{{ item.nw is defined and item.nw ? ' target="_blank"' }}</code> in the below script.  Is there a more concise way to do this?</p>
  
  <p>I thought <code>{{ item.nw ?? ' target="_blank"' }}</code> might work but it returns <code>item.nw</code> if <code>item.nw</code> is not <code>false</code> and <code>target="_blank"'</code> if <code>item.nw</code> is <code>false</code> (reference <a href="https://twig.symfony.com/doc/2.x/templates.html#test-operator" rel="noreferrer">https://twig.symfony.com/doc/2.x/templates.html#test-operator</a>)</p>
  
  <pre><code>{% macro menu(menu,active) %}
  {# menu is an associated array of containing:
  name.  required
  path or id: One of the two are required.  If both, URL will use path
  path.  optional and defaults to javascript:void(0)
  id.  optional and defaults to not adding an id to the item.
  nw.  optional and defalts to false.  This is a flag for a new window.
  class.  optional and defaults to not adding an class to the item.
  #}
  {% for item in menu %}
  {% set path = item.path is defined?item.path:"javascript:void(0)" %}
  {% set id = item.id is defined?item.id:null %}
  {% set class = item.class is defined?item.class:"" %}
  {% if (path == active or id == active) %}
  {% set class = class~' active ' %}
  {% endif%}
  {% if loop.first %}
  {% set class = class~' first ' %}
  {% elseif loop.last %}
  {% set class = class~' last ' %}
  {% endif %}
  &lt;li class="{{ class|trim }}"&gt;
      &lt;a href="{{ path }}"{{ item.nw is defined and item.nw ? ' target="_blank"' }}{{ id?"id=#{id}" }}&gt;{{item.name}}&lt;/a&gt;
  &lt;/li&gt;
  {% endfor %}
  {% endmacro %}
  </code></pre>