From 0a1de8146236384d870b9264c02a5d7aebbb586c Mon Sep 17 00:00:00 2001 From: dzwdz Date: Sun, 28 Mar 2021 14:40:31 +0000 Subject: [PATCH] static pages; challenges are now pulled from a directory --- challenges/firstone/desc.html | 3 +++ gather.rb | 27 +++++++++++++++++++++------ how.html | 2 ++ index.html | 4 ++++ todo.txt | 2 ++ 5 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 challenges/firstone/desc.html create mode 100644 how.html create mode 100644 index.html diff --git a/challenges/firstone/desc.html b/challenges/firstone/desc.html new file mode 100644 index 0000000..ac765b1 --- /dev/null +++ b/challenges/firstone/desc.html @@ -0,0 +1,3 @@ +

this is currently just a placeholder

+

if this was an actual challenge, this'd be a description of what it's about, +what the requirements are, etc

diff --git a/gather.rb b/gather.rb index 1230415..f3bea21 100755 --- a/gather.rb +++ b/gather.rb @@ -31,7 +31,6 @@ def mirror(event) end end - def challenge_page(event) # maps participants to their submissions p_map = Hash.new [] @@ -52,14 +51,16 @@ def challenge_page(event) # challenge info file.write "
" - file.write "

firstone

this is temporary aaa

" + file.write "

#{event}

" + file.write File.read("challenges/#{event}/desc.html") + file.write "how can i join?" file.write "
" # solutions file.write "
" p_map.each do |user, submissions| - file.print "

#{user}

    " + file.print "

    ~#{user}

      " submissions.each do |path| name = path.split('/')[5] @@ -84,7 +85,21 @@ def challenge_page(event) file.close end -`cp style.css #{$LOCAL_BASE}/` +def static_page(path) + File.open "#{$LOCAL_BASE}/#{path}", "w" do + |f| + f.write $HTML_HEAD + f.write File.read path + f.write $HTML_FOOT + end +end -mirror 'firstone' -challenge_page 'firstone' +Dir['challenges/*'].each do |path| + name = path.split('/', 2)[-1] + mirror name + challenge_page name +end + +static_page 'index.html' +static_page 'how.html' +`cp style.css #{$LOCAL_BASE}/` diff --git a/how.html b/how.html new file mode 100644 index 0000000..c9a97fa --- /dev/null +++ b/how.html @@ -0,0 +1,2 @@ +

      how 2 join

      +

      TODO

      diff --git a/index.html b/index.html new file mode 100644 index 0000000..0338480 --- /dev/null +++ b/index.html @@ -0,0 +1,4 @@ +

      ~town golf

      +

      this site will host code golf challenges for ~town users

      +git repo + diff --git a/todo.txt b/todo.txt index 168714f..79e14b0 100644 --- a/todo.txt +++ b/todo.txt @@ -4,3 +4,5 @@ for the submission page: create the main page create a page explaining how to join + +move to an actual templating engine