Browse Source

Added nanoc stuff

master
parent
commit
739e68ea34
  1. 3
      .gems
  2. 6
      Rakefile
  3. 107
      Rules
  4. 10
      config.rb
  5. 92
      config.yaml
  6. 94
      content/html/en/blog.erb
  7. 52
      content/html/en/index.erb
  8. 96
      content/html/fr/blog.erb
  9. 97
      content/html/fr/index.erb
  10. 4
      content/sitemap/sitemap.html
  11. 7
      content/xml/en/feed.html
  12. 7
      content/xml/fr/feed.html
  13. 1
      latest.md
  14. 183
      layouts/article.html
  15. 97
      layouts/default.html
  16. 70
      layouts/error.html
  17. 17
      layouts/feed.html
  18. 127
      layouts/main.html
  19. 3
      layouts/sitemap.html
  20. 31
      lib/analytics.rb
  21. 15
      lib/calendar.rb
  22. 32
      lib/css.rb
  23. 14
      lib/gitmtime.rb
  24. 29
      lib/graph.rb
  25. 17
      lib/helpers.rb
  26. 32
      lib/html.rb
  27. 26
      lib/intenseDebate.rb
  28. 52
      lib/macros.rb
  29. 3
      lib/mail.rb
  30. 30
      lib/multi.rb
  31. 179
      lib/multiMenu.rb
  32. 40
      lib/nanoc_item_conf.rb
  33. 64
      lib/repair_html.rb
  34. 68
      lib/syntaxColorize.rb
  35. 112
      lib/tag.rb
  36. 40
      lib/ultraviolet.rb
  37. 166
      lib/y.rb
  38. 121
      multi/blog.erb
  39. 133
      multi/index.erb
  40. 0
      site/Scratch/en/blog/feed/feed.xml
  41. 195
      site/Scratch/en/blog/index.html
  42. 186
      site/Scratch/en/index.html
  43. 0
      site/Scratch/fr/blog/feed/feed.xml
  44. 198
      site/Scratch/fr/blog/index.html
  45. 231
      site/Scratch/fr/index.html
  46. 12
      site/Scratch/sitemap.xml
  47. 37
      site/css/main.css
  48. 21
      site/example.html
  49. 8
      site/humans.txt
  50. 18
      site/src/main.scss
  51. 153
      site/stylesheets/less.css
  52. 4
      site/stylesheets/main.css
  53. 57
      tasks/auto_tags/all_frequencies.rb
  54. 69
      tasks/auto_tags/density.rb
  55. 4350
      tasks/auto_tags/frequencies.val
  56. 72
      tasks/auto_tags/tf.rb
  57. 22
      tasks/autopublish
  58. 29
      tasks/config
  59. 19
      tasks/create-reference-file.sh
  60. 55
      tasks/ghpublish
  61. 20
      tasks/hpublish
  62. 96
      tasks/incPublish
  63. 60
      tasks/multi.vim
  64. 65
      tasks/new_blog_entry
  65. 128
      tasks/publish
  66. 42
      tasks/recompile
  67. 7
      tasks/reinitWebsite.sh
  68. 7
      tasks/resetWebSite.sh
  69. 11
      tasks/serve.py
  70. 108
      tasks/webdav-framework

3
.gems

@ -0,0 +1,3 @@
rack
rack-contrib
rack-rewrite

6
Rakefile

@ -0,0 +1,6 @@
require 'nanoc3/tasks'
require 'rake/clean'
CLEAN.include('tmp/**/*')
CLOBBER.include('output/Scratch/{en,fr,assets}')

107
Rules

