all repos — h3rald @ e50daac3bde55f92170a4f81df5baf0da6a62cab

The sources of https://h3rald.com

Added new social icons.
h3rald h3rald@h3rald.com
Fri, 29 Jul 2011 22:06:01 +0200
commit

e50daac3bde55f92170a4f81df5baf0da6a62cab

parent

ceb7b4bf3689ffff1f89185f3b4469a0dc4bb4e9

M content/about.textilecontent/about.textile

@@ -25,7 +25,7 @@ * *"nanoc":http://rubygems.org/gems/nanoc*, to generate the entire web site

* *"Extlib":http://rubygems.org/gems/extlib*, in some custom Rake tasks * *"BB-Ruby":http://rubygems.org/gems/bb-ruby*, for the BBCode filter * *"Builder":http://rubygems.org/gems/builder/*, to create RSS and ATOM feeds -* *"Haml":http://rubygems.org/gems/haml/*, for the SASS filter +* *"Sass":http://sass-lang.com/*, for the SASS filter * *"CodeRay":http://rubygems.org/gems/coderay/*, for syntax highlighting * *"RedCloth":http://rubygems.org/gems/redcloth/*, for Textile support * *"BlueCloth":http://rubygems.org/gems/bluecloth/*, for Markdown support
M content/home.erbcontent/home.erb

@@ -19,12 +19,13 @@ %>

<section id="topbar"> <nav id="social"> <ul> - <li><a href="http://www.h3rald.com/rss" rel="external"><img src="/images/social/feed-48x48.png" alt="RSS" /></a></li> - <li><a href="http://foursquare.com/h3rald" rel="external"><img src="/images/social/foursquare-48x48.png" alt="foursquare" /></a></li> - <li><a href="http://www.twitter.com/h3rald" rel="external"><img src="/images/social/twitter-48x48.png" alt="RSS" /></a></li> - <li><a href="http://it.linkedin.com/in/fabiocevasco" rel="external"><img src="/images/social/linkedin-48x48.png" alt="linkedin" /></a></li> - <li><a href="http://pinboard.in/u:h3rald" rel="external"><img src="/images/social/pinboard-48x48.png" alt="pinboard" /></a></li> - <li><a href="http://reddit.com/user/h3rald" rel="external"><img src="/images/social/reddit-48x48.png" alt="reddit" /></a></li> + <li><a href="http://www.h3rald.com/rss" rel="external"><img src="/images/social/rss.png" alt="RSS" /></a></li> + <li><a href="http://foursquare.com/h3rald" rel="external"><img src="/images/social/foursquare.png" alt="FourSquare" /></a></li> + <li><a href="http://www.twitter.com/h3rald" rel="external"><img src="/images/social/twitter.png" alt="RSS" /></a></li> + <li><a href="http://it.linkedin.com/in/fabiocevasco" rel="external"><img src="/images/social/linkedin.png" alt="LinkedIn" /></a></li> + <li><a href="https://github.com/h3rald" rel="external"><img src="/images/social/github.png" alt="GitHub" /></a></li> + <li><a href="http://reddit.com/user/h3rald" rel="external"><img src="/images/social/reddit.png" alt="Reddit" /></a></li> + <li><a href="http://gplus.to/h3rald" rel="external"><img src="/images/social/google-plus.png" alt="Google+" /></a></li> </ul> </nav> <aside id="search">
M content/styles/_layout.scsscontent/styles/_layout.scss

@@ -94,14 +94,14 @@

#topbar { margin: auto; margin-top: 20px; - height: 92px; + height: 60px; + border-top: 1px solid $light-gray; text-align: right; width: 940px; - border: 1px solid $light-gray; } #social { - margin-top: 20px; + margin-top: 10px; float: left; li { float:left;} a {

@@ -133,6 +133,7 @@ /* Main */

#main-content { margin: 0.5em 0; + margin-top: 0; width: 555px; text-align: justify; border-right: 1px solid $light-gray;
M content/styles/_vendor.scsscontent/styles/_vendor.scss

@@ -14,10 +14,7 @@

/* Google Custom Search */ #search { - margin: 10px; - padding: 10px; - height: 50px; - border: 1px solid $light-gray; + margin-top: 10px; width: 270px; float: right; }
M layouts/default.erblayouts/default.erb

@@ -102,7 +102,7 @@ <section>

