{#
/**
 * @file
 * Default template for the 'plain' address formatter.
 *
 * Available variables:
 *   - recipient: Recipient.
 *   - organization: Organization.
 *   - address_line1: First address line.
 *   - address_line2: Second address line.
 *   - postal_code: Postal code.
 *   - sorting_code: Sorting code.
 *   - dependent_locality: The dependent locality.
 *     - dependent_locality.code: Dependent locality code.
 *     - dependent_locality.name: Dependent locality name.
 *   - locality: The locality subdivision.
 *     - locality.code: Locality code.
 *     - locality.name: Locality name.
 *   - administrative_area: The administrative area subdivision.
 *     - administrative_area.code: Administrative area code.
 *     - administrative_area.name: Administrative area name.
 *   - country: The country.
 *     - country.code: Country code.
 *     - country.name: Country name.
 *
 * if a subdivision (dependent_locality, locality, administrative_area) was
 * entered, the array will always have a name. If it's a predefined subdivision,
 * it will also have a code (e.g. 'CA' for California), which is preferred.
 *
 * @ingroup themeable
 */
#}

{% if recipient %}
  {{- recipient -}},
{% endif %}

{% if organization %}
  {{- organization -}},
{% endif %}

{% if address_line1 %}
  {{- address_line1 -}},
{% endif %}

{% if address_line2 %}
  {{- address_line2 -}},
{% endif %}

{% if dependent_locality.name %}
  {{- dependent_locality.code ?: dependent_locality.name -}},
{% endif %}

{% if locality.name %}
  {{- locality.name -}},
{% elseif locality.code %}
  {{- locality.code -}},
{% elseif locality is not iterable %}
  {{- locality -}},
{% endif %}

{% if postal_code %}
  {{ postal_code }},
{% endif %}

{% if administrative_area.name %}
  {{ administrative_area.code ?: administrative_area.name -}},
{% endif %}

{{- country.name -}}