@ -0,0 +1,107 @@
#!/usr/bin/env ruby
# engendrement des fichiers html
# page d'Accueil
#route '/' do
# '/index.html'
#end
# CSS
compile '/css/*' do
filter :no_custom_css
filter :sass
filter :rainpress
end
route '/css/*' do
'/Scratch/assets' + item.identifier.chop + '.css'
end
compile '/img/*' do
end
route '/img/*' do
'/Scratch/assets' + item.identifier.chop + '.png'
end
compile '/css/raw/*' do
end
route '/css/raw/*' do
'/Scratch' + item.identifier.sub(/raw\//,'').chop + '.css'
end
# JS
compile '/js/*' do
end
route '/js/*' do
'/Scratch/assets' + item.identifier.chop + '.js'
end
compile '/html' do
filter :erb
layout 'main' unless item[:layout] == "none"
end
route '/html' do
'/index.html'
end
compile '/html/*' do
# item[:extension] returns 'html.erb' for multi-dotted filename
ext = item[:extension].nil? ? nil : item[:extension].split('.').last
filter :ultraviolet # must be before kramdown
filter :graph
filter :description
filter :falacy
if ext == 'erb'
filter :erb
elsif ext == 'haml' || ext.nil?
filter :haml
elsif ext == 'md' || ext == 'markdown'
filter :erb
filter :kramdown
filter :math_repair # after kramdown
else
raise "Filter is not configured for #{item.identifier} in Rules file."
end
filter :multicorps # must be before firsthi
filter :firsthi # must be after multicorps
filter :frenchspace
filter :ytypo
# filter :yabbreviations
filter :footnotes
if item[:kind] == 'article'
layout 'main'
elsif not item[:layout].nil?
layout item[:layout]
else
layout 'main' unless item[:layout] == "none"
end
end
route '/html/*' do
'/Scratch' + item.identifier.sub('/html','') + 'index.html'
end
# feed
compile '/xml/*' do
layout 'feed'
end
route '/xml/en/*' do
'/Scratch/en/blog/feed/feed.xml'
end
route '/xml/fr/*' do
'/Scratch/fr/blog/feed/feed.xml'
end
compile '/sitemap/*' do
layout 'sitemap'
end
route '/sitemap/*' do
'/Scratch/sitemap.xml'
end
layout '*', :erb

10
config.rb

@ -0,0 +1,10 @@
http_path = "/"
project_path = "."
sass_dir = "compass"
css_dir = "output/Scratch/assets/css"
images_dir = "output/Scratch/assets/img"
# wehn using SCSS:
sass_options = {
:syntax => :scss
}

92
config.yaml

@ -0,0 +1,92 @@
---
data_sources:
- items_root: /
layouts_root: /
type: filesystem_unified
output_dir: site
ultraviolet_theme: "twilight"
webprefix: "/Scratch"
base_url: "http://yannesposito.com"
author_uri: "http://yannesposito.com"
rss_uri:
fr: "http://feeds.feedburner.com/yannespositocomfr"
en: "http://feeds.feedburner.com/yannespositocomen"
# les langues
languages:
- fr
- en
# les formats de date en fonction de la langue
dateFormat:
fr: "%d/%m/%Y"
en: "%m/%d/%Y"
# le dictionnaire pour les mots communs
translations:
author:
fr: "auteur"
en: "author"
langue:
fr: "langue"
en: "language"
switchTo:
fr: "en Français"
en: "in English"
clickForComment:
fr: "Commentaires"
en: "Comments"
liens:
fr: "liens"
en: "links"
telecharger:
fr: "télécharger"
en: "download"
nojsclickme:
fr: "Javascript semble désactivé ;<br/> cliquez ici"
en: "Javascript seems disabled <br/> click on me"
nextArticles:
fr: "articles suivants"
en: "next entries"
next:
fr: "suivant"
en: "next"
previousArticles:
fr: "articles précédents"
en: "previous entries"
previous:
fr: "précédent"
en: "previous"
comment:
fr: "commentaires"
en: "comments"
onlyin:
fr: "Seulement en"
en: "Only in"
whatsthis:
fr: "Qu'est-ce que c'est ?"
en: "What's this?"
loading:
fr: "Chargement en cours..."
en: "loading..."
entirely_done_with:
en: "Entirely done with"
fr: "Site entièrement réalisé avec"
and:
en: "and"
fr: "et"
created_at:
en: "Created"
fr: "Écrit le "
last_modified:
en: "Modified"
fr: "modifié le "
copyright:
en: "<a rel=\"license\" href=\"http://creativecommons.org/licenses/by-sa/3.0/\">Copyright ©, Yann Esposito</a>"
fr: "<a rel=\"license\" href=\"http://creativecommons.org/licenses/by-sa/3.0/deed.fr\">Droits de reproduction ©, Yann Esposito</a>"
subscribe:
en: "Subscribe"
fr: "s'abonner"
enableJavascriptToComment:
en: "You must enable javascript to comment."
fr: "Vous devez activer javascript pour commenter."

94
content/html/en/blog.erb

@ -0,0 +1,94 @@
-----
kind: blog
title: Blog
menupriority: 2
noSubMenu: true
-----
<%
number_of_articles=5
number_of_char_for_resume=800
language=@item_rep.path.sub(/\/Scratch\//,'').sub(/\/.*$/,'')
last_articles = @items.select do |a|
a.reps[0].path =~ /\/#{language}\// && a[:kind] == 'article'
end
last_articles=last_articles.sort { |x,y| y[:created_at] <=> x[:created_at] }[0..(number_of_articles-1)]
def dArr
return %{<span class="nicer">&dArr;</span>}
end
%>
<ul>
<li> <a href="#last-articles"><%= number_of_articles %> latest articles <%=dArr%></a> </li>
<li> <a href="#tagcloud">Tag Cloud <%=dArr%></a></li>
<li> <a href="#archives">Achives <%=dArr%></a></li>
<li> <a href="#two-words-about-the-content">Two words about the content <%=dArr%></a></li>
</ul>
<h2 id="last-articles">
Last <%= number_of_articles %> Articles
</h2>
</div>
<% last_articles.each do |a| %>
<h1>
<%= calendar_for( a[:created_at], language ) %>
<%= link_to(a[:title]+%{ <span class="nicer">»</span>}, a) %>
</h1>
<div class="corps">
<%
puts "%%%"
puts excerptize( a.reps[0].compiled_content, {:length => number_of_char_for_resume})
puts "%%%"
%>
<%= repair_html ( excerptize( a.reps[0].compiled_content, {:length => number_of_char_for_resume} ) ) %>
<div class="flush"></div>
<div>
<p>
<%= link_to(%{Read more <span class="nicer">»</span>}, a) %>
</p>
</div>
</div>
<% end %>
<div class="corps">
<div>
<%= tagCloud %>
</div>
</div>
<h2 id="archives">Archives</h2>
<%= generateBlogSubMenu(language) %>
<h2 id="two-words-about-the-content">
Two words about the content
</h2>
<div class="corps">
<p>
Here you'll can find mostly technical articles.
Some are just reminder of technical tips.
But some are long and technically detailled articles.
</p>
<hr/>
<p>
I do my best to traduce each page in french and in english.
It not always easy. English is not my natural language.
I make many errors, orthographic, grammatical, typographical&hellip;
</p>
<p>
<strong> Thanks not to judge me based on these errors! And don't forget content is more important than presentation! </strong>
</p><p>
The first impression I'll let you if we meet in real life should be different from the one I let you based on my website.
</p><p>
I wish you to find something useful or interesting on this website.
</p>

52
content/html/en/index.erb

@ -0,0 +1,52 @@
---
title: YPassword
noSubMenu: true
no_entete: true
---
<% content_for :title do %>
<span style="font-weight: normal; margin-top: 0; line-height: 1ex">
<span style="letter-spacing:-.10em">YPassword</span>
</span>
<% end %>
<% content_for :subtitle do %>
<span style="letter-spacing: 1em">Yogsototh</span>
<% end %>
<div class="flush"></div>
<div class="block left">
<h3>
<a href="<%=@config[:webprefix]%>/en/blog/" onclick="setLanguage('en')">
Blog
<span class="nicer">»</span>
</a>
</h3>
<p>
Computer, Philosophy <i>&amp;</i> Life.
</p>
</div>
<div class="block left">
<h3>
<a href="<%=@config[:webprefix]%>/en/softwares" onclick="setLanguage('en')">
Softwares
<span class="nicer">»</span>
</a>
</h3>
<p>
Password Manager,
Screensavers <i>&amp;</i>
Scientific Applications.
</p>
</div>
<div class="block right">
<h3>
<a href="<%=@config[:webprefix]%>/en/about/contact" onclick="setLanguage('en')">Contact
<span class="nicer">»</span>
</a>
</h3>
<p>
Don't be shy, I'll be happy to talk to <i>you</i>.
</p>
</h3>
</div>
<div class="flush"></div>

96
content/html/fr/blog.erb

@ -0,0 +1,96 @@
-----
kind: blog
title: Blog
menupriority: 2
noSubMenu: true
-----
<%
number_of_articles=5
number_of_char_for_resume=800
language=@item_rep.path.sub(/\/Scratch\//,'').sub(/\/.*$/,'')
last_articles = @items.select do |a|
a.reps[0].path =~ /\/#{language}\// && a[:kind] == 'article'
end
last_articles=last_articles.sort { |x,y| y[:created_at] <=> x[:created_at] }[0..(number_of_articles-1)]
def dArr
return %{<span class="nicer">&dArr;</span>}
end
%>
<ul>
<li> <a href="#last-articles">Les <%= number_of_articles %> derniers articles <%=dArr%></a></li>
<li> <a href="#tagcloud">Nuage de mots clés <%=dArr%></a></li>
<li> <a href="#archives">Achives <%=dArr%></a></li>
<li> <a href="#un-petit-mot-sur-le-contenu">Un petit mot sur le contenu <%=dArr%></a></li>
</ul>
<h2 id="last-articles">
Les <%= number_of_articles %> derniers articles
</h2>
</div>
<% last_articles.each do |a| %>
<h1>
<%= calendar_for( a[:created_at], language ) %>
<%= link_to(a[:title]+%{ <span class="nicer">»</span>}, a) %>
</h1>
<div class="corps">
<%
puts "%%%"
puts excerptize( a.reps[0].compiled_content, {:length => number_of_char_for_resume})
puts "%%%"
%>
<%= repair_html ( excerptize( a.reps[0].compiled_content, {:length => number_of_char_for_resume} ) ) %>
<div class="flush"></div>
<div>
<p>
<%= link_to(%{en lire plus <span class="nicer">»</span>}, a) %>
</p>
</div>
</div>
<% end %>
<div class="corps">
<div>
<%= tagCloud %>
</div>
</div>
<h2 id="archives">Archives</h2>
<%= generateBlogSubMenu(language) %>
<h2 id="un-petit-mot-sur-le-contenu">
Un petit mot sur le contenu
</h2>
<div class="corps">
<p>
Vous trouverez ici des articles qui sont pour la plupart
écrits en anglais et qui sont techniques.
Certain sont justes là pour me souvenir de petits trucs, que
d'autres pourraient trouver utiles. Mais il y a aussi de
long articles techniques qui vont un peu plus dans les détails.
</p><p>
<hr/>
<p>
Je fais de mon mieux pour traduire chaque page en anglais et en français.
Cependant, ce n'est pas toujours évident.
Il m'arrive de faire de nombreuses fautes d'orthographes, des erreurs typographiques et autres.
</p>
<p>
<strong> Merci de ne pas me juger sur ces erreurs et de ne pas oublier que le fond est plus important que la forme. </strong>
</p><p>
L'impression que ce site laisse de moi n'est certainement pas l'impression que je vous laisserais si on se rencontrait.
</p><p>
Je vous souhaite de trouver ce que vous cherchez sur ce site.
</p>

97
content/html/fr/index.erb

@ -0,0 +1,97 @@
---
title: Bienvenue
noSubMenu: true
no_entete: true
---
<% content_for :title do %>
<span style="font-weight: normal; margin-top: 0; line-height: 1ex">
<span style="letter-spacing:-.10em">YPassword</span>
</span>
<% end %>
<% content_for :subtitle do %>
<span style="letter-spacing: 1em">Yogsototh</span>
<% end %>
<div class="flush"></div>
<div class="block left">
<h3>
<a href="<%=@config[:webprefix]%>/fr/blog/" onclick="setLanguage('fr')">
Blog
<span class="nicer">»</span>
</a>
</h3>
<p>
Ordinateurs, philosophie <i>&amp;</i> des choses de la vie.
</p>
</div>
<div class="block left">
<h3>
<a href="<%=@config[:webprefix]%>/fr/softwares" onclick="setLanguage('fr')">
Logiciels
<span class="nicer">»</span>
</a>
</h3>
<p>
Des économiseurs d'écran,
un gestionnaire de mots de passe <i>&amp;</i>
des applications scientifiques.
</p>
</div>
<div class="block right">
<h3>
<a href="<%=@config[:webprefix]%>/fr/about/contact" onclick="setLanguage('fr')">
Contact
<span class="nicer">»</span>
</a>
</h3>
<p>
Au diable la timidité, n'hésitez pas à me contacter, je serai ravi de <i>vous</i> parler.
</p>
</div>
<div class="flush"></div>
<div class="block left">
<h3>
<a href="http://j.mp/btfRJ2">
Curriculum Vitæ
<span class="nicer">»</span>
</a>
</h3>
<p>
Doctorat &rarr; Post Doc &rarr; Consultant<br/>
<i>Geek &rarr; G33K &rarr; G33|&lt;
</i>
</p>
</h4>
</div>
<div class="block left">
<h3>
<a href="http://yann.esposito.free.fr/enseignement/enseignement.php">
Enseignement
<span class="nicer">»</span>
</a>
</h3>
<p>
Informatique:<br/>
TD, TD <i>&amp;</i> solutions<br/>
BAC+1 à BAC+5<br/>
<i><a href="http://yann.esposito.free.fr/enseignement/projetrez0/projetrez0.html">Projet réseau anonyme
<span class="nicer">»</span></a>
</i>
</p>
</div>
<div class="block right">
<h3>
<a href="http://web.me.com/yann.esposito/Perso/Welcome.html">
Photos
<span class="nicer">»</span>
</a>
</h3>
<p>
<a href="mailto:yannesposito@gmail.com?Subject=Permission%20site%20famille" >
Cliquez ici pour avoir le mot de passe.
<span class="nicer">»</span>
</a>
</p>
</div>
<div class="flush"></div>

4
content/sitemap/sitemap.html

@ -0,0 +1,4 @@
---
---
used for generating sitemap.

7
content/xml/en/feed.html

@ -0,0 +1,7 @@
---
title: "Yogsototh's last blogs entries"
author_name: "Yann Esposito"
feed_url: "http://feeds.feedburner.com/yannespositocomen"
---
used for generating feeds.

7
content/xml/fr/feed.html

@ -0,0 +1,7 @@
---
title: "Yogsototh's last blogs entries"
author_name: "Yann Esposito"
feed_url: "http://feeds.feedburner.com/yannespositocomfr"
---
Utilisé pour engendrer mes feeds.

1
latest.md

@ -0,0 +1 @@
./multi/blog/2011-04-20-Now-hosted-on-github.md

183
layouts/article.html

@ -0,0 +1,183 @@
-----
-----
<% language, languages, blog, article = setItemConf %><?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="fr" xml:lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<% t=tags %>
<% if t.length > 0 %>
<meta name="keywords" content="<%= t %>">
<% end %>
<link rel="shortcut icon" type="image/x-icon" href="<%=@config[:webprefix]%>/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="<%=@config[:webprefix]%>/assets/css/main.css" />
<link rel="stylesheet" type="text/css" href="<%=@config[:webprefix]%>/css/twilight.css" />
<link rel="stylesheet" type="text/css" href="<%=@config[:webprefix]%>/css/idc.css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="http://feeds.feedburner.com/yannespositocom<%= language %>"/>
<%
languages.each do |lang|
item_for_lang=item_of_language(lang)
if not item_for_lang.nil? %>
<link rel="alternate" lang="<%= lang %>" xml:lang="<%= lang %>" title="<%= item_for_lang[:title] %>" type="text/html" hreflang="<%= lang %>" href="<%= item_for_lang.reps[0].path %>" /> <%
end
end %>
<script type="text/javascript" src="<%=@config[:webprefix]%>/js/jquery-1.3.1.min.js"></script>
<script type="text/javascript" src="<%=@config[:webprefix]%>/js/jquery.cookie.js"></script>
<script type="text/javascript" src="<%=@config[:webprefix]%>/js/index.js"></script>
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<!-- < % if containMaths %>
<script type="text/javascript" src="<%=@config[:webprefix]%>/js/MathJax/MathJax.js"></script>
< % end %>
-->
<title><%= @item[:title] %></title>
</head>
<body lang="<%= language %>">
<script type="text/javascript">// <![CDATA[
document.write('<div id="blackpage"><img src="<%=@config[:webprefix]%>/img/loading.gif" alt="<%= tradOf(:loading) %>"/></div>');
// ]]>
</script>
<div id="content">
<div id="choix">
<div class="return"><a href="#entete">&darr; Menu &darr;</a></div>
<div id="choixlang">
<%= languages.map do |l|
dest=@item_rep.path.sub(%r{#{@config[:webprefix]}/../}, %{#{config[:webprefix]}/#{l}/})
if @item_rep.path != dest
%{<a href="#{dest}" onclick="setLanguage('#{l}')">#{ tradOfKeywordIn(:switchTo,l)}</a>}
else
nil
end
end.join() %>
</div>
</div>
<div id="titre">
<h1>
<%= @item[:title] %>
</h1>
<% unless @item[:subtitle].nil? %>
<h2>
<%= @item[:subtitle] %>
</h2>
<% end %>
</div>
<div class="flush"></div>
<% if @item[:content_for_summary] %>
<div class="corps summary">
<% @item[:content_for_summary] %>
</div>
<% end %>
<%= generateSubMenu %>
<div class="flush"></div>
<div id="afterheader">
<div class="corps">
<%= yield %>
</div>
<% depth = depthOf(@item) %>
<% if depth > 3 or ( depth == 3 and @item.children.length > 0 ) %>
<div class="navigation">
<div class="navigationprev"><%= previousFor(@item) %></div>
<div class="navigationnext"><%= nextFor(@item) %></div>
</div>
<div class="flush"></div>
<% end %>
<div id="choixrss">
<a id="rss" href="http://feeds.feedburner.com/yannespositocom<%= language %>">
<%= tradOf(:subscribe) %>
</a>
</div>
<script type="text/javascript">
$(document).ready(function(){
$('#comment').hide();
$('#clickcomment').click(showComments);
});
function showComments() {
$('#comment').show();
$('#clickcomment').fadeOut();
}
document.write('<div id="clickcomment"><%= tradOf(:clickForComment) %></div>');
</script>
<div class="flush"></div>
<div class="corps" id="comment">
<h2 class="first"><%= tradOf(:comment) %></h2>
<noscript>
<%= tradOf(:enableJavascriptToComment) %>
</noscript>
<%= generateIntenseDebateThread %>
</div>
<div id="entete" class="corps_spaced">
<div id="liens">
<%= generateMenu %>
</div>
<div class="flush"></div>
<hr/>
<div id="next_before_articles">
<div id="previous_articles">
<%= tradOf(:previousArticles) %>
<%
(1..3).each do |n|
a=article_brother(-n)
if not a.nil?
%>
<div class="previous_article">
<%= link_to( %{<span class="nicer">«</span>&nbsp;}+ a[:title], a) %>
</div>
<% end %>
<% end %>
</div>
<div id="next_articles">
<%= tradOf(:nextArticles) %>
<%
(1..3).each do |n|
a=article_brother(n)
if not a.nil?
%>
<div class="next_article">
<%= link_to(a[:title] + %{&nbsp;<span class="nicer">»</span>}, a) %>
</div>
<% end %>
<% end %>
</div>
<div class="flush"></div>
</div>
</div>
<div id="bottom">
<div>
<%=tradOf(:copyright) %>
</div>
<div id="lastmod">
<%=tradOf(:created_at)%>: <%= @item[:created_at].strftime(@config[:dateFormat][language.intern]) %>
<%=tradOf(:last_modified)%>: <%= gitmtime.strftime(@config[:dateFormat][language.intern]) %>
</div>
<div>
<%= tradOf(:entirely_done_with) %>
<a href="http://www.vim.org">Vim</a>
<%= tradOf(:and) %>
<a href="http://nanoc.stoneship.org">nanoc</a>
</div>
<div>
<a href="<%=@config[:webprefix]%>/<%=language%>/validation/">Validation</a>
<a href="http://validator.w3.org/check?uri=referer"> [xhtml] </a>
.
<a href="http://jigsaw.w3.org/css-validator/check/referer?profile=css3"> [css] </a>
.
<a href="http://validator.w3.org/feed/check.cgi?url=http%3A//yannesposito.com<%=@config[:webprefix]%>/<%=language%>/blog/feed/feed.xml">[rss]</a>
</div>
</div>
<div class="clear"></div>
</div>
<%= clicky_analytics %>
</body>
</html>

97
layouts/default.html

@ -0,0 +1,97 @@
-----
-----
<% language, languages, blog, article = setItemConf %><?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="fr" xml:lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<%= meta_tags %>
<link rel="shortcut icon" type="image/x-icon" href="<%=@config[:webprefix]%>/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="<%=@config[:webprefix]%>/assets/css/main.css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="<%= @config[:rss_uri][language.intern] %>"/>
<%= meta_alternate %>
<script type="text/javascript" src="<%=@config[:webprefix]%>/js/jquery-1.3.1.min.js"></script>
<script type="text/javascript" src="<%=@config[:webprefix]%>/js/jquery.cookie.js"></script>
<script type="text/javascript" src="<%=@config[:webprefix]%>/js/index.js"></script>
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<title><%= @item[:title] %></title>
</head>
<body lang="<%= language %>">
<script type="text/javascript">// <![CDATA[
document.write('<div id="blackpage"><img src="<%=@config[:webprefix]%>/img/loading.gif" alt="<%= tradOf(:loading) %>"/></div>');
// ]]>
</script>
<div id="content">
<% unless @item[:no_entete] %>
<div id="entete">
<div id="choix">
<div id="choixrss"><%= choixrss %> </div>
<div id="choixlang"><%= choixlang %> </div>
<div id="liens">
<%= generateMenu %>
</div>
</div>
</div>
<% end %>
<img src="<%=@config[:webprefix]%>/img/presentation.png" alt="Presentation drawing"/>
<div id="titre">
<h1>
<%= @item[:content_for_title].nil? ? @item[:title] : @item[:content_for_title] %>
</h1>
<% unless @item[:subtitle].nil? and @item[:content_for_subtitle].nil? %>
<h2>
<%= @item[:content_for_subtitle].nil? ? @item[:subtitle] : @item[:content_for_subtitle] %>
</h2>
<% end %>
</div>
<div class="flush"></div>
<% if @item[:content_for_summary] %>
<div class="corps summary">
<% @item[:content_for_summary] %>
</div>
<% end %>
<%= generateSubMenu %>
<div class="flush"></div>
<div id="afterheader">
<div class="corps">
<%= yield %>
<% unless @item[:no_entete] %>
<div class="return"><a href="#entete" onclick="fastShowMenu()">&uarr;</a></div>
<% end %>
</div>
<div id="bottom">
<div>
<%=tradOf(:copyright) %>
</div>
<div id="lastmod">
<%=tradOf(:last_modified)%>: <%= gitmtime.strftime(@config[:dateFormat][language.intern]) %>
</div>
<div>
<%= tradOf(:entirely_done_with) %>
<a href="http://www.vim.org">Vim</a>
<%= tradOf(:and) %>
<a href="http://nanoc.stoneship.org">nanoc</a>
</div>
<div>
<a href="<%=@config[:webprefix]%>/<%=language%>/validation/">Validation</a>
<a href="http://validator.w3.org/check?uri=referer"> [xhtml] </a>
.
<a href="http://jigsaw.w3.org/css-validator/check/referer?profile=css3"> [css] </a>
.
<a href="http://validator.w3.org/feed/check.cgi?url=http%3A//yannesposito.com<%=@config[:webprefix]%>/<%=language%>/blog/feed/feed.xml">[rss]</a>
</div>
</div>
<div class="clear"></div>
</div>
<%= clicky_analytics %>
</body>
</html>

70
layouts/error.html

@ -0,0 +1,70 @@
-----
-----
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="fr" xml:lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<% t=tags %>
<% if t.length > 0 %>
<meta name="keywords" content="<%= t %>">
<% end %>
<link rel="shortcut icon" type="image/x-icon" href="<%=@config[:webprefix]%>/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="<%=@config[:webprefix]%>/assets/css/main.css" />
<script type="text/javascript" src="<%=@config[:webprefix]%>/js/jquery-1.3.1.min.js"></script>
<script type="text/javascript" src="<%=@config[:webprefix]%>/js/jquery.cookie.js"></script>
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<title><%= @item[:title] %></title>
</head>
<body>
<div id="content">
<a href="/">
<img src="<%=@config[:webprefix]%>/img/presentation.png" alt="Presentation drawing"/>
</a>
<h1>
<%= @item[:title] %>
</h1>
<% unless @item[:subtitle].nil? %>
<div id="titre">
<h2>
<%= @item[:subtitle] %>
</h2>
</div>
<% end %>
<div class="flush"></div>
<div id="afterheader">
<div class="corps">
<%= yield %>
</div>
<div id="bottom">
<div>
<%=tradOfKeywordIn(:copyright,"en") %>
</div>
<div id="lastmod">
<%=tradOfKeywordIn(:last_modified,"en")%>: <%= gitmtime.strftime(@config[:dateFormat][:en]) %>
</div>
<div>
<%= tradOfKeywordIn(:entirely_done_with,"en") %>
<a href="http://www.vim.org">Vim</a>
<%= tradOfKeywordIn(:and,"en") %>
<a href="http://nanoc.stoneship.org">nanoc</a>
</div>
<div>
<a href="<%=@config[:webprefix]%>/en/validation/">Validation</a>
<a href="http://validator.w3.org/check?uri=referer"> [xhtml] </a>
.
<a href="http://jigsaw.w3.org/css-validator/check/referer?profile=css3"> [css] </a>
.
<a href="http://validator.w3.org/feed/check.cgi?url=http%3A//yannesposito.com<%=@config[:webprefix]%>/en/blog/feed/feed.xml">[rss]</a>
</div>
</div>
<div class="clear"></div>
</div>
<%= clicky_analytics %>
</body>
</html>

17
layouts/feed.html

@ -0,0 +1,17 @@
-----
-----
<%
language=@item_rep.path.sub(%r{#{@config[:webprefix]}/},'').sub(/\/.*$/,'')
number_of_char_for_resume=800
%><%=
# atom_feed( {
# :articles => articles.select { |a| a.reps[0].path =~ /\/#{language}\// },
# :content_proc =>lambda { |a|
# repair_html(
# excerptize(
# a.compiled_content(:snapshot => :pre),
# {:length => number_of_char_for_resume} ))
# },
# :limit => 40
# })
%>

127
layouts/main.html

@ -0,0 +1,127 @@
<% language, languages, blog, article = setItemConf %><!doctype html>
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7 ]> <html class="no-js ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]> <html class="no-js ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]> <html class="no-js ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<!--
Copyright ©Yann Esposito 2011
Extended from HTML5boilerplate
-->
<!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame
Remove this if you use the .htaccess -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title><%= @item[:title] %></title>
<meta name="description" content="">
<meta name="author" content="">
<%= meta_tags %>
<!-- Mobile viewport optimized: j.mp/bplateviewport -->
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
<!-- Place favicon.ico & apple-touch-icon.png in the root of your domain and delete these references -->
<link rel="shortcut icon" href="<%=@config[:webprefix]%>/img/favicon.ico" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
<!-- CSS: implied media="all" -->
<link rel="stylesheet" href="/css/less.css"/>
<link href='http://fonts.googleapis.com/css?family=Expletus+Sans:bold' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Kreon:regular,bold' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="/css/main.css">
<!-- Uncomment if you are specifically targeting less enabled mobile browsers
<link rel="stylesheet" media="handheld" href="css/handheld.css?v=2"> -->
<!-- All JavaScript at the bottom, except for Modernizr which enables HTML5 elements & feature detects -->
<script src="/js/libs/modernizr-1.7.min.js"></script>
<link rel="alternate" type="application/rss+xml" title="RSS" href="<%= @config[:rss_uri][language.intern] %>"/>
</head>
<body lang="<%= language %>">
<header>
<nav id="mainnav">
<ul>
<%= generateMenu %>
</ul>
</nav>
<div id="choixrss"><%= choixrss %></div>
<div id="choixlang"><%= choixlang %></div>
</header>
<div id="metacontainer">
<div id="container">
<div id="main" role="main">
<hgoup>
<h1><%= @item[:content_for_title].nil? ? @item[:title] : @item[:content_for_title] %></h1>
<% unless @item[:subtitle].nil? and @item[:content_for_subtitle].nil? %>
<h2>
<%= @item[:content_for_subtitle].nil? ? @item[:subtitle] : @item[:content_for_subtitle] %>
</h2>
<% end %>
</hgroup>
<article>
<div class="content">
<%= yield %>
</div>
<footer>
<ul class="article_metadata">
<li><%=tradOf(:last_modified)%>: <time> <%= gitmtime.strftime(@config[:dateFormat][language.intern]) %></time></li>
<li><%=tradOf(:copyright) %></li>
</ul>
</footer>
</article>
</div>
</div> <!--! end of #container -->
</div> <!--! end of #metacontainer -->
<footer>
<div id="webpageinfo">
<%=tradOf(:copyright) %>
<div>
<%= tradOf(:entirely_done_with) %>
<a href="http://www.vim.org">Vim</a>
<%= tradOf(:and) %>
<a href="http://nanoc.stoneship.org">nanoc</a>
</div>
</div>
</footer>
<!-- JavaScript at the bottom for fast page loading -->
<!-- Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if necessary -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.js"></script>
<script>window.jQuery || document.write("<script src='/js/libs/jquery-1.5.1.min.js'>\x3C/script>")</script>
<!-- scripts concatenated and minified via ant build script-->
<script src="/js/plugins.js"></script>
<script src="/js/script.js"></script>
<!-- end scripts-->
<!--[if lt IE 7 ]>
<script src="/js/libs/dd_belatedpng.js"></script>
<script>DD_belatedPNG.fix("img, .png_bg"); // Fix any <img> or .png_bg bg-images. Also, please read goo.gl/mZiyb </script>
<![endif]-->
<!-- mathiasbynens.be/notes/async-analytics-snippet Change UA-XXXXX-X to be your site's ID -->
<script>
var _gaq=[["_setAccount","UA-XXXXX-X"],["_trackPageview"]];
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.async=1;
g.src=("https:"==location.protocol?"//ssl":"//www")+".google-analytics.com/ga.js";
s.parentNode.insertBefore(g,s)}(document,"script"));
</script>
<%= clicky_analytics %>
</body>
</html>

3
layouts/sitemap.html

@ -0,0 +1,3 @@
-----
-----
<%= xml_sitemap %>

31
lib/analytics.rb

@ -0,0 +1,31 @@
# All files in the 'lib' directory will be loaded
# before nanoc starts compiling.
def genAnalytics
%{<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-10612400-1");
pageTracker._trackPageview();
} catch(err) {}</script>}
end
def clicky_analytics
clickyid=66374971
%{<script type="text/javascript">
var clicky = { log: function(){ return; }, goal: function(){ return; }};
var clicky_site_id = #{clickyid};
(function() {
var s = document.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.src = ( document.location.protocol == 'https:' ? 'https://static.getclicky.com/js' : 'http://static.getclicky.com/js' );
( document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0] ).appendChild( s );
})();
</script>
<noscript><p><img alt="Clicky" width="1" height="1" src="http://in.getclicky.com/#{clickyid}ns.gif" /></p></noscript>
}
end

15
lib/calendar.rb

@ -0,0 +1,15 @@
# All files in the 'lib' directory will be loaded
# before nanoc starts compiling.
def calendar_for( d, language="en" )
if language == "fr"
monthnames=[nil]+%w(Jan Fév Mar Avr Mai Jui Jul Aoû Sep Oct Nov Déc)
else
monthnames=[nil]+%w(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)
end
%{<span class="date">
<span class="day">#{d.day}</span>
<span class="month">#{monthnames[ d.mon ]}</span>
<span class="year">#{d.year}</span>
</span> }
end

32
lib/css.rb

@ -0,0 +1,32 @@
class NoCustomCSS < Nanoc3::Filter
identifier :no_custom_css
def run(content, params={})
res=""
content.each do |line|
res <<= line if not res=~/^\s*-(moz|webkit)/
end
return res
end
end
class MozillaCSS < Nanoc3::Filter
identifier :mozilla
def run(content, params={})
res=""
content.each do |line|
res <<= line if not res=~/-webkit/
end
return res
end
end
class WebkitCSS < Nanoc3::Filter
identifier :webkit
def run(content, params={})
res=""
content.each do |line|
res <<= line if not res=~/-moz/
end
return res
end
end

14
lib/gitmtime.rb

@ -0,0 +1,14 @@
def gitmtime
filepath=@item.path.sub(@config[:webprefix]+'/','content/html/').sub(/\/$/,'')
ext=%{.#{@item[:extension]}}
filepath<<=ext
if not FileTest.exists?(filepath)
filepath.sub!(ext,%{/index#{ext}})
end
str=`git log -1 --format='%ci' -- #{filepath}`
if str.nil? or str.empty?
return Time.now
else
return DateTime.parse( str )
end
end

29
lib/graph.rb

@ -0,0 +1,29 @@
class Graph < Nanoc3::Filter
identifier :graph
@@tmpfic="/tmp/graphtemp.dot"
def run(content, params={})
content.gsub(%r{<graph( title="([^"]*)")?>(.+?)</graph>}m) do |full|
# FileUtils.rm(@@tmpfic)
title=$2
str=$3
filename=title.gsub(/[^a-zA-Z0-9_]/,"_")
File.open(@@tmpfic,'w') do |f|
f.write %[ digraph Source {
fontsize=10;
rankdir="LR";
graph [truecolor bgcolor="#ffffff00"];
node [width=0, height=0, fontname="Optima Bold", shape="Mrecord", color="#663300", style="filled" fillcolor="#f9f1dd", fontcolor="#280000"] ;
edge [arrowsize=.5, color="#280000"] ; ]
f.write str
f.write %[}]
end
FileUtils.mkdir_p('output'+@item.path+'graph')
webpath=@item.path + 'graph/' + filename + '.png'
path='output'+webpath
puts "dot -Tpng -o #{path} /tmp/graphtemp.dot"
system("dot -Tpng -o #{path} /tmp/graphtemp.dot")
puts %{<img alt="#{title}" src="#{webpath}"/>}
%{<img alt="#{title}" src="#{webpath}"/>}
end
end
end

17
lib/helpers.rb

@ -0,0 +1,17 @@
# All files in the 'lib' directory will be loaded
# before nanoc starts compiling.
# Utilisation des helper
#
# ecrire
# <% content_for :summary do %>
# Sommaire que je veux ecrire
# <% end %>
#
# Pour remplir à la fois le texte et le sommaire
include Nanoc3::Helpers::Capturing
include Nanoc3::Helpers::LinkTo
include Nanoc3::Helpers::Blogging
include Nanoc3::Helpers::Text
include Nanoc3::Helpers::XMLSitemap

32
lib/html.rb

@ -0,0 +1,32 @@
def meta_tags
t=tags
if t.length>0
return %{<meta name="keywords" content="#{t}">}
end
end
def meta_alternate
res=[]
@conf.languages.each do |lang|
item_for_lang=item_of_language(lang)
if not item_for_lang.nil?
res <<= %{<link rel="alternate" lang="#{ lang }" xml:lang="#{ lang }" title="#{ item_for_lang[:title] }" type="text/html" hreflang="#{ lang }" href="#{ item_for_lang.reps[0].path }" />}
end
end
return res.join("\n")
end
def choixrss
return %{<a id="rss" href="#{@config[:rss_uri][@conf.language.intern]}">#{ tradOf(:subscribe) }</a>}
end
def choixlang
@conf.languages.map do |l|
dest=@item_rep.path.sub(%r{#{@config[:webprefix]}/../}, %{#{@config[:webprefix]}/#{l}/})
if @item_rep.path != dest
%{<a href="#{dest}" onclick="setLanguage('#{l}')">#{ tradOfKeywordIn(:switchTo,l)}</a>}
else
nil
end
end.join()
end

26
lib/intenseDebate.rb

@ -0,0 +1,26 @@
def getMainpage
if @item.parent.nil? or @item.parent.parent.nil? or @item.parent.parent.parent.nil?
return
end
if @item.parent.parent.parent.parent.nil?
return @item
else
return @item.parent
end
end
def generateIntenseDebateThread
mainpage=getMainpage
protectedPath=mainpage.path.gsub(/'/,"%27")
protectedTitle=mainpage[:title].gsub(/'/,"%27")
%{
<script type="text/javascript">
var idcomments_acct = 'a307f0044511ff1b5cfca573fc0a52e7';
var idcomments_post_id = '#{protectedPath}';
var idcomments_post_url = 'http://yannesposito.com#{protectedPath}';
</script>
<span id="IDCommentsPostTitle" style="display:none"></span>
<script type='text/javascript' src='#{@config[:webprefix]}/js/genericCommentWrapperV2.js'></script>
}
end

52
lib/macros.rb

@ -0,0 +1,52 @@
# usage:
# ---
# ...
# macros:
# test: "passed test"
# ---
# ...
# Here is a %test.
#
class Macros < Nanoc3::Filter
identifier :falacy
attr_accessor :macro
def initialize(arg)
super
@macro={}
@macro[:tlal] = %{<span class="sc"><abbr title="Trop long à lire">tlàl</abbr> : </span>}
@macro[:tldr] = %{<span class="sc"><abbr title="Too long; don't read">tl;dr</abbr>: </span>}
if @item.nil?
if not arg.nil?
@macro.merge!( arg )
end
else
if not @item[:macros].nil?
@macro.merge!( @item[:macros] )
end
end
end
def macro_value_for(macro_name)
if macro_name.nil? or macro_name=="" or @macro[macro_name.intern].nil?
return %{%#{macro_name}}
end
return @macro[macro_name.intern]
end
def run(content, params={})
content.gsub(/%(\w*)/) do |m|
if m != '%'
macro_value_for($1)
else
m
end
end
end
end
def tldr
%{<span class="sc"><abbr title="Too long; don't read">tl;dr</abbr>: </span>}
end
def tlal
%{<span class="sc"><abbr title="Trop long à lire">tlàl</abbr> : </span>}
end

3
lib/mail.rb

@ -0,0 +1,3 @@
def mail_perso
%{<a href="&#109;&#097;&#105;&#108;&#116;&#111;:&#121;&#097;&#110;&#110;&#046;&#101;&#115;&#112;&#111;&#115;&#105;&#116;&#111;&#064;&#103;&#109;&#097;&#105;&#108;&#046;&#099;&#111;&#109;">&#121;&#097;&#110;&#110;&#046;&#101;&#115;&#112;&#111;&#115;&#105;&#116;&#111;&#064;&#103;&#109;&#097;&#105;&#108;&#046;&#099;&#111;&#109;</a>}
end

30
lib/multi.rb

@ -0,0 +1,30 @@
def tradOf(keyword)
language=@conf.language
tradOfKeywordIn(keyword, language )
end
def tradOfKeywordIn(keyword, language)
begin
@config[:translations][keyword][language.intern]
rescue
if @config[:translations].nil?
puts %{ERROR (lib/multi.rb) Please make a 'translations' hash table in config.yaml}
elsif @config[:translations][keyword].nil?
puts %{ERROR (lib/multi.rb) in config.yaml,
in the 'translations' hash, I can't find the keyword #{keyword}}
elsif @config[:translations][keyword][language.intern].nil?
puts %{ERROR (lib/multi.rb) in config.yaml,
in the 'translations' hash, I can't find the translation
in #{language} for the keyword #{keyword}}
else
puts %{ERROR (lib/multi.rb) erreur inconnue}
end
return '[Sorry Translation Error]'
end
end
def item_of_language(language)
searched_path=@item_rep.path.sub(@conf.language,language)
# puts %{source path = #{@item_rep.path}, searched_path = #{searched_path}}
@items.find { |i| i.reps[0].path == searched_path }
end

179
lib/multiMenu.rb

@ -0,0 +1,179 @@
def homepage
@items.find do |i|
i.reps[0].path == %{#{@config[:webprefix]}/#{@conf.language}/}
end
end
def sortedChildrenByMenuPriority(item)
item.children.reject{|p| p[:isHidden]}.
sort!{|x,y| x[:menupriority] <=> y[:menupriority]}
end
def generateMenu
home=homepage
if home.nil?
return ''
end
liste=[]
liste<<=link_to_unless_current(home[:title],home.reps[0])
sortedChildrenByMenuPriority(home).each do |page|
liste <<= link_to_unless_current(page[:title],page.reps[0])
end
"<ul><li>"+liste.join("</li>\n<li>")+"</li></ul>"
end
def depthOf(item)
res=0
while item.parent != nil
res+=1
item=item.parent
end
return res
end
def getSortedChildren(parent)
if parent[:kind] == "blog"
return parent.children.reject{|p| p[:isHidden]}.sort!{|x,y| x[:created_at] <=> y[:created_at] }
else
return parent.children.reject{|p| p[:isHidden]}.sort!{|x,y| x[:menupriority] <=> y[:menupriority] }
end
end
def generateBlogSubMenu(language)
year=0
res=""
liste=getSortedChildren(@item).reverse!.collect! do |p|
if p[:created_at].strftime("%Y") != year
if year != 0
res<<=%{</ul><script type="text/javascript">$('#archives_#{year}').hide()</script>}
end
year=p[:created_at].strftime("%Y")
res<<=%{<h4 class="button" onclick="$('#archives_#{year}').slideToggle()">[#{year}]</h4><ul id="archives_#{year}">}
end
res<<='<li>'
res<<=calendar_for(p[:created_at],language)+
link_to_unless_current(p[:title]+ %{<span class="nicer">»</span>},p)
res<<='</li>'
end
res<<=%{</ul><script type="text/javascript">$('#archives_#{year}').hide()</script>}
if ! liste.empty?
'<div id="sousliens" class="archive">'+res+'</div>'
else
return
end
end
def generateSubMenu()
if @item[:noSubMenu]
return
end
depth=depthOf(@item)
if depth == 0
return
end
if @item.children.length == 0 and not @item.parent[:kind].to_s == "blog"
page=@item.parent
else
page=@item
end
if @item[:kind].to_s == "article"
key=:subtitle
else
key=:title
end
liste=getSortedChildren(page).collect do |p|
if not p[key].nil?
link_to_unless_current(p[key]+' <span class="nicer">&raquo;</span>',p)
else
puts 'ERROR: key='+key
end
end
if ! liste.empty? then
liste = [ link_to_unless_current(page[key]+' <span class="nicer">&raquo;</span>',page) ].concat( liste )
'<div id="sousliens"><ul><li>'+liste.join('</li><li>')+'</li></ul></div>'
else
return
end
end
# =======================
def blogimage(val,title="no name", divclass=nil)
if depthOf( @item ) == 4
imgpath=@item.parent.path
else
imgpath=@item.path
end
imgpath=imgpath.sub(%r{#{@config[:webprefix]}/../},@config[:webprefix]+'/img/')+val
if not divclass.nil?
cls=%{ class="#{divclass}"}
end
return %{<img alt="#{title}" src="#{imgpath}"#{cls}/>}
end
def leftblogimage(val,title="no name")
return blogimage(val, title, "left")
end
def lnkto(title,item)
language=@item_rep.path.sub(/#{@config[:webprefix]}\//,'').sub(/\/.*$/,'')
link_to(title, "#{@config[:webprefix]}/#{language}"+item)
end
def nextFor(page)
depth=depthOf(page)
case depth
when 0..2 then return nil
when 3 then target=getSortedChildren(page)[0]
else
sorted_children=getSortedChildren(page.parent)
index=sorted_children.index(page)
target=sorted_children[ index + 1]
end
return nil if target.nil?
link_to(tradOf(:next)+%{&nbsp;<span class="nicer">»</span>}, target)
end
# return the previous page of a post containing many
def previousFor(page)
case depthOf(page)
when 0..3 then return nil
when 4 then
sorted_children=getSortedChildren(page.parent)
index=sorted_children.index(page)
if index==0
target=page.parent
else
target=sorted_children[ index - 1 ]
end
end
return nil if target.nil?
link_to(%{<span class="nicer">«</span>&nbsp;}+tradOf(:previous), target)
end
def brother_for_at(page,n)
brothers=getSortedChildren(page.parent)
i=brothers.index(page)
if i.nil?
return nil
end
if i + n < 0
return nil
end
brothers[ i + n ]
end
def article_brother(n)
if depthOf(@item) > 3
page=@item.parent
else
page=@item
end
brother_for_at(page,n)
end

40
lib/nanoc_item_conf.rb

@ -0,0 +1,40 @@
class LocalConf
attr_accessor :blog, :article, :languages, :language, :indent
def to_s
instance_variables.map{ |x|
if instance_variable_get(x).class == Array
%{#{x.intern}= [#{instance_variable_get(x).join(', ')}]}
else
%{#{x.intern}= #{instance_variable_get(x)}}
end
}
end
end
def setItemConf
# -- init variables --
conf=LocalConf.new
language=@item_rep.path.sub(%r{#{@config[:webprefix]}/},'').sub(/\/.*$/,'')
if language != ''