all repos — h3rald @ d88f7a3095b04e45259adfb0d2611bfa61d75b52

The sources of https://h3rald.com

Upgrated to Nanoc 3.
h3rald h3rald@h3rald.com
Wed, 26 Aug 2009 14:50:24 +0200
commit

d88f7a3095b04e45259adfb0d2611bfa61d75b52

parent

55cd685e7ecada45e543476efb69324c7d37d8ab

M RakefileRakefile

@@ -1,3 +1,4 @@

+require 'nanoc3/tasks' Dir['tasks/**/*.rake'].sort.each { |rakefile| load rakefile} task :default => ["site:update"] do
A Rules

@@ -0,0 +1,51 @@

+#!/usr/bin/env ruby + +"a-look-at-drupal.bbcode +boolean-search.bbcode +cakephp.bbcode +from-firefox-to-deer-park.bbcode +google-earth.bbcode +ie-lovers-guide-to-firefox.bbcode +ma.gnolia.bbcode +next-generation-dvds.bbcode +pagerank.bbcode +perfect-browser.bbcode +pre-review-of-ie7.bbcode +project-gutenberg.bbcode +project-windstone.bbcode +quick-overview-of-sqlite.bbcode +server-packages.bbcode +slax.bbcode +sqlyog5-review.bbcode +web-promotion.bbcode +what-is-ajax.bbcode +log-jan-2009.bluecloth +the-rails-way-review.bluecloth".split(/\n/).each do |s| + f, ident, fil = s.match(/(.+)\.(.+)$/).to_a + compile "/articles/#{ident}" do + rep.filter fil.to_sym + layout 'default' + end +end + +compile /archives/ do + rep.filter :erb + layout 'default' +end + +compile /\/(home|projects|about)/ do + rep.filter :erb + rep.filter :redcloth + layout 'default' +end + +compile '*' do + rep.filter :redcloth + layout 'default' +end + +route '*' do + item.identifier + 'index.html' +end + +layout '*', :erb
D asset_defaults.yaml

@@ -1,6 +0,0 @@

-# Built-in -extension: dat -binary: true -filters: [] - -# Custom
M config.yamlconfig.yaml

@@ -1,3 +1,6 @@

-output_dir: "output" -data_source: "filesystem_combined" -router: "default" +--- +data_sources: +- items_root: / + layouts_root: / + type: filesystem_combined +output_dir: output
M content/articles/22.textilecontent/articles/22.textile

@@ -75,7 +75,7 @@

And so on. Anyhow... I followed the tutorial and yes, it was a nice read. CakePHP borrowed a lot from Rails but not everything. Inevitably Ruby's syntax is less verbose and looks very very clean: -<pre><code> +<% highlight :ruby do %> class RecipeController < ApplicationController scaffold :recipe

@@ -88,11 +88,11 @@ @recipe = Recipe.find(@params["id"])

@categories = Category.find_all end end -</code></pre> +<% end %> While CakePHP's, simply because it uses PHP and not Ruby, looks less pretty: -<pre><code> +<% highlight :php do %> class RecipesController extends AppController { var $scaffold;

@@ -109,7 +109,7 @@ $this->set('categories', $this->Category->findAll());

} } -</code></pre> +<% end %> CakePHP Development Team did a great job translating some of Rails functionalities into PHP, and the while CakePHP's syntax is *much* cleaner if compared to PHP's standard spaghetti-code approach, Ruby just looks much more clear, sorry. _Imagine a world without funny unnecessary brackets, pointless semicolons and where everything just looks better_: that's Ruby.

@@ -119,7 +119,7 @@ One thing I liked about Rails which has not been ported in Cake (yet) is a somehow smarter way of scaffolding. While the Ruby code above actually works, the CakePHP's edit method doesn't, or better, it does but not as expected: when you remove @var $scaffold@ the scaffold is just plain gone, and you have to code everything yourself, while in Ruby you can leave the scaffold and then develop methods one by one, and still be able to use scaffolded methods if you didn't define the custom ones.

