Compare commits

...

3 Commits

9 changed files with 47 additions and 81 deletions

View File

@ -5,4 +5,3 @@ pipeline:
- gem install bundler
- bundle install --jobs=4
- bundle exec jekyll build
- bundle exec htmlproofer ./_site --disable-external

1
.gitignore vendored
View File

@ -5,3 +5,4 @@ _subrecipes
.jekyll-cache
.jekyll-metadata
vendor
.bundle/

View File

@ -7,10 +7,7 @@ source "https://rubygems.org"
#
# This will help ensure the proper Jekyll version is running.
# Happy Jekylling!
# gem "jekyll", "~> 4.0.0"
gem "nokogiri", ">= 1.11.0.rc1"
gem "jekyll", github: "jekyll/jekyll"
gem "html-proofer"
gem "jekyll", "~> 4.0.0"
# This is the default theme for new Jekyll sites. You may change this to anything you like.
# gem "minima", "~> 2.5"
# If you want to use GitHub Pages, remove the "gem "jekyll"" above and

View File

@ -1,23 +1,3 @@
GIT
remote: https://github.com/jekyll/jekyll.git
revision: ab6ef0b257e4c7aafec0518d93bea3e9c4b75b75
specs:
jekyll (4.0.0)
addressable (~> 2.4)
colorator (~> 1.0)
em-websocket (~> 0.5)
i18n (>= 0.9.5, < 2)
jekyll-sass-converter (~> 2.0)
jekyll-watch (~> 2.0)
kramdown (~> 2.1)
kramdown-parser-gfm (~> 1.0)
liquid (~> 4.0)
mercenary (~> 0.4.0)
pathutil (~> 0.9)
rouge (~> 3.0)
safe_yaml (~> 1.0)
terminal-table (~> 1.8)
GEM
remote: https://rubygems.org/
specs:
@ -28,22 +8,27 @@ GEM
em-websocket (0.5.1)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
ethon (0.12.0)
ffi (>= 1.3.0)
eventmachine (1.2.7)
ffi (1.12.2)
forwardable-extended (2.6.0)
html-proofer (3.15.1)
addressable (~> 2.3)
mercenary (~> 0.3)
nokogumbo (~> 2.0)
parallel (~> 1.3)
rainbow (~> 3.0)
typhoeus (~> 1.3)
yell (~> 2.0)
http_parser.rb (0.6.0)
i18n (1.8.2)
concurrent-ruby (~> 1.0)
jekyll (4.0.0)
addressable (~> 2.4)
colorator (~> 1.0)
em-websocket (~> 0.5)
i18n (>= 0.9.5, < 2)
jekyll-sass-converter (~> 2.0)
jekyll-watch (~> 2.0)
kramdown (~> 2.1)
kramdown-parser-gfm (~> 1.0)
liquid (~> 4.0)
mercenary (~> 0.3.3)
pathutil (~> 0.9)
rouge (~> 3.0)
safe_yaml (~> 1.0)
terminal-table (~> 1.8)
jekyll-sass-converter (2.1.0)
sassc (> 2.0.1, < 3.0)
jekyll-watch (2.2.1)
@ -55,17 +40,10 @@ GEM
listen (3.2.1)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
mercenary (0.4.0)
mini_portile2 (2.4.0)
nokogiri (1.11.0.rc1)
mini_portile2 (~> 2.4.0)
nokogumbo (2.0.2)
nokogiri (~> 1.8, >= 1.8.4)
parallel (1.19.1)
mercenary (0.3.6)
pathutil (0.16.2)
forwardable-extended (~> 2.6)
public_suffix (4.0.3)
rainbow (3.0.0)
rb-fsevent (0.10.3)
rb-inotify (0.10.1)
ffi (~> 1.0)
@ -76,23 +54,18 @@ GEM
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
thread_safe (0.3.6)
typhoeus (1.3.1)
ethon (>= 0.9.0)
tzinfo (1.2.6)
thread_safe (~> 0.1)
tzinfo-data (1.2019.3)
tzinfo (>= 1.0.0)
unicode-display_width (1.6.1)
wdm (0.1.1)
yell (2.2.2)
PLATFORMS
ruby
DEPENDENCIES
html-proofer
jekyll!
nokogiri (>= 1.11.0.rc1)
jekyll (~> 4.0.0)
tzinfo (~> 1.2)
tzinfo-data
wdm (~> 0.1.1)

View File

@ -1,30 +0,0 @@
{%- if page.difficulty or recipe.difficulty -%}
{%- if page.difficulty -%}
{%- assign difficulty = page.difficulty -%}
{%- else -%}
{%- assign difficulty = recipe.difficulty -%}
{%- endif -%}
{%- if difficulty < 6 and difficulty > 0 -%}
{%- comment -%} note: these characters are invalid unicode. they will only render properly on the webpage using the bundled "stars" font. {%- endcomment -%}
{%- assign empty_star ="" -%}
{%- assign full_star = "" -%}
{%- assign half_star = "" -%}
{%- comment -%} build a string of empty stars {%- endcomment -%}
{%- assign stars = "" -%}
{%- for i in (1..5) -%}
{%- assign stars = stars | append: empty_star -%}
{%- endfor -%}
{%- comment -%} replace the first difficulty stars will filled stars {%- endcomment -%}
{%- assign page_stars_rounded = difficulty | floor -%}
{%- for i in (1..page_stars_rounded) -%}
{%- assign stars = stars | replace_first: empty_star, full_star -%}
{%- endfor -%}
{%- if difficulty != page_stars_rounded -%}
{%- comment -%} stars ends in .5 (or .1, or .9, or whatever) {%- endcomment -%}
{%- assign stars = stars | replace_first: empty_star, half_star -%}
{%- endif -%}
<span class='stars'>{{ stars }}</span>
{%- endif -%}
{%- endif -%}

View File

@ -4,7 +4,7 @@
<h3>{{ recipe.name }}</h3>
<p>
By {{ recipe.author }} -
{% if recipe.difficulty %}Difficulty: {% include difficulty_stars.html %} - {%- endif %}
{% if recipe.difficulty %}Difficulty: <span class='stars'>{{ recipe.difficulty | to_stars }}</span> - {%- endif %}
{{ recipe.method | size }} steps {%- if recipe.time %} -
{%- if recipe.time > 59 %} {{ recipe.time | divided_by: 60}}h {% endif -%}
{% assign mins = recipe.time | modulo: 60 -%}

View File

@ -31,7 +31,7 @@ custom_h1: true
{%- endif -%}
{%- endif -%}
<p class='subtle'>{% if page.difficulty %}Difficulty: {% include difficulty_stars.html %} - {% endif %}{{ page.method.size }} steps - Estimated cooking time: {{ time | default: "Not provided" }} {% if page.author %} - By {{ page.author }} {% endif %}</p>
<p class='subtle'>{% if page.difficulty %}Difficulty: <span class='stars'>{{ page.difficulty | to_stars }}</span> - {% endif %}{{ page.method.size }} steps - Estimated cooking time: {{ time | default: "Not provided" }} {% if page.author %} - By {{ page.author }} {% endif %}</p>
{%- if applicable_subrecipes %}
<h2> Subrecipes </h2>
{% for subrecipe in site.subrecipes -%}

View File

@ -35,7 +35,27 @@ module Jekyll
end
"<span title='#{input}'>#{leading_integer != "0" ? "#{leading_integer} " : ""}<span class='fraction'><span class='numerator'>#{rational.numerator}</span><span class='denominator'>#{rational.denominator}</span></span></span>"
end
def to_stars(input)
input = input.to_i
if input <= 0 or input > 5
return "[invalid difficulty value: #{input}. difficulty must be between 0.5 and 5 (inclusive)]"
end
# the "star" characters are invalid unicode but will render properly on the webpage when using the 'stars' font
empty_star, half_star, full_star = "", "", ""
out = full_star * input.floor
if input.floor != input
out += half_star
end
while out.length != 5
out += empty_star
end
out
end
end
end

View File

@ -10,12 +10,18 @@ body {
background: #fafafa;
margin: 0;
}
#main {
width: 80%;
max-width: 1500px;
flex-grow: 1;
margin: 0 auto;
}
@media screen and (max-width: 900px) {
#main {
width: 100%;
}
}
h1 {
margin: 0;