recipe-site/_includes/fractionalise.html

14 lines
466 B
HTML

{%- assign decimal = input | split: "." | last -%}
{%- assign output = input -%}
{%- assign item_split = input | split: "" -%}
{%- if item_split contains "." -%}
{%- if site.fractions contains decimal -%}
{%- assign prefix = input | split: "." | first -%}
{%- if prefix == "0" -%}
{%- assign output = site.fractions[decimal] -%}
{%- else -%}
{%- assign output = prefix | append: site.fractions[decimal] -%}
{%- endif -%}
{%- endif -%}
{%- endif -%}