<nav> <a href="/about/">ABOUT</a>|<a href="/contact/">CONTACT</a> </nav> - <p>H3RALD Web Site v8.1.1 &copy; 2004 &mdash; 2011 <em>Fabio Cevasco</em></p> + <p>H3RALD Web Site v8.1.2 &copy; 2004 &mdash; 2011 <em>Fabio Cevasco</em></p> </section> </footer> </section><!-- #container end -->
M lib/helpers.rblib/helpers.rb

@@ -41,25 +41,29 @@ end

module Nanoc3::Helpers::Blogging - def prepare_feed(params) - # Extract parameters - @item[:limit] ||= 10 - @item[:articles] = params[:articles] || latest_articles(10) || [] - @item[:content_proc] = params[:content_proc] || lambda { |a| a.reps[0].content_at_snapshot(:pre)} - @item[:excerpt_proc] = params[:excerpt_proc] || lambda { |a| a[:excerpt] } - @item[:author_uri] ||= @site.config[:base_url] - @item[:author_name] ||= @site.config[:author_name] + def check_data(params) raise RuntimeError.new('Cannot build feed: site configuration has no base_url') if @site.config[:base_url].nil? raise RuntimeError.new('Cannot build feed: feed item has no title') if @item[:title].nil? - raise RuntimeError.new('Cannot build feed: no articles') if @item[:articles].empty? - raise RuntimeError.new('Cannot build feed: one or more articles doesn\'t have a date') if @item[:articles].any? { |a| a[:date].nil? } - @item[:last] = @item[:articles].first + raise RuntimeError.new('Cannot build feed: no articles') if feed_articles(params).empty? + raise RuntimeError.new('Cannot build feed: one or more articles doesn\'t have a date') if feed_articles(params).any? { |a| a[:date].nil? } + end + + def feed_articles(params) + params[:articles] || latest_articles(10) + end + + def feed_content_proc(params) + params[:content_proc] || lambda { |a| a.reps[0].content_at_snapshot(:pre)} + end + + def feed_excerpt_proc(params) + params[:excerpt_proc] || lambda { |a| a[:excerpt] } end def rss_feed(params={}) require 'builder' require 'time' - prepare_feed params + check_data params # Create builder buffer = '' xml = Builder::XmlMarkup.new(:target => buffer, :indent => 2)

@@ -69,14 +73,14 @@ xml.rss(:version => '2.0') do

xml.channel do xml.title @item[:title] xml.language 'en-us' - xml.lastBuildDate @item[:last][:date].rfc822 + xml.lastBuildDate feed_articles(params).first[:date].rfc822 xml.ttl '40' xml.link @site.config[:base_url] xml.description - @item[:articles].each do |a| + feed_articles(params).each do |a| xml.item do xml.title a[:title] - xml.description @item[:content_proc].call(a) + xml.description feed_content_proc(params).call(a) xml.pubDate a[:date].rfc822 xml.guid url_for(a) xml.link url_for(a)

@@ -96,22 +100,22 @@ # Redefine atom_feed method

def atom_feed(params={}) require 'builder' require 'time' - prepare_feed params + check_data params buffer = '' xml = Builder::XmlMarkup.new(:target => buffer, :indent => 2) xml.instruct! xml.feed(:xmlns => 'http://www.w3.org/2005/Atom') do xml.id @site.config[:base_url] + '/' xml.title @item[:title] - xml.updated @item[:last][:date].to_iso8601_time + xml.updated feed_articles(params).first[:date].to_iso8601_time xml.link(:rel => 'alternate', :href => @site.config[:base_url]) xml.link(:rel => 'self', :href => @site.config[:base_url]+"/#{@item[:permalink]}/") xml.author do - xml.name @item[:author_name] - xml.uri @item[:author_uri] + xml.name(@item[:author_name] || @site.config[:author_name]) + xml.uri(@item[:author_uri] || @site.config[:base_url]) end count = 0 - @item[:articles].each do |a| + feed_articles(params).each do |a| xml.entry do xml.id atom_tag_for(a) xml.title a[:title]

@@ -123,10 +127,10 @@ xml.link(:rel => 'alternate', :href => url_for(a))

a[:tags].each do |t| xml.category(:term => t, :scheme => "#{@site.config[:base_url]}/tags/#{t}/") end - summary = @item[:excerpt_proc].call(a) + summary = feed_excerpt_proc(params).call(a) xml.summary summary, :type => 'html' unless summary.nil? xml.content(:type => 'html') do |c| - c << %{<![CDATA[\n#{@item[:content_proc].call(a)}]]>\n} + c << %{<![CDATA[\n#{feed_content_proc(params).call(a)}]]>\n} end end end