From e0307eb7e00c2227920ceb3958f58de4399c6b4d Mon Sep 17 00:00:00 2001 From: dzwdz Date: Sun, 28 Mar 2021 14:14:48 +0000 Subject: [PATCH] more "complete" solution pages, a basic css theme, and a todo --- gather.rb | 31 ++++++++++++++++++++++++++++--- style.css | 33 +++++++++++++++++++++++++++++++++ template.html | 12 ++++++++++++ todo.txt | 6 ++++++ 4 files changed, 79 insertions(+), 3 deletions(-) create mode 100644 style.css create mode 100644 template.html create mode 100644 todo.txt diff --git a/gather.rb b/gather.rb index 5aa7bdb..1230415 100755 --- a/gather.rb +++ b/gather.rb @@ -3,6 +3,8 @@ $PAGE_BASE = "http://tilde.town/~dzwdz/golf" $LOCAL_BASE = "/home/dzwdz/public_html/golf" +$HTML_HEAD, $HTML_FOOT = File.read('template.html').split('/snip/') + def all_files(event) `ls -d /home/*/golf/#{event}/*` .lines @@ -40,11 +42,24 @@ def challenge_page(event) p_map[user] += [path] end - file = File.new("#{$LOCAL_BASE}/#{event}/index.html", 'w') + # temporary + p_map["dzwdz1"] = p_map["dzwdz"] + p_map["dzwdz2"] = p_map["dzwdz"] + p_map["dzwdz3"] = p_map["dzwdz"] + file = File.new("#{$LOCAL_BASE}/#{event}/index.html", 'w') + file.write $HTML_HEAD + + # challenge info + file.write "
" + file.write "

firstone

this is temporary aaa

" + 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] @@ -53,13 +68,23 @@ def challenge_page(event) # also it's a mess file.print "" file.print "#{name}" - file.print "" + file.print " (#{File.size path}b)" + hint = path + '.hint' + # speaking of messes + if File.exists? hint + file.print "hint" + end + file.print "" end file.print "
    \n" end + file.write "
" + file.write $HTML_FOOT file.close end +`cp style.css #{$LOCAL_BASE}/` + mirror 'firstone' challenge_page 'firstone' diff --git a/style.css b/style.css new file mode 100644 index 0000000..0a9780e --- /dev/null +++ b/style.css @@ -0,0 +1,33 @@ +/* i stole the colors from gruvbox */ + +body { + font-family: mono; + background: #32302f; + color: #f2e5bc; +} + +a { color: #83a598 } + +#solutions { + display: grid; + align-items: center; + grid-template-columns: repeat(auto-fit, minmax(25em, 1fr)); +} + +.card { + margin: .5em; + background: #504945; + padding: .3em; +} + +.card ul { + padding: 0 1em 0 1em; +} + +h2 { + margin: 0; + background: #b16286; +} + +.hint {float: right} + diff --git a/template.html b/template.html new file mode 100644 index 0000000..b4a05cd --- /dev/null +++ b/template.html @@ -0,0 +1,12 @@ + + + + + + ~town golf + + + +/snip/ + + diff --git a/todo.txt b/todo.txt new file mode 100644 index 0000000..168714f --- /dev/null +++ b/todo.txt @@ -0,0 +1,6 @@ +for the submission page: + filter by language + highlight the winners + +create the main page +create a page explaining how to join