mucho worko

This commit is contained in:
Lorin Werthen 2016-07-23 21:17:24 +02:00
parent b7606c49e6
commit 14ffd7a1ff
No known key found for this signature in database
GPG key ID: F11FFC921E0E08E0
12 changed files with 124 additions and 72 deletions

View file

@ -16,5 +16,4 @@ script:
after_success: after_success:
- mv deploy_key ~/.ssh/id_rsa - mv deploy_key ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa - chmod 600 ~/.ssh/id_rsa
- chmod +x .travis/deploy.sh
- '[[ $TRAVIS_BRANCH == "master" ]] && bundle exec nanoc deploy --target public' - '[[ $TRAVIS_BRANCH == "master" ]] && bundle exec nanoc deploy --target public'

37
Rules
View file

@ -4,9 +4,27 @@
require 'json' require 'json'
preprocess do preprocess do
# Tag all posts with 'article'
@items.find_all('/posts/**/*').each do |i| @items.find_all('/posts/**/*').each do |i|
i.attributes[:kind] = 'article' year_str = %r{/(\d\d)-\d\d/}.match(i.identifier).captures[0]
academic_year = year_str.to_i
attr_hash = {
# Tag all posts with article (for Blogging helper)
kind: 'article',
academic_year: academic_year
}
i.update_attributes(attr_hash)
end
# academic_years is defined in archives.rb
academic_years.each do |year|
@items.create(
'',
{ academic_year: year },
"/archives/#{year}-#{year + 1}.html",
binary: false
)
end end
@items.create('', {}, '/tipuesearch_content.js', binary: false) @items.create('', {}, '/tipuesearch_content.js', binary: false)
@ -17,9 +35,22 @@ passthrough '/tipuesearch_content.js'
# ERB # ERB
compile '/*.erb' do compile '/*.erb' do
layout '/generic.*'
layout '/default.*' layout '/default.*'
filter :erb filter :erb
filter :relativize_paths, type: :html
end
compile '/archives/*' do
posts = items.find_all('/posts/**/*').select do |post|
post[:academic_year] == item[:academic_year]
end
layout '/generic.*'
layout '/default.*'
filter :erb
filter :relativize_paths, type: :html filter :relativize_paths, type: :html
end end

7
content/archives.erb Normal file
View file

@ -0,0 +1,7 @@
<ul>
<% academic_years_items.each do |year, item| %>
<li>
<%= link_to pretty_year(year), item %>
</li>
<% end %>
</ul>

View file

@ -1,28 +1,4 @@
<div class="pure-g"> <div id="all-events">
<div class="pure-u-xl-1-5 pure-u-lg-1-6 pure-u-md-1-8 pure-u-sm-1-12 pure-u-1-24"></div>
<div id="container" class="pure-u-xl-3-5 pure-u-lg-2-3 pure-u-md-3-4 pure-u-sm-5-6 pure-u-11-12">
<header>
<div class="header-top">
<a href="/">
<img id="logo" src="https://zeus.ugent.be/wp-content/uploads/2009/05/logo-new.png" alt="" />
</a>
<div id="logos">
<a href="https://github.com/ZeusWPI" target="_blank">
<i class="logo-link fa fa-github fa-3x"></i>
</a>
<a href="https://www.facebook.com/zeus.wpi/" target="_blank">
<i class="logo-link fa fa-facebook fa-3x"></i>
</a>
<a href="#" target="_blank">
<i class="logo-link fa fa-rss fa-3x"></i>
</a>
</div>
</div>
<%= render '/partials/_navbar.*' %>
</header>
<main>
<div id="all-events">
<%= render '/partials/_tile.*', article: sorted_articles[0] %> <%= render '/partials/_tile.*', article: sorted_articles[0] %>
<div class="pure-g"> <div class="pure-g">
<% sorted_articles[1..-1].each do |article| %> <% sorted_articles[1..-1].each do |article| %>
@ -31,7 +7,4 @@
</div> </div>
<% end %> <% end %>
</div> </div>
</div>
</main>
</div>
</div> </div>

View file

