sweet-potator 0.5.0

Static recipe site generator
Documentation
{% macro ingredient(ingredient) %}
  {%- set quantity = ingredient.quantity -%}
  <span class="quantity">
    {%- if quantity is object -%}
      <span class="value">
        {%- set value = quantity.value %}
        {%- if value.decimal is defined -%}
          {{ value.decimal.int }}.{{ value.decimal.frac }}
        {%- elif value.fraction is defined -%}
          {{ value.fraction.numer }}&frasl;{{ value.fraction.denom }}
        {%- else -%}
          {{ value.integer }}
        {%- endif -%}
      </span>
      {%- if quantity.unit is string -%}
        {{ " " }}<span class="unit">{{ quantity.unit }}</span>
      {%- endif -%}
    {%- endif -%}
  </span>{{ lf -}}
  <span class="name">{{ lf -}}
    <span class="base">{{ ingredient.name }}</span>
    {%- if ingredient.kind is string -%}
      , <span class="kind">{{ ingredient.kind }}</span>
    {%- endif %}
    {%- if quantity is object and quantity.note is string -%}
      {{ " ("}}<span class="note">{{ quantity.note }}</span>)
    {%- endif -%}
  </span>
{% endmacro ingredient %}