The other thing I noticed about RoR is that it definitely handles errors better! This is probably another language issue. I basically forgot to set a category for the recipes, and when executing my custom list of recipes I got a very, very well structured error page showing something like: -<pre><code> +<% highlight :ruby do %> NoMethodError in Recipe#index Showing app/views/recipe/index.rhtml where line #18 raised:

@@ -129,13 +129,13 @@ The error occured while evaluating nil.name

Extracted source (around line #18): -15: <% @recipes.each do |recipe| %> +15: &lt;% @recipes.each do |recipe| %&gt; 16: <tr> -17: <td><%= link_to recipe.title, :action => "show", :id => recipe.id %></td> -18: <td><%= recipe.category.name %></td> -19: <td><%= recipe.date %></td> +17: <td>&lt;%= link_to recipe.title, :action => "show", :id => recipe.id %&gt;</td> +18: <td>&lt;%= recipe.category.name %&gt;</td> +19: <td>&lt;%= recipe.date %&gt;</td> 20: </tr> -21: <% end %> -</code></pre> +21: &lt;% end %&gt; +<% end %> I took a screenshot of the page, because it was too nice: "check it out":http://base--/img/pictures/rails_error.jpg. This error page really tells you what's wrong, and even prints the lines of code around the error! It also lets the developer check the full backtrace and every sort of information... Can we have this in CakePHP please? I actually started to develop something like this, but seemed quite hard to do in PHP.
M content/home.textilecontent/home.textile

@@ -13,7 +13,6 @@ all_articles = latest_articles

latest = latest_articles 5 popular = popular_articles 5 %> -h2. Welcome This is Fabio Cevasco's web site, featuring <%= all_articles.length %> "articles":/archives/ and <%= 5 %> open source "projects":/projects/. Fabio is a full-time technical writer working in Genoa, Italy. In his free time, he enjoys writing (surprise, surprise), reading about technology and programming a little bit in Ruby and other languages.
M content/tags/ajax.textilecontent/tags/ajax.textile

@@ -1,15 +1,15 @@

----- :type: page -:permalink: ajax :title: "Tag: ajax" :filters_pre: - erb - redcloth +:permalink: ajax ----- 3 items are tagged with _ajax_: -<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('ajax')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +<% @site.items.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('ajax')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| %>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> <% end %>
M content/tags/books.textilecontent/tags/books.textile

@@ -1,15 +1,15 @@

----- :type: page -:permalink: books :title: "Tag: books" :filters_pre: - erb - redcloth +:permalink: books ----- 8 items are tagged with _books_: -<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('books')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +<% @site.items.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('books')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| %>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> <% end %>
M content/tags/browsers.textilecontent/tags/browsers.textile

@@ -1,15 +1,15 @@

----- :type: page -:permalink: browsers :title: "Tag: browsers" :filters_pre: - erb - redcloth +:permalink: browsers ----- 7 items are tagged with _browsers_: -<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('browsers')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +<% @site.items.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('browsers')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| %>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> <% end %>
M content/tags/cakephp.textilecontent/tags/cakephp.textile

@@ -1,15 +1,15 @@

----- :type: page -:permalink: cakephp :title: "Tag: cakephp" :filters_pre: - erb - redcloth +:permalink: cakephp ----- 23 items are tagged with _cakephp_: -<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('cakephp')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +<% @site.items.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('cakephp')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| %>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> <% end %>
M content/tags/concatenative.textilecontent/tags/concatenative.textile

@@ -1,15 +1,15 @@

----- :type: page -:permalink: concatenative :title: "Tag: concatenative" :filters_pre: - erb - redcloth +:permalink: concatenative ----- 2 items are tagged with _concatenative_: -<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('concatenative')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +<% @site.items.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('concatenative')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| %>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> <% end %>
M content/tags/databases.textilecontent/tags/databases.textile

@@ -1,15 +1,15 @@

----- :type: page -:permalink: databases :title: "Tag: databases" :filters_pre: - erb - redcloth +:permalink: databases ----- 6 items are tagged with _databases_: -<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('databases')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +<% @site.items.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('databases')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| %>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> <% end %>
M content/tags/firefox.textilecontent/tags/firefox.textile

@@ -1,15 +1,15 @@

----- :type: page -:permalink: firefox :title: "Tag: firefox" :filters_pre: - erb - redcloth +:permalink: firefox ----- 6 items are tagged with _firefox_: -<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('firefox')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +<% @site.items.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('firefox')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| %>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> <% end %>
M content/tags/frameworks.textilecontent/tags/frameworks.textile

@@ -1,15 +1,15 @@

----- :type: page -:permalink: frameworks :title: "Tag: frameworks" :filters_pre: - erb - redcloth +:permalink: frameworks ----- 6 items are tagged with _frameworks_: -<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('frameworks')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +<% @site.items.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('frameworks')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| %>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> <% end %>
M content/tags/google.textilecontent/tags/google.textile

@@ -1,15 +1,15 @@

----- :type: page -:permalink: google :title: "Tag: google" :filters_pre: - erb - redcloth +:permalink: google ----- 5 items are tagged with _google_: -<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('google')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +<% @site.items.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('google')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| %>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> <% end %>
M content/tags/ie.textilecontent/tags/ie.textile

@@ -1,15 +1,15 @@

----- :type: page -:permalink: ie :title: "Tag: ie" :filters_pre: - erb - redcloth +:permalink: ie ----- 2 items are tagged with _ie_: -<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('ie')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +<% @site.items.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('ie')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| %>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> <% end %>
M content/tags/internet.textilecontent/tags/internet.textile

@@ -1,15 +1,15 @@

----- :type: page -:permalink: internet :title: "Tag: internet" :filters_pre: - erb - redcloth +:permalink: internet ----- 12 items are tagged with _internet_: -<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('internet')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +<% @site.items.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('internet')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| %>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> <% end %>
M content/tags/italy.textilecontent/tags/italy.textile

@@ -1,15 +1,15 @@

----- :type: page -:permalink: italy :title: "Tag: italy" :filters_pre: - erb - redcloth +:permalink: italy ----- 3 items are tagged with _italy_: -<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('italy')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +<% @site.items.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('italy')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| %>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> <% end %>
M content/tags/microsoft.textilecontent/tags/microsoft.textile

@@ -1,15 +1,15 @@

----- :type: page -:permalink: microsoft :title: "Tag: microsoft" :filters_pre: - erb - redcloth +:permalink: microsoft ----- 2 items are tagged with _microsoft_: -<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('microsoft')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +<% @site.items.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('microsoft')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| %>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> <% end %>
M content/tags/opensource.textilecontent/tags/opensource.textile

@@ -1,15 +1,15 @@

----- :type: page -:permalink: opensource :title: "Tag: opensource" :filters_pre: - erb - redcloth +:permalink: opensource ----- 10 items are tagged with _opensource_: -<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('opensource')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +<% @site.items.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('opensource')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| %>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> <% end %>
M content/tags/opera.textilecontent/tags/opera.textile

@@ -1,15 +1,15 @@

----- :type: page -:permalink: opera :title: "Tag: opera" :filters_pre: - erb - redcloth +:permalink: opera ----- 2 items are tagged with _opera_: -<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('opera')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +<% @site.items.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('opera')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| %>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> <% end %>
M content/tags/personal.textilecontent/tags/personal.textile

@@ -1,15 +1,15 @@

----- :type: page -:permalink: personal :title: "Tag: personal" :filters_pre: - erb - redcloth +:permalink: personal ----- 6 items are tagged with _personal_: -<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('personal')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +<% @site.items.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('personal')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| %>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> <% end %>
M content/tags/personal_log.textilecontent/tags/personal_log.textile

@@ -1,15 +1,15 @@

----- :type: page -:permalink: personal_log :title: "Tag: personal_log" :filters_pre: - erb - redcloth +:permalink: personal_log ----- 6 items are tagged with _personal_log_: -<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('personal_log')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +<% @site.items.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('personal_log')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| %>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> <% end %>
M content/tags/php.textilecontent/tags/php.textile

@@ -1,15 +1,15 @@

----- :type: page -:permalink: php :title: "Tag: php" :filters_pre: - erb - redcloth +:permalink: php ----- 6 items are tagged with _php_: -<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('php')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +<% @site.items.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('php')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| %>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> <% end %>
M content/tags/politics.textilecontent/tags/politics.textile

@@ -1,15 +1,15 @@

----- :type: page -:permalink: politics :title: "Tag: politics" :filters_pre: - erb - redcloth +:permalink: politics ----- 2 items are tagged with _politics_: -<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('politics')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +<% @site.items.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('politics')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| %>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> <% end %>
M content/tags/productivity.textilecontent/tags/productivity.textile

@@ -1,15 +1,15 @@

----- :type: page -:permalink: productivity :title: "Tag: productivity" :filters_pre: - erb - redcloth +:permalink: productivity ----- 7 items are tagged with _productivity_: -<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('productivity')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +<% @site.items.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('productivity')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| %>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> <% end %>
M content/tags/programming.textilecontent/tags/programming.textile

@@ -1,15 +1,15 @@

----- :type: page -:permalink: programming :title: "Tag: programming" :filters_pre: - erb - redcloth +:permalink: programming ----- 11 items are tagged with _programming_: -<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('programming')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +<% @site.items.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('programming')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| %>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> <% end %>
M content/tags/rails.textilecontent/tags/rails.textile

@@ -1,15 +1,15 @@

----- :type: page -:permalink: rails :title: "Tag: rails" :filters_pre: - erb - redcloth +:permalink: rails ----- 19 items are tagged with _rails_: -<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('rails')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +<% @site.items.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('rails')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| %>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> <% end %>
M content/tags/rant.textilecontent/tags/rant.textile

@@ -1,15 +1,15 @@

----- :type: page -:permalink: rant :title: "Tag: rant" :filters_pre: - erb - redcloth +:permalink: rant ----- 4 items are tagged with _rant_: -<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('rant')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +<% @site.items.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('rant')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| %>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> <% end %>
M content/tags/rawline.textilecontent/tags/rawline.textile

@@ -1,15 +1,15 @@

----- :type: page -:permalink: rawline :title: "Tag: rawline" :filters_pre: - erb - redcloth +:permalink: rawline ----- 5 items are tagged with _rawline_: -<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('rawline')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +<% @site.items.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('rawline')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| %>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> <% end %>
M content/tags/redbook.textilecontent/tags/redbook.textile

@@ -1,15 +1,15 @@

----- :type: page -:permalink: redbook :title: "Tag: redbook" :filters_pre: - erb - redcloth +:permalink: redbook ----- 6 items are tagged with _redbook_: -<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('redbook')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +<% @site.items.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('redbook')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| %>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> <% end %>
M content/tags/review.textilecontent/tags/review.textile

@@ -1,15 +1,15 @@

----- :type: page -:permalink: review :title: "Tag: review" :filters_pre: - erb - redcloth +:permalink: review ----- 33 items are tagged with _review_: -<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('review')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +<% @site.items.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('review')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| %>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> <% end %>
M content/tags/ruby.textilecontent/tags/ruby.textile

@@ -1,15 +1,15 @@

----- :type: page -:permalink: ruby :title: "Tag: ruby" :filters_pre: - erb - redcloth +:permalink: ruby ----- 27 items are tagged with _ruby_: -<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('ruby')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +<% @site.items.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('ruby')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| %>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> <% end %>
M content/tags/software.textilecontent/tags/software.textile

@@ -1,15 +1,15 @@

----- :type: page -:permalink: software :title: "Tag: software" :filters_pre: - erb - redcloth +:permalink: software ----- 4 items are tagged with _software_: -<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('software')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +<% @site.items.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('software')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| %>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> <% end %>
M content/tags/tools.textilecontent/tags/tools.textile

@@ -1,15 +1,15 @@

----- :type: page -:permalink: tools :title: "Tag: tools" :filters_pre: - erb - redcloth +:permalink: tools ----- 4 items are tagged with _tools_: -<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('tools')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +<% @site.items.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('tools')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| %>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> <% end %>
M content/tags/travelling.textilecontent/tags/travelling.textile

@@ -1,15 +1,15 @@

----- :type: page -:permalink: travelling :title: "Tag: travelling" :filters_pre: - erb - redcloth +:permalink: travelling ----- 2 items are tagged with _travelling_: -<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('travelling')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +<% @site.items.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('travelling')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| %>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> <% end %>
M content/tags/tutorial.textilecontent/tags/tutorial.textile

@@ -1,15 +1,15 @@

----- :type: page -:permalink: tutorial :title: "Tag: tutorial" :filters_pre: - erb - redcloth +:permalink: tutorial ----- 4 items are tagged with _tutorial_: -<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('tutorial')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +<% @site.items.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('tutorial')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| %>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> <% end %>
M content/tags/vim.textilecontent/tags/vim.textile

@@ -1,15 +1,15 @@

----- :type: page -:permalink: vim :title: "Tag: vim" :filters_pre: - erb - redcloth +:permalink: vim ----- 2 items are tagged with _vim_: -<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('vim')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +<% @site.items.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('vim')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| %>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> <% end %>
M content/tags/web-development.textilecontent/tags/web-development.textile

@@ -1,15 +1,15 @@

----- :type: page -:permalink: web-development :title: "Tag: web-development" :filters_pre: - erb - redcloth +:permalink: web-development ----- 2 items are tagged with _web-development_: -<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('web-development')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +<% @site.items.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('web-development')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| %>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> <% end %>
M content/tags/web20.textilecontent/tags/web20.textile

@@ -1,15 +1,15 @@

----- :type: page -:permalink: web20 :title: "Tag: web20" :filters_pre: - erb - redcloth +:permalink: web20 ----- 8 items are tagged with _web20_: -<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('web20')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +<% @site.items.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('web20')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| %>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> <% end %>
M content/tags/webdevelopment.textilecontent/tags/webdevelopment.textile

@@ -1,15 +1,15 @@

----- :type: page -:permalink: webdevelopment :title: "Tag: webdevelopment" :filters_pre: - erb - redcloth +:permalink: webdevelopment ----- 12 items are tagged with _webdevelopment_: -<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('webdevelopment')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +<% @site.items.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('webdevelopment')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| %>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> <% end %>
M content/tags/website.textilecontent/tags/website.textile

@@ -1,15 +1,15 @@

----- :type: page -:permalink: website :title: "Tag: website" :filters_pre: - erb - redcloth +:permalink: website ----- 11 items are tagged with _website_: -<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('website')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +<% @site.items.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('website')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| %>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> <% end %>
M content/tags/wedding.textilecontent/tags/wedding.textile

@@ -1,15 +1,15 @@

----- :type: page -:permalink: wedding :title: "Tag: wedding" :filters_pre: - erb - redcloth +:permalink: wedding ----- 6 items are tagged with _wedding_: -<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('wedding')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +<% @site.items.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('wedding')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| %>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> <% end %>
M content/tags/writing.textilecontent/tags/writing.textile

@@ -1,15 +1,15 @@

----- :type: page -:permalink: writing :title: "Tag: writing" :filters_pre: - erb - redcloth +:permalink: writing ----- 15 items are tagged with _writing_: -<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('writing')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +<% @site.items.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('writing')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| %>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> <% end %>
M layouts/comments.htmlayouts/comments.htm

@@ -2,7 +2,7 @@ -----

filter: erb ----- <div id="comments"> - <%= render 'legacy_comments' if @page.comments && @page.comments.length > 0 %> + <%= render 'legacy_comments' if @item[:comments] && @item[:comments].length > 0 %> <script> var idcomments_acct = '7a8e41c4b06641909304090b010e8009'; var idcomments_post_id;
M layouts/default.htmlayouts/default.htm

@@ -5,7 +5,7 @@ <?xml version="1.0" encoding="utf-8"?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> - <title><%= @page.title %> - H3RALD</title> + <title><%= @item[:title] %> - H3RALD</title> <link rel="alternate" type="application/rss+xml" title="RSS" href="http://www.h3rald.com/rss" /> <link rel="alternate" type="application/atom+xml" title="ATOM" href="http://www.h3rald.com/atom" /> <meta name="author" content="Fabio Cevasco" />

@@ -79,23 +79,10 @@ <!-- CONTAINER START -->

<div id="container"> <!-- CONTENT START --> <div id="content" class="clearfix"> - <% if @page.permalink == 'home' then %> - <div id="slider"> - <div class="scroll"> - <div class="scrollContainer"> - <%= @page.content %> - <% else %> <div id="article-content"> - <h2><%= @page.title %></h2> - <%= @page.content %> + <h2><%= @item[:title] %></h2> + <%= yield %> </div> - <% end %> - - <% if @page.permalink == 'home' then %> - </div><!-- .scrollContainer --> - </div><!-- .scroll --> - </div><!-- #slider --> - <% end %> </div> <!-- CONTENT END --> </div>

@@ -108,7 +95,7 @@ <div id="share">

<a class="a2a_dd" href="http://www.addtoany.com/share_save"><img src="http://static.addtoany.com/buttons/share_save_120_16.gif" width="120" height="16" alt="Share/Save/Bookmark"/></a><script type="text/javascript">a2a_linkname=document.title;a2a_linkurl=location.href;a2a_onclick=1;a2a_prioritize=["delicious","stumbleupon","friendfeed","twitter","dzone","digg","reddit","slashdot","facebook","newsvine","sphere","ping"];</script><script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script> <a class="a2a_dd" href="http://www.addtoany.com/subscribe?linkname=&amp;linkurl=http%3A%2F%2Fwww.h3rald.com%2Frss%2F"><img src="http://static.addtoany.com/buttons/subscribe_120_16.gif" width="120" height="16" alt="Subscribe"/></a><script type="text/javascript">a2a_linkname=document.title;a2a_linkurl="http://www.h3rald.com/rss/";a2a_onclick=1;</script><script type="text/javascript" src="http://static.addtoany.com/menu/feed.js"></script> </div> - <% if @page.type == 'article' then %> + <% if @item[:type] == 'article' then %> <%= render 'comments' %> <% else %> <%= render 'services' %>
M layouts/legacy_comments.htmlayouts/legacy_comments.htm

@@ -7,7 +7,7 @@ <h3>Legacy Comments</h3>

<p> <em>These comments were imported automatically from an old version of this web site. Scroll <a href="#idc-container-parent">down</a> for the newest stuff.</em> </p> - <% @page.comments.each do |c| %> + <% @item[:comments].each do |c| %> <div id="comment-<%=c[:id]%>" class="legacy-comment"> <div class="lc-header"><%= (c[:url].empty?) ? c[:author] : %{<a href="#{c[:url]}">#{c[:author]}</a>} %></div> <div class="lc-body">
M lib/bbcode_filter.rblib/bbcode_filter.rb

@@ -1,10 +1,10 @@

require 'rubygems' require 'bb-ruby' -class BbcodeFilter < Nanoc::Filter +class BbcodeFilter < Nanoc3::Filter identifier :bbcode - def run(content) + def run(content, args) content.bbcode_to_html end
M lib/helpers.rblib/helpers.rb

@@ -1,10 +1,12 @@

-module Nanoc::Helpers::Tagging +require 'redcloth' + +module Nanoc3::Helpers::Tagging def site_tags ts = {} - @pages.each do |p| - next unless p.tags - p.tags.each do |t| + @items.each do |p| + next unless p[:tags] + p[:tags].each do |t| if ts[t] ts[t] = ts[t]+1 else

@@ -25,16 +27,16 @@ end

end -module Nanoc::Helpers::Site +module Nanoc3::Helpers::Site def latest_articles(max=nil) - total = @site.pages.select{|p| p.attributes[:date] && p.attributes[:type] == 'article'}.sort{|a, b| a.attributes[:date] <=> b.attributes[:date]}.reverse + total = @site.items.select{|p| p.attributes[:date] && p.attributes[:type] == 'article'}.sort{|a, b| a.attributes[:date] <=> b.attributes[:date]}.reverse max ||= total.length total[0..max-1] end def popular_articles(max=nil) - total = @site.pages.select{|p| p.attributes[:date] && p.attributes[:type] == 'article' && p.attributes[:popular]}.sort{|a, b| a.attributes[:date] <=> b.attributes[:date]}.reverse + total = @site.items.select{|p| p.attributes[:date] && p.attributes[:type] == 'article' && p.attributes[:popular]}.sort{|a, b| a.attributes[:date] <=> b.attributes[:date]}.reverse max ||= total.length total[0..max-1] end

@@ -67,5 +69,6 @@ end

end -include Nanoc::Helpers::Tagging -include Nanoc::Helpers::Site +include Nanoc3::Helpers::Tagging +include Nanoc3::Helpers::Site +include Nanoc3::Helpers::Rendering
M lib/highlighter.rblib/highlighter.rb

@@ -1,7 +1,7 @@

# Monkey patch Nanoc::Helpers::Filtering -module Nanoc::Helpers::Filtering +module Nanoc3::Helpers::Filtering def highlight(syntax, &block) # Seamlessly ripped off from the filter method...

@@ -19,4 +19,4 @@ end

end -include Nanoc::Helpers::Filtering +include Nanoc3::Helpers::Filtering
D page_defaults.yaml

@@ -1,10 +0,0 @@

-# Built-in -layout: default -extension: html -filters_pre: ['redcloth'] -skip_output: false -filters_post: [] -custom_path: -filename: index - -# Custom
M tasks/site.raketasks/site.rake

@@ -2,7 +2,7 @@ require 'rubygems'

require 'extlib' require 'pathname' require 'fileutils' -require 'nanoc' +require 'nanoc3' module SiteUtils

@@ -16,7 +16,7 @@ meta[:permalink] = name

pl = (count == 1) ? ' is' : 's are' contents = %{\n#{count} item#{pl} tagged with _#{name}_: -<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('#{name}')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +<% @site.items.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('#{name}')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| %>* <span class="<%= pg.attributes[:type] %>_link"> <a href="/articles/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> <% end %> }

@@ -65,25 +65,25 @@ (output/'data').mkpath

end task :update => [:copy_resources] do - system "nanoc co" + system "nanoc3 co" end task :run => [:copy_resources] do - system "nanoc aco" + system "nanoc3 aco" end task :rebuild => [:clear_output, :update] do end task :tags do - site = Nanoc::Site.new(YAML.load_file('config.yaml')) + site = Nanoc3::Site.new('.') site.load_data dir = Pathname(Dir.pwd)/'content/tags' dir.rmtree if dir.exist? dir.mkpath tags = {} # Collect tag and page data - site.pages.each do |p| + site.items.each do |p| next unless p.attributes[:tags] p.attributes[:tags].each do |t| if tags[t]

@@ -100,7 +100,7 @@ end

end task :archives do - site = Nanoc::Site.new(YAML.load_file('config.yaml')) + site = Nanoc3::Site.new(YAML.load_file('config.yaml')) site.load_data dir = Pathname(Dir.pwd)/'content/archives' dir.rmtree if dir.exist?
M tasks/typo.raketasks/typo.rake

@@ -12,6 +12,7 @@ require 'iconv'

module TypoUtils + # Ignored by Nanoc 3 def get_filter(db, fid) filter = db[:text_filters].where("id = ?", fid).get(:name).downcase # Multiple filters are not handled (e.g. markdown smartypants)
D templates/article.textile

@@ -1,14 +0,0 @@

------ -permalink: article -filters_pre: -- redcloth -title: New article! -date: -type: page -toc: true -tags: [] ------ - -h2. Title - -...
D templates/page.textile

@@ -1,12 +0,0 @@

------ -permalink: page -filters_pre: -- redcloth -title: New page! -date: -type: page ------ - -h2. Title - -...