static pages; challenges are now pulled from a directory

master
dzwdz 2021-03-28 14:40:31 +00:00
parent e0307eb7e0
commit 0a1de81462
5 changed files with 32 additions and 6 deletions

View File

@ -0,0 +1,3 @@
<p> this is currently just a placeholder </p>
<p> if this was an actual challenge, this'd be a description of what it's about,
what the requirements are, etc </p>

View File

@ -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 "<div id=\"challenge_header\">"
file.write "<h1>firstone</h1><p>this is temporary aaa</p>"
file.write "<h1>#{event}</h1>"
file.write File.read("challenges/#{event}/desc.html")
file.write "<a href=\"#{$PAGE_BASE}/how.html\">how can i join?</a>"
file.write "</div>"
# solutions
file.write "<div id=\"solutions\">"
p_map.each do
|user, submissions|
file.print "<div class=\"card\"><h2>#{user}</h2><ul>"
file.print "<div class=\"card\"><h2>~#{user}</h2><ul>"
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}/`

2
how.html 100644
View File

@ -0,0 +1,2 @@
<h1>how 2 join</h1>
<p>TODO</p>

4
index.html 100644
View File

@ -0,0 +1,4 @@
<h1>~town golf</h1>
<p> this site will host code golf challenges for ~town users </p>
<a href="https://git.tilde.town/dzwdz/towngolf">git repo</a>

View File

@ -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