diff options
Diffstat (limited to 'template/src/articles')
| -rw-r--r-- | template/src/articles/crab.pre.rb | 8 | ||||
| -rw-r--r-- | template/src/articles/fish.pre.rb | 8 | ||||
| -rw-r--r-- | template/src/articles/index.post.rb | 28 | ||||
| -rw-r--r-- | template/src/articles/lion.pre.rb | 8 |
4 files changed, 52 insertions, 0 deletions
diff --git a/template/src/articles/crab.pre.rb b/template/src/articles/crab.pre.rb new file mode 100644 index 0000000..e306ae1 --- /dev/null +++ b/template/src/articles/crab.pre.rb @@ -0,0 +1,8 @@ +Justicar::PreProcessor.articles ||= {} # ensure the has exists + +# assign the result to a hash to be generated later +Justicar::PreProcessor.articles["crab.html"] = Paggio.html! do + h2 do + "This is an article about CRABS!" + end +end diff --git a/template/src/articles/fish.pre.rb b/template/src/articles/fish.pre.rb new file mode 100644 index 0000000..2efe82a --- /dev/null +++ b/template/src/articles/fish.pre.rb @@ -0,0 +1,8 @@ +Justicar::PreProcessor.articles ||= {} # ensure the has exists + +# assign the result to a hash to be generated later +Justicar::PreProcessor.articles["fish.html"] = Paggio.html! do + h2 do + "This is an article about FISH!" + end +end diff --git a/template/src/articles/index.post.rb b/template/src/articles/index.post.rb new file mode 100644 index 0000000..b9c9f6b --- /dev/null +++ b/template/src/articles/index.post.rb @@ -0,0 +1,28 @@ +# note: `target` will always be relative to the current directory for +# postprocessor files + +# this generates all of our preprocessed articles we stored +# note: you need to use the param `|_|` for paggio to allow us +# to use local variables in the proc +Justicar::PreProcessor.articles.each do |key, val| + target[key] = Paggio.html do |_| + _.html do + val + end + end +end + +# this creates the articles page which contains links to +# all of our articles +target["index.html"] = Paggio.html do |_| + _.html do + _.h1 do + 'Here is a list of all the articles!' + end + Justicar::PreProcessor.articles.each do |key, val| + _.p do + _.a.articles(href: "#{key}") { key.delete_suffix('.html').upcase + "!" } + end + end + end +end diff --git a/template/src/articles/lion.pre.rb b/template/src/articles/lion.pre.rb new file mode 100644 index 0000000..25871f5 --- /dev/null +++ b/template/src/articles/lion.pre.rb @@ -0,0 +1,8 @@ +Justicar::PreProcessor.articles ||= {} # ensure the has exists + +# assign the result to a hash to be generated later +Justicar::PreProcessor.articles["lion.html"] = Paggio.html! do + h2 do + "This is an article about LIONS!" + end +end |