@ -0,0 +1,13 @@
---
title: AWK-les
banner: https://upload.wikimedia.org/wikipedia/commons/6/61/Een.jpg
created_at: 23-10-2016
time: 23-10-2016
location: Auditorium A1, Campus Sterre, Gebouw S9
---
Op **dinsdag 23 februari 18:00** (na de les Scriptingtalen) in **Auditorium A1** organiseren we een **AWK-les** gegeven door **professor Peter Dawyndt**.
**AWK** is een scriptingtaal, bedoeld om lijn per lijn tekstbestanden te verwerken. Zo wordt AWK vaak gebruikt voor de ingebouwde werking met delimiters om CSV bestanden en dergelijke te verwerken. AWK staat tevens bekend om de talloze [one-liners](http://www.pement.org/awk/awk1line.txt) die in de command line gebruikt kunnen worden.
Sinds vorig jaar wordt AWK (samen met sed) niet meer gegeven in het vak Scriptingtalen, om meer te kunnen concentreren op Python en JavaScript. Hoewel deze zeer goede general purpose talen zijn, blijft AWK ongeëvenaard voor razendsnelle tekstverwerking en transformaties.

View file

@ -1,31 +1,11 @@
<div class="pure-g"> <form action="?" method="get">
<div class="pure-u-xl-1-5 pure-u-lg-1-6 pure-u-md-1-8 pure-u-sm-1-12 pure-u-1-24"></div>
<div id="container" class="pure-u-xl-3-5 pure-u-lg-2-3 pure-u-md-3-4 pure-u-sm-5-6 pure-u-11-12">
<div class="header-top">
<a href="/">
<img id="logo" src="https://zeus.ugent.be/wp-content/uploads/2009/05/logo-new.png" alt="" />
</a>
<div id="logos">
<a href="https://github.com/ZeusWPI" target="_blank">
<i class="logo-link fa fa-github fa-3x"></i>
</a>
<a href="https://www.facebook.com/zeus.wpi/" target="_blank">
<i class="logo-link fa fa-facebook fa-3x"></i>
</a>
<a href="#" target="_blank">
<i class="logo-link fa fa-rss fa-3x"></i>
</a>
</div>
</div>
<%= render '/partials/_navbar.*' %>
<form action="?" method="get">
<input type="text" name="q" id="tipue_search_input" autocomplete="off" required> <input type="text" name="q" id="tipue_search_input" autocomplete="off" required>
</form> </form>
<div id="tipue_search_content"></div> <div id="tipue_search_content"></div>
<script> <script>
$(document).ready(function() { $(document).ready(function() {
$('#tipue_search_input').tipuesearch(); $('#tipue_search_input').tipuesearch({
showTitleCount: false
}); });
</script> });
</div> </script>
</div>

28
layouts/generic.erb Normal file
View file

@ -0,0 +1,28 @@
<div class="pure-g">
<div class="pure-u-xl-1-5 pure-u-lg-1-6 pure-u-md-1-8 pure-u-sm-1-12 pure-u-1-24"></div>
<div id="container" class="pure-u-xl-3-5 pure-u-lg-2-3 pure-u-md-3-4 pure-u-sm-5-6 pure-u-11-12">
<header>
<div class="header-top">
<a href="/">
<img id="logo" src="https://zeus.ugent.be/wp-content/uploads/2009/05/logo-new.png" alt="" />
</a>
<div id="logos">
<a href="https://github.com/ZeusWPI" target="_blank">
<i class="logo-link fa fa-github fa-3x"></i>
</a>
<a href="https://www.facebook.com/zeus.wpi/" target="_blank">
<i class="logo-link fa fa-facebook fa-3x"></i>
</a>
<a href="#" target="_blank">
<i class="logo-link fa fa-rss fa-3x"></i>
</a>
</div>
</div>
<%= render '/partials/_navbar.*' %>
</header>
<main>
<%= yield %>
</main>
</div>
</div>

20
lib/archives.rb Normal file
View file

@ -0,0 +1,20 @@
module ArchiveHelper
def academic_years
academic_years = Set.new
@items.find_all('/posts/**/*').each do |i|
academic_year = %r{/(\d\d)-\d\d/}.match(i.identifier).captures[0]
academic_years << academic_year.to_i
end
academic_years
end
def academic_years_items
academic_years.map { |y| [y, items["/archives/#{y}-#{y + 1}.html"]] }.to_h
end
def pretty_year(y)
"'#{y} - '#{y + 1}"
end
end

View file

@ -2,3 +2,6 @@ include Nanoc::Helpers::Blogging
include Nanoc::Helpers::Capturing include Nanoc::Helpers::Capturing
include Nanoc::Helpers::LinkTo include Nanoc::Helpers::LinkTo
include Nanoc::Helpers::Rendering include Nanoc::Helpers::Rendering
include Nanoc::Helpers::Text
include ArchiveHelper

View file

@ -1,5 +1,3 @@
include Nanoc::Helpers::Text
class StripFilter < Nanoc::Filter class StripFilter < Nanoc::Filter
identifier :strip_html identifier :strip_html