replace common decimals (.2, .3, etc) with fraction equivalents
This commit is contained in:
parent
e36d23cb96
commit
1a3d058afc
4 changed files with 40 additions and 2 deletions
12
_config.yml
12
_config.yml
|
@ -17,3 +17,15 @@ collections:
|
||||||
permalink: "/:collection/:name"
|
permalink: "/:collection/:name"
|
||||||
|
|
||||||
recipes_per_page: 15
|
recipes_per_page: 15
|
||||||
|
|
||||||
|
fractions:
|
||||||
|
"1": "⅒"
|
||||||
|
"125": "⅛"
|
||||||
|
"2": "⅕"
|
||||||
|
"25": "¼"
|
||||||
|
"3": "⅓"
|
||||||
|
"4": "⅖"
|
||||||
|
"5": "½"
|
||||||
|
"6": "⅗"
|
||||||
|
"75": "¾"
|
||||||
|
"8": "⅘"
|
||||||
|
|
14
_includes/fractionalise.html
Normal file
14
_includes/fractionalise.html
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{%- 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 -%}
|
|
@ -10,10 +10,21 @@
|
||||||
{%- assign tag = tag | append: " class='optional'" -%}
|
{%- assign tag = tag | append: " class='optional'" -%}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
|
||||||
{%- assign amount = item[0] | append: " " -%}
|
{%- assign input = item[0] -%}
|
||||||
|
{%- include fractionalise.html -%}
|
||||||
|
|
||||||
|
{%- assign amount = output | append: " " -%}
|
||||||
{%- assign end = "" -%}
|
{%- assign end = "" -%}
|
||||||
{%- if item[0][0] -%}
|
{%- if item[0][0] -%}
|
||||||
{%- assign amount = item[0][0] | append: " to " | append: item[0][1] | append: " " -%}
|
{%- assign input = item[0][0] -%}
|
||||||
|
{%- include fractionalise.html -%}
|
||||||
|
{%- assign from = output -%}
|
||||||
|
|
||||||
|
{%- assign input = item[0][1] -%}
|
||||||
|
{%- include fractionalise.html -%}
|
||||||
|
{%- assign to = output -%}
|
||||||
|
|
||||||
|
{%- assign amount = from | append: " to " | append: to | append: " " -%}
|
||||||
{%- elsif item[0] == 0 -%}
|
{%- elsif item[0] == 0 -%}
|
||||||
{%- assign amount = "" -%}
|
{%- assign amount = "" -%}
|
||||||
{%- assign end = " to taste" -%}
|
{%- assign end = " to taste" -%}
|
||||||
|
|
|
@ -11,6 +11,7 @@ body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
#main {
|
#main {
|
||||||
|
width: 80%;
|
||||||
max-width: 1500px;
|
max-width: 1500px;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
|
|
Loading…
Reference in a new issue