diff options
| author | realtradam <[email protected]> | 2022-04-22 07:17:49 -0400 |
|---|---|---|
| committer | realtradam <[email protected]> | 2022-04-22 07:17:49 -0400 |
| commit | 99099c284982863480ffc6d4aa741d29dc2ea92a (patch) | |
| tree | 66a2f4c543617f647d970db6fce07622feafd393 /template | |
| parent | 6150ed8ba86e960a2833b4000c2f9474a2292129 (diff) | |
| download | Justicar-99099c284982863480ffc6d4aa741d29dc2ea92a.tar.gz Justicar-99099c284982863480ffc6d4aa741d29dc2ea92a.zip | |
version 1.0v1.0.0
Diffstat (limited to 'template')
| -rw-r--r-- | template/Rakefile | 3 | ||||
| -rw-r--r-- | template/public/favicon.png | bin | 1566 -> 0 bytes | |||
| -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 | ||||
| -rw-r--r-- | template/src/index.html.rb | 2 | ||||
| -rw-r--r-- | template/src/script.js.rb | 6 | ||||
| -rw-r--r-- | template/src/style.css.rb | 7 |
9 files changed, 67 insertions, 3 deletions
diff --git a/template/Rakefile b/template/Rakefile index 1629ff0..941b1b5 100644 --- a/template/Rakefile +++ b/template/Rakefile @@ -3,8 +3,9 @@ require 'opal-browser' desc "Build your website" task :build do + Justicar.load_preprocessors('src') Justicar.build_source('src') - Justicar.build('build', 'public') + Justicar.build_initialize('build', 'public') end desc "Create a server and open your site in your browser" diff --git a/template/public/favicon.png b/template/public/favicon.png Binary files differdeleted file mode 100644 index 5a99253..0000000 --- a/template/public/favicon.png +++ /dev/null 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 diff --git a/template/src/index.html.rb b/template/src/index.html.rb index 9c34064..6c36224 100644 --- a/template/src/index.html.rb +++ b/template/src/index.html.rb @@ -2,7 +2,7 @@ Paggio.html do script type: "text/javascript", src: "script.js" link rel: "stylesheet", href: "style.css" link rel: 'icon', type: 'image/x-icon', href: 'favicon.ico' - img.justicar(src: 'justicar.png', alt: 'Justicar', height: '400px') + img.justicar(src: '/justicar.png', alt: 'Justicar', height: '400px') h1 { "Hello world from Justicar" } hr h2.paggio do diff --git a/template/src/script.js.rb b/template/src/script.js.rb index 0be5ef5..f624958 100644 --- a/template/src/script.js.rb +++ b/template/src/script.js.rb @@ -9,5 +9,11 @@ $document.ready do "Hello World from Opal!" end p.opal {"This part was generated by Opal from Javascript (:"} + h2.articles do + "Here is some articles that were generated using the processing system:" + end + p.articles do + a(href: '/articles').articles { "Articles" } + end end.append_to($document.body) end diff --git a/template/src/style.css.rb b/template/src/style.css.rb index 9a41dad..157fc2a 100644 --- a/template/src/style.css.rb +++ b/template/src/style.css.rb @@ -5,7 +5,7 @@ Paggio.css do rule '.justicar' do top 134.px - left 360.px + left 400.px opacity 0.7 position 'absolute' width 400.px @@ -20,6 +20,11 @@ Paggio.css do color :goldenrod end + rule '.articles' do + color :limegreen + max width: 400.px + end + rule 'h1' do font style: :italic end |
