Adding news page
parent
6231e2cd13
commit
a5904bfe0e
45
Rakefile
45
Rakefile
|
@ -17,36 +17,62 @@ site :odin_lab, out: "build" do
|
|||
## Splice off header information
|
||||
for_files(/((\.erb)|(\.md)|(\.html))$/) do
|
||||
exclude_files(/^\/?(slides|software)\//) do
|
||||
activate extract_headers
|
||||
extract_headers
|
||||
end
|
||||
end
|
||||
|
||||
## Render specialized formats
|
||||
for_files(/\.md$/) do
|
||||
activate render_markdown
|
||||
render_markdown
|
||||
end
|
||||
for_files(/\.erb$/) do
|
||||
activate render_erb
|
||||
render_erb
|
||||
end
|
||||
|
||||
## Generate pages for each lab member
|
||||
LabMetadata::create_people_pages
|
||||
for_files(/people\/.*\.html$/) do
|
||||
exclude_files(/index\.html/) do
|
||||
activate apply_template("templates/person.erb")
|
||||
apply_template("templates/person.erb")
|
||||
end
|
||||
end
|
||||
|
||||
## Render 'news' pages
|
||||
for_files(/rants\/.*\.html$/) do
|
||||
exclude_files(/index\.html$/) do
|
||||
extract_date_from_filename
|
||||
create_collection("rants")
|
||||
apply { |f| f[:news_prev] = f[:rants_prev]; f[:news_next] = f[:rants_next] }
|
||||
apply_template("templates/news.erb")
|
||||
end
|
||||
for_files(/index\.html$/) do
|
||||
get_collection("rants").map { |f| f[:in_path] }.each { |dep| add_dependency dep }
|
||||
end
|
||||
end
|
||||
for_files(/news\/.*\.html$/) do
|
||||
exclude_files(/index\.html$/) do
|
||||
extract_date_from_filename
|
||||
create_collection("news")
|
||||
apply_template("templates/news.erb")
|
||||
end
|
||||
for_files(/index\.html$/) do
|
||||
get_collection("news").map { |f| f[:in_path] }.each { |dep| add_dependency dep }
|
||||
end
|
||||
end
|
||||
|
||||
## Specialized Formatting
|
||||
for_files(/seminar\/.*\.html$/) do
|
||||
apply {|f| f[:extraCSS] = [{ "asset" => "seminar.css" }] }
|
||||
apply_template("templates/seminar.erb")
|
||||
end
|
||||
|
||||
## Apply templating
|
||||
for_files(/\.html$/) do
|
||||
exclude_files(/^\/?(slides|software)\//) do
|
||||
activate apply_template("templates/lab.erb")
|
||||
apply_template("templates/lab.erb")
|
||||
end
|
||||
end
|
||||
|
||||
## Specialized Formatting
|
||||
|
||||
|
||||
## Specify specialized dependencies (e.g., on the database)
|
||||
for_files(/people\/.*\.html$/) do
|
||||
add_dependency "db/lab.json"
|
||||
|
@ -77,9 +103,6 @@ task :default => [ :odin_lab ]
|
|||
task :open => :default do
|
||||
system("open build/index.html")
|
||||
end
|
||||
task :upload => :odin_lab do
|
||||
system("rsync -avz -e ssh --safe-links --progress build/ okennedy@gram.cse.buffalo.edu:/var/www/static/")
|
||||
end
|
||||
task :clean do
|
||||
system("rm -r build")
|
||||
end
|
||||
|
|
|
@ -140,3 +140,55 @@ body {
|
|||
font-style: italic;
|
||||
}
|
||||
|
||||
|
||||
.news {
|
||||
max-width: 600px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
.news .author {
|
||||
text-align: center;
|
||||
font-size: 10px;
|
||||
font-style: italic;
|
||||
}
|
||||
.news h1 {
|
||||
text-align: center;
|
||||
font-size: 26px;
|
||||
}
|
||||
.news h2 {
|
||||
font-size: 22px;
|
||||
}
|
||||
.news h3 {
|
||||
font-size: 18px;
|
||||
}
|
||||
.news h4 {
|
||||
font-size: 14px;
|
||||
}
|
||||
.news .prev_link {
|
||||
float: left;
|
||||
}
|
||||
.news .next_link {
|
||||
float: right;
|
||||
}
|
||||
.news .nextprev_link_sep {
|
||||
text-align: center;
|
||||
}
|
||||
.news .nextprev {
|
||||
font-weight: bold;
|
||||
font-size: 12px;
|
||||
margin-top: 15px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
.news .content {
|
||||
margin-top: 15px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
.news .article_list {
|
||||
list-style-type: none;
|
||||
}
|
||||
.news .article_list .date {
|
||||
font-weight: bold;
|
||||
}
|
||||
.news .article_list .title {
|
||||
|
||||
}
|
|
@ -17,6 +17,7 @@ module GemSmith
|
|||
in_path: nil,
|
||||
out_path: nil,
|
||||
static: [],
|
||||
collections: {},
|
||||
assets: {}
|
||||
}
|
||||
end
|
||||
|
@ -40,7 +41,7 @@ module GemSmith
|
|||
out_path: out_path,
|
||||
rel_dir: File.dirname(out_path),
|
||||
stream: Pipeline.new(in_path),
|
||||
title: File.basename(out_path, ".*").gsub(/[_-]/, " ").capitalize
|
||||
"title" => File.basename(out_path, ".*").gsub(/[_-]/, " ").capitalize
|
||||
}]
|
||||
end
|
||||
end
|
||||
|
@ -110,13 +111,38 @@ module GemSmith
|
|||
end
|
||||
end
|
||||
|
||||
def activate(op)
|
||||
raise "Using apply outside of a site block" if $gemsmith[:active].nil?
|
||||
$gemsmith[:active].each { |f| op.call(f) }
|
||||
def apply
|
||||
raise "Applying effects to pages outside of a site block" if $gemsmith[:active].nil?
|
||||
$gemsmith[:active].each { |f| yield f }
|
||||
end
|
||||
|
||||
def extract_date_from_filename
|
||||
apply { |f|
|
||||
d = /(\d\d\d\d)-(\d\d?)-(\d\d?)/.match File.basename(f[:in_path])
|
||||
raise "Expecting date in the name of '#{File.basename f[:in_path]}'" if d.nil?
|
||||
f[:date] = Time.new(d[1].to_i, d[2].to_i, d[3].to_i)
|
||||
}
|
||||
end
|
||||
|
||||
def create_collection(name)
|
||||
curr = nil
|
||||
collection = []
|
||||
$gemsmith[:active].each { |f|
|
||||
f["#{name}_prev".to_sym] = curr
|
||||
f["#{name}_next".to_sym] = nil
|
||||
curr["#{name}_next".to_sym] = f unless curr.nil?
|
||||
curr = f
|
||||
collection.push(f)
|
||||
}
|
||||
$gemsmith[:collections][name] = collection
|
||||
end
|
||||
|
||||
def get_collection(name)
|
||||
$gemsmith[:collections][name]
|
||||
end
|
||||
|
||||
def extract_headers
|
||||
lambda { |f|
|
||||
apply { |f|
|
||||
yaml = ["---\n"]
|
||||
pos = nil
|
||||
f[:stream].consume { |fp|
|
||||
|
@ -143,7 +169,7 @@ module GemSmith
|
|||
|
||||
def render_markdown(renderer = Redcarpet::Render::HTML.new())
|
||||
markdown = Redcarpet::Markdown.new(renderer)
|
||||
lambda { |f|
|
||||
apply { |f|
|
||||
f[:out_path] = File.join(File.dirname(f[:out_path]), "#{File.basename(f[:out_path], ".*")}.html")
|
||||
f[:stream].transform_all { |body|
|
||||
markdown.render(body)
|
||||
|
@ -152,7 +178,7 @@ module GemSmith
|
|||
end
|
||||
|
||||
def render_erb
|
||||
lambda { |f|
|
||||
apply { |f|
|
||||
f[:out_path] = File.join(File.dirname(f[:out_path]), "#{File.basename(f[:out_path], ".*")}.html")
|
||||
f[:stream].transform_all { |body|
|
||||
b = binding()
|
||||
|
@ -168,7 +194,7 @@ module GemSmith
|
|||
h[k] = ERB.new(File.open(k) { |fp| fp.read })
|
||||
}
|
||||
|
||||
lambda { |f|
|
||||
apply { |f|
|
||||
template = f.fetch(:template, default_template)
|
||||
f[:dependencies].push(template)
|
||||
f[:stream].transform_all { |body|
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
---
|
||||
title: ODIn Lab News
|
||||
---
|
||||
|
||||
<div class="news">
|
||||
<h1>News Archive</h1>
|
||||
|
||||
<div class="archive">
|
||||
<%
|
||||
GemSmith::get_collection("news").
|
||||
map { |f|
|
||||
{ title: f["title"],
|
||||
author: f["author"],
|
||||
path: f[:out_path],
|
||||
date: f[:date]
|
||||
}
|
||||
}.
|
||||
group_by { |data| data[:date].year }.
|
||||
to_a.sort_by { |year, data| -year }.
|
||||
each do |year, records_for_year| %>
|
||||
<h2><%=year%></h2>
|
||||
<ul class="article_list">
|
||||
<% records_for_year.
|
||||
sort_by { |data| -data[:date].to_i }.
|
||||
each do |data| %>
|
||||
<li class="article">
|
||||
<span class="date"><%= data[:date].strftime("%b %e") %>: </span>
|
||||
<a href="<%= root_path(data[:path]) %>">
|
||||
<span class="title"><%= data[:title] %></span>
|
||||
</a>
|
||||
<% unless data[:author].nil? %><span class="author">(by <%= data[:author] %>)</span><% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
title: What if Databases Could Answer Incorrectly?
|
||||
author: Oliver Kennedy
|
||||
---
|
||||
<div id="magicdomid2978" class="ace-line primary-author-a-z86ziz85z2z67zz82zz80zz68zyz72zvaz67zrvz73z">
|
||||
<p style="text-align: justify;">(an open letter to the database community)</p>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
title: In case iCloud login breaks your computer
|
||||
author: Oliver Kennedy
|
||||
---
|
||||
This was discovered through trial and error, rather than through web searches... so for anyone who's run into this problem, here's what worked.
|
||||
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
---
|
||||
title: Random Rants
|
||||
---
|
||||
|
||||
<div class="news">
|
||||
<h1>Rants Archive</h1>
|
||||
|
||||
<div class="archive">
|
||||
<%
|
||||
GemSmith::get_collection("rants").
|
||||
map { |f|
|
||||
{ title: f["title"],
|
||||
author: f["author"],
|
||||
path: f[:out_path],
|
||||
date: f[:date]
|
||||
}
|
||||
}.
|
||||
group_by { |data| data[:date].year }.
|
||||
to_a.sort_by { |year, data| -year }.
|
||||
each do |year, records_for_year| %>
|
||||
<h2><%=year%></h2>
|
||||
<ul class="article_list">
|
||||
<% records_for_year.
|
||||
sort_by { |data| -data[:date].to_i }.
|
||||
each do |data| %>
|
||||
<li class="article">
|
||||
<span class="date"><%= data[:date].strftime("%b %e") %>: </span>
|
||||
<a href="<%= root_path(data[:path]) %>">
|
||||
<span class="title"><%= data[:title] %></span>
|
||||
</a>
|
||||
<% unless data[:author].nil? %><span class="author">(by <%= data[:author] %>)</span><% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
|
@ -23,39 +23,6 @@ schedule:
|
|||
who: Jing Gao
|
||||
what: Truthfinding
|
||||
where: Davis 113A
|
||||
extraCSS:
|
||||
- asset: seminar.css
|
||||
---
|
||||
<h1><%= title %></h1>
|
||||
|
||||
<p>The UBDB seminar meets on Mondays at 10:30 AM, typically in Davis 113A. Subscribe to cse-database-list for more details. </p>
|
||||
|
||||
<table class="table table-striped seminar"><tr></tr>
|
||||
<% schedule.each do |event| %>
|
||||
<tr class="event"><td>
|
||||
<div class="date"><%= event["when"] %></div>
|
||||
<% if event.has_key? "where" %><div class="location"><%= event["where"] %></div><% end %>
|
||||
</td>
|
||||
<td align="right">
|
||||
<div class="title"><%= event["what"] %></div>
|
||||
<% if event.has_key? "who" %><div class="speaker">
|
||||
<% if event.has_key? "site" %><a href="<%= event["site"] %>"><% end %>
|
||||
<%= event["who"] %>
|
||||
<% if event.has_key? "site" %></a><% end %>
|
||||
</div><% end %>
|
||||
</td>
|
||||
</tr><tr><td colspan="2">
|
||||
<% if event.has_key? "url" %><center><a href="<%= event["url"] %>" class="paper"><%= event["url"] %></a></center><% end %>
|
||||
<% if event.has_key? "details" %>
|
||||
<% if event["details"].has_key? "abstract" %>
|
||||
<h4 align="right">Abstract</h4>
|
||||
<div class="well"><%= event["details"]["abstract"] %></div>
|
||||
<% end %>
|
||||
<% if event["details"].has_key? "bio" %>
|
||||
<h4 align="right">Bio</h4>
|
||||
<div class="well"><%= event["details"]["bio"] %></div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</td></tr>
|
||||
<% end %>
|
||||
</table>
|
||||
The UBDB seminar meets on Mondays at 10:30 AM, typically in Davis 113A. Subscribe to cse-database-list for more details.
|
|
@ -86,44 +86,6 @@ candidates:
|
|||
- who: Boris Glavic
|
||||
- who: Daisy Wang
|
||||
- who: Dan Suciu
|
||||
extraCSS:
|
||||
- asset: seminar.css
|
||||
---
|
||||
|
||||
<h1><%= title %></h1>
|
||||
|
||||
<p>The UBDB seminar meets on Mondays at 10:30 AM, typically in Davis 113A. Subscribe to cse-database-list for more details. </p>
|
||||
|
||||
<div class="seminar">
|
||||
<% schedule.each do |event| %>
|
||||
<div class="event panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<div style="align: right; float: right; ">
|
||||
<div class="title"><%= event["what"] %></div>
|
||||
<% if event.has_key? "who" %><div class="speaker">
|
||||
<% if event.has_key? "site" %><a href="<%= event["site"] %>"><% end %>
|
||||
<%= event["who"] %>
|
||||
<% if event.has_key? "site" %></a><% end %>
|
||||
</div><% end %>
|
||||
</div>
|
||||
<div>
|
||||
<div class="date"><%= event["when"] %></div>
|
||||
<% if event.has_key? "where" %><div class="location"><%= event["where"] %></div><% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<% if event.has_key? "url" %><center><a href="<%= event["url"] %>" class="paper"><%= event["url"] %></a></center><% end %>
|
||||
<% if event.has_key? "details" %>
|
||||
<% if event["details"].has_key? "abstract" %>
|
||||
<h4>Abstract</h4>
|
||||
<%= event["details"]["abstract"] %>
|
||||
<% end %>
|
||||
<% if event["details"].has_key? "bio" %>
|
||||
<h4>Bio</h4>
|
||||
<%= event["details"]["bio"] %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
|
@ -52,7 +52,7 @@
|
|||
<div id="navbar" class="collapse navbar-collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<% [
|
||||
"People", "Research", "Teaching", "Papers", "Grants", "Seminar"
|
||||
"People", "Research", "Teaching", "Papers", "Grants", "Seminar", "News"
|
||||
].each do |cat| %>
|
||||
<%= if File.split(rel_dir).include? cat.downcase then "<li class=\"active\">" else "<li>" end %>
|
||||
<a href="<%=root_path(File.join(cat.downcase, "index.html"))%>"><%= cat %></a></li>
|
||||
|
@ -74,7 +74,7 @@
|
|||
<!-- Bootstrap core JavaScript
|
||||
================================================== -->
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<script src="<%=asset_path("jquery.js")%>"></script>
|
||||
<script src="<%= asset_path("jquery.js")%>"></script>
|
||||
<script src="<%= asset_path("bootstrap")%>/js/bootstrap.min.js"></script>
|
||||
<script src="<%= asset_path("mathjax")%>/MathJax.js"></script>
|
||||
<script src="<%= asset_path("mathjax")%>/config/TeX-AMS_HTML-full.js"></script>
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
<div class="news">
|
||||
<div class="nextprev">
|
||||
<% unless news_prev.nil? %>
|
||||
<a href="<%=root_path(news_prev[:out_path])%>">
|
||||
<div class="prev_link">← <%= news_prev.fetch("title", "Untitled Post") %></div>
|
||||
</a>
|
||||
<% end %>
|
||||
<% unless news_next.nil? %>
|
||||
<a href="<%=root_path(news_next[:out_path])%>">
|
||||
<div class="next_link"><%= news_next.fetch("title", "Untitled Post") %> →</div>
|
||||
</a>
|
||||
<% end %>
|
||||
<div class="nextprev_link_sep"> </div>
|
||||
</div>
|
||||
|
||||
<h1><%= title or "Untitled Post" %></h1>
|
||||
<% if defined? author %>
|
||||
<div class="author">By <%= LabMetadata::link_for author %></div>
|
||||
<% end %>
|
||||
|
||||
<div class="content">
|
||||
<%= body %>
|
||||
</div>
|
||||
|
||||
<div class="nextprev">
|
||||
<% unless news_prev.nil? %>
|
||||
<a href="<%=root_path(news_prev[:out_path])%>">
|
||||
<div class="prev_link">← <%= news_prev.fetch("title", "Untitled Post") %></div>
|
||||
</a>
|
||||
<% end %>
|
||||
<% unless news_next.nil? %>
|
||||
<a href="<%=root_path(news_next[:out_path])%>">
|
||||
<div class="next_link"><%= news_next.fetch("title", "Untitled Post") %> →</div>
|
||||
</a>
|
||||
<% end %>
|
||||
<div class="nextprev_link_sep"> </div>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,38 @@
|
|||
|
||||
<h1><%= title %></h1>
|
||||
|
||||
<%= body %>
|
||||
|
||||
<div class="seminar">
|
||||
<% schedule.each do |event| %>
|
||||
<div class="event panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<div style="align: right; float: right; ">
|
||||
<div class="title"><%= event["what"] %></div>
|
||||
<% if event.has_key? "who" %><div class="speaker">
|
||||
<% if event.has_key? "site" %><a href="<%= event["site"] %>"><% end %>
|
||||
<%= event["who"] %>
|
||||
<% if event.has_key? "site" %></a><% end %>
|
||||
</div><% end %>
|
||||
</div>
|
||||
<div>
|
||||
<div class="date"><%= event["when"] %></div>
|
||||
<% if event.has_key? "where" %><div class="location"><%= event["where"] %></div><% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<% if event.has_key? "url" %><center><a href="<%= event["url"] %>" class="paper"><%= event["url"] %></a></center><% end %>
|
||||
<% if event.has_key? "details" %>
|
||||
<% if event["details"].has_key? "abstract" %>
|
||||
<h4>Abstract</h4>
|
||||
<%= event["details"]["abstract"] %>
|
||||
<% end %>
|
||||
<% if event["details"].has_key? "bio" %>
|
||||
<h4>Bio</h4>
|
||||
<%= event["details"]["bio"] %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
Loading…
Reference in New Issue