Compare commits

...

7 commits

Author SHA1 Message Date
f29445ec4c
add method.html (oops)
Some checks failed
continuous-integration/drone/push Build is failing
2020-03-01 04:18:45 +10:00
1d9ec2668e
fixed a silly issue caused by removing whitespace 2020-03-01 04:17:34 +10:00
5911e0403a
show recipe method 2020-03-01 04:11:17 +10:00
8b4ae13b02
remove some whitespace on rendered pages 2020-03-01 04:07:36 +10:00
451f6afeb4
render recipes with embedded subrecipes, print some meta information, etc 2020-03-01 04:05:06 +10:00
3b07cd9d5d
added drone CI config 2020-03-01 02:10:14 +10:00
206cf23810
setup jekyll structure 2020-03-01 02:07:24 +10:00
13 changed files with 207 additions and 5 deletions

8
.drone.yml Normal file
View file

@ -0,0 +1,8 @@
pipeline:
build:
image: ruby
commands:
- gem install bundler
- bundle install
- bundle exec jekyll build
- bundle exec htmlproofer ./_site --disable-external

11
.gitignore vendored
View file

@ -1,6 +1,7 @@
# ---> Jekyll
_site/
.sass-cache/
.jekyll-cache/
_site
_recipes
_subrecipes
.sass-cache
.jekyll-cache
.jekyll-metadata
vendor

5
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,5 @@
{
"files.associations": {
"*.html": "jekyll",
}
}

30
Gemfile Normal file
View file

@ -0,0 +1,30 @@
source "https://rubygems.org"
# Hello! This is where you manage which Jekyll version is used to run.
# When you want to use a different version, change it below, save the
# file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
#
# bundle exec jekyll serve
#
# This will help ensure the proper Jekyll version is running.
# Happy Jekylling!
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
# uncomment the line below. To upgrade, run `bundle update github-pages`.
# gem "github-pages", group: :jekyll_plugins
# If you have any plugins, put them here!
group :jekyll_plugins do
# gem "jekyll-feed", "~> 0.12"
end
# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem
# and associated library.
install_if -> { RUBY_PLATFORM =~ %r!mingw|mswin|java! } do
gem "tzinfo", "~> 1.2"
gem "tzinfo-data"
end
# Performance-booster for watching directories on Windows
gem "wdm", "~> 0.1.1", :install_if => Gem.win_platform?

74
Gemfile.lock Normal file
View file

@ -0,0 +1,74 @@
GEM
remote: https://rubygems.org/
specs:
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
colorator (1.1.0)
concurrent-ruby (1.1.6)
em-websocket (0.5.1)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
eventmachine (1.2.7)
ffi (1.12.2)
forwardable-extended (2.6.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)
listen (~> 3.0)
kramdown (2.1.0)
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
liquid (4.0.3)
listen (3.2.1)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
mercenary (0.3.6)
pathutil (0.16.2)
forwardable-extended (~> 2.6)
public_suffix (4.0.3)
rb-fsevent (0.10.3)
rb-inotify (0.10.1)
ffi (~> 1.0)
rouge (3.16.0)
safe_yaml (1.0.5)
sassc (2.2.1)
ffi (~> 1.9)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
thread_safe (0.3.6)
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)
PLATFORMS
ruby
DEPENDENCIES
jekyll (~> 4.0.0)
tzinfo (~> 1.2)
tzinfo-data
wdm (~> 0.1.1)
BUNDLED WITH
2.1.4

6
_config.yml Normal file
View file

@ -0,0 +1,6 @@
collections:
# note: subrecipes MUST come before recipes, otherwise subrecipe.output will be empty with no error message given. thanks to https://github.com/jekyll/jekyll/issues/5371#issuecomment-247951926
subrecipes:
output: false
recipes:
output: true

View file

@ -0,0 +1,10 @@
{%- assign tag = "h2" -%}
{%- if page.collection == "subrecipes" -%}
{%- assign tag = "h4" -%}
{%- endif -%}
<{{tag}}>Ingredients</{{tag}}>
<ul>
{% for item in page.ingredients -%}
<li>{{ item[0] }} {%- if item[2] -%} {{ item[2] }} of {%- endif -%} {{ item[1] }}</li>
{% endfor -%}
</ul>

12
_includes/method.html Normal file
View file

@ -0,0 +1,12 @@
{%- if page.method | size != 0 %}
{%- assign tag = "h2" -%}
{%- if page.collection == "subrecipes" -%}
{%- assign tag = "h4" -%}
{%- endif -%}
<{{tag}}>Method</{{tag}}>
<ol>
{% for item in page.method -%}
<li>{{ item }}</li>
{% endfor -%}
</ol>
{%- endif -%}

5
_includes/recipes.html Normal file
View file

@ -0,0 +1,5 @@
<ul>
{% for recipe in site.recipes -%}
<li><a href='{{ recipe.url }}'>{{ recipe.name }}</a></li>
{% endfor %}
</ul>

13
_layouts/default.html Normal file
View file

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{{ page.title }}</title>
</head>
<body>
{{ content }}
</body>
</html>

31
_layouts/recipe.html Normal file
View file

@ -0,0 +1,31 @@
---
layout: default
---
{%- comment -%} this is a gross method of convertin "_recipes/example.md" to "example". it does it by removing the leading "_recipes/", which is simple enough, and then the trailing ".md", which is done by converting the string to an array, reversing it, turning it back into a string, removing the leading "dm." (".md" backwards), and doing the the array -> reverse -> string shuffle again. it's ugly but hey it works right {%- endcomment -%}
{%- assign id = page.path | remove_first: "_recipes/" | split: "" | reverse | join: "" | remove_first: "dm." | split: "" | reverse | join: "" -%}
{%- comment -%} unfortunately we have to iterate through the entire subrecipe folder twice - once to see if there are any subrecipes that apply here, and another time to put them in. thankfully we can break out of the first loop if we find a single match. i miss jinja ;u; {%- endcomment -%}
{%- assign applicable_subrecipes = false -%}
{%- for subrecipe in site.subrecipes -%}
{%- if subrecipe.parents contains id -%}
{%- comment -%} we found one! {%- endcomment -%}
{%- assign applicable_subrecipes = true -%}
{%- break -%}
{%- endif -%}
{%- endfor -%}
<h1>{{ page.name }}</h1>
<p> {{ page.method.size }} steps - Estimated cooking time: {{ page.time | default: "Not provided" }}</p>
{%- if applicable_subrecipes %}
<h2> Subrecipes </h2>
{% for subrecipe in site.subrecipes -%}
{%- if subrecipe.parents contains id -%}
<h3>{{ subrecipe.name }}</h3>
<div class='subrecipe' id='sr-{{ subrecipe.name | downcase | url_encode }}'>
{{ subrecipe.output }}
</div>
{%- endif -%}
{%- endfor -%}
{%- endif -%}
{%- include ingredients.html -%}
{%- include method.html -%}

2
_layouts/subrecipe.html Normal file
View file

@ -0,0 +1,2 @@
{% include ingredients.html %}
{% include method.html %}

5
index.html Normal file
View file

@ -0,0 +1,5 @@
---
title: Home
layout: default
---
{% include recipes.html %}