Added nanoc stuff

This commit is contained in:
Yann Esposito (Yogsototh) 2011-05-02 12:09:43 +02:00
parent 5f5824a84d
commit 739e68ea34
70 changed files with 8361 additions and 196 deletions

3
.gems Normal file
View file

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

6
Rakefile Normal file
View file

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

107
Rules Normal file
View file

@ -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 Normal file
View file

@ -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 Normal file
View file

@ -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 Normal file
View file

@ -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 Normal file
View file

@ -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 Normal file
View file

@ -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 Normal file
View file

@ -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>

View file

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

7
content/xml/en/feed.html Normal file
View file

@ -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 Normal file
View file

@ -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 Symbolic link
View file

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

183
layouts/article.html Normal file
View file

@ -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 Normal file
View file

@ -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 Normal file
View file

@ -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 Normal file
View file

@ -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 Normal file
View file

@ -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 Normal file
View file

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

31
lib/analytics.rb Normal file
View file

@ -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 Normal file
View file

@ -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 Normal file
View file

@ -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 Normal file
View file

@ -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 Normal file
View file

@ -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 Normal file
View file

@ -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 Normal file
View file

@ -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 Normal file
View file

@ -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 Normal file
View file

@ -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 Normal file
View file

@ -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 Normal file
View file

@ -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 Normal file
View file

@ -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 Normal file
View file

@ -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 != ''
conf.language=language
else
conf.language='en'
language=conf.language
end
# the current item is an article
article=( ( not @item[:kind].nil? ) && @item[:kind] == 'article' )
conf.article=article
# the current item is a blog entry page
blog=( ( not @item[:kind].nil? ) && @item[:kind] == 'blog' )
conf.blog=blog
# all supported languages
languages=@config[:languages]
conf.languages=languages
self.instance_variable_set(:@conf, conf)
return language, languages, blog, article
end

64
lib/repair_html.rb Normal file
View file

@ -0,0 +1,64 @@
# All files in the 'lib' directory will be loaded
# before nanoc starts compiling.
# repair cutted XML code by closing the tags
# work even if the XML is cut into a tag.
# example:
# transform '<div> <code> toto </code> <p> hello <a href="http://tur'
# into '<div> <code> toto </code> <p> hello </p></div>'
def repair_html( html, debug=false )
parents=[]
depth=0
html.scan( %r{<(/?)(\w*)([^>]*)>} ).each do |m|
if m[-1] == "/"
if debug
puts 'IGNORE: <'+m[0]+m[1]+'/>' + depth.to_s
puts 'parents='+parents.join('; ')
end
next
end
if m[0] == ""
parents[depth]=m[1]
depth+=1
if debug
puts '<'+m[0]+m[1]+'> ' + depth.to_s
puts 'parents='+parents.join('; ')
end
else
depth-=1
if (not debug) and (depth <0)
puts 'ERROR repair_html: '
puts 'HTML: ' + html
puts '---'
repair_html(html,true)
puts 'END_ERROR'
end
if debug
puts '<'+m[0]+m[1]+'> ' + depth.to_s
end
end
end
res=html.sub(/<[^>]*$/m,'')
depth -= 1
if (depth < 0)
parents=[]
depth=0
html.scan( %r{<(/?)(\w*)[^>]*(/?)>} ).each do |m|
if m[2] == "/"
puts 'IGNORE: <'+m[0]+m[1]+m[2]+'> ' + depth.to_s
next
end
if m[0] == ""
parents[depth]=m[1]
depth+=1
puts '<'+m[0]+m[1]+'> ' + depth.to_s
puts 'parents='+parents.join('; ')
else
depth-=1
puts '<'+m[0]+m[1]+'> ' + depth.to_s
end
end
end
depth.downto(0).each { |x| res<<= %{</#{parents[x]}>} }
res
end

68
lib/syntaxColorize.rb Normal file
View file

@ -0,0 +1,68 @@
module Nanoc3::Helpers
module SyntaxColorize
require 'nanoc3/helpers/capturing'
include Nanoc3::Helpers::Capturing
def syntax_colorize(lang, type=:ultraviolet, &block)
# Capture block
data = capture(&block)
# Remove whitespace
lines = data.split("\n")
min_indent = lines.inject(nil) do |memo, line|
next memo if line =~ /^\s*$/
next memo if line !~ /^(\s*)/
[ memo, $1.size ].compact.min
end
lines.each do |line|
line[0,min_indent] = ''
end
data = lines.join("\n")
# Process
case type
when :ultraviolet
begin
require 'uv'
if lang =~ /^(zsh|bash|sh|csh|shell)$/
lang='shell-unix-generic'
end
filtered_data = Uv.parse(data, 'xhtml', lang, false, 'twilight')
rescue LoadError
unless $_WARNED_ABOUT_ULTRAVIOLET
warn "WARNING: Couldn't load uv; please install the ultraviolet gem. This message will not appear again."
end
$_WARNED_ABOUT_ULTRAVIOLET = true
filtered_data = '<pre class="no-uv">' + h(data) + '</pre>'
end
# Convert to HTML
filtered_data = filtered_data.strip.sub(%r{/ ?>}, '>') # convert to HTML
# Add missing <code> in <pre>
filtered_data.sub!(/^\s*(<pre class="[^<]+">)\s*/) { |m| "#{m}<code>" }
filtered_data.sub!(/\s*(<\/pre>)\s*$/) { |m| "</code>#{m}" }
when :coderay
# Find filter
klass = Nanoc3::Filter.named(:coderay)
filter = klass.new(@item_rep.assigns)
# Filter captured data
filtered_data = filter.run(data, :language => lang).strip
else
raise ArgumentError, "invalid type: #{type}"
end
# Append filtered data to buffer
buffer = eval('_erbout', block.binding)
buffer << '<pre><code>' if type == :coderay
buffer << filtered_data
buffer << '</code></pre>' if type == :coderay
end
end
end

112
lib/tag.rb Normal file
View file

@ -0,0 +1,112 @@
# All files in the 'lib' directory will be loaded
# before nanoc starts compiling.
# module Tags
def tags
if @item[:tags].nil?
return ''
end
@item[:tags].join(', ')
end
def alltags
language=@item.path
language =~ %r{#{@config[:webprefix]}/([^/]*)/}
language = $1
@items.select {|p| p.path =~ %r{#{@config[:webprefix]}/#{language}/} and p[:kind].to_s == "article" and p.parent[:kind].to_s == 'blog'}
end
def tagNumber
tags={}
alltags.each do |p|
if p[:tags].nil?
next
end
p[:tags].each do |t|
if tags[t]
tags[t]+=1
else
tags[t]=1
end
end
end
return tags
end
def tagRefs
tagLinks={}
alltags.each do |p|
if p[:tags].nil?
next
end
p[:tags].each do |t|
if tagLinks[t].nil?
tagLinks[t]=[ p ]
else
tagLinks[t] <<= p
end
end
end
return tagLinks
end
def tagCloud(maxwords=nil)
tags=tagNumber
if not maxwords.nil?
i=1
while tags.count > maxwords
tags=tags.reject{ |k,v| v<i }
i+=1
end
end
tagLinks=tagRefs.reject { |k,v| tags[k].nil? }
max=tags.values.max
min=tags.values.min
minSize=1.0
maxSize=2.5
tagSize={}
tags.each do |t,n|
# valeur normalisée entre 0 et 1
if ( max == min )
tagSize[t]=minSize
else
tagSize[t]=[ ( n - min + 0.0 ) / ( max - min ) , (n - min) / 10.0 ].min
# valeur adaptée entre minSize et maxSize
tagSize[t]=( tagSize[t] ) * (maxSize - minSize) + minSize
end
end
tagCloud=%{<script type="text/javascript">
$(document).ready( function(){$('.list').hide();$('#tagcloud a').removeAttr("href")} );
function tagSelected(id) {
$('.list').hide();
$('#'+id).fadeIn();
$('.tag.selected').removeClass('selected');
$('#tag_'+id).addClass('selected');
}
</script><div id="tagcloud">}
tagSize.sort{|a,b| a[0].downcase <=> b[0].downcase}.each do |t,s|
protected=t.gsub(/\W/,'_')
grouped=t.gsub(/&/,'&amp;').gsub(/ /,'&nbsp;').gsub(/</,'&lt;').gsub(/>/,'&gt;')
tagCloud <<= %{<a href="##{protected}" style="font-size: #{s}em;" class="tag" onclick="tagSelected('#{protected}')" id="tag_#{protected}">#{grouped}</a> }
end
tagCloud <<= %{</div><div id="hiddenDivs" >}
language=@item.path
language =~ %r{#{@config[:webprefix]}/([^/]*)/}
language = $1
tagLinks.sort{|a,b| a[0].downcase <=> b[0].downcase}.each do |t,l|
protected=t.gsub(/\W/,'_')
tagCloud <<= %{<div id="#{protected}" class="list"><h4>#{t}</h4><ul style="list-style-type: none; margin: 0;">}
l.sort{|x,y| y[:created_at] <=> x[:created_at]}.each do |p|
tagCloud <<= %{
<li style="line-height: 3em; margin: 0;">
#{calendar_for(p[:created_at], language)}
<a href="#{p.path}">#{p[:title]} <span class="nicer">»</span></a>
</li>\n}
end
tagCloud <<= %{</ul><a class="return" href="#tagcloud">&uarr;</a></div>}
end
tagCloud <<= %{</div>}
return tagCloud
end
# end

40
lib/ultraviolet.rb Normal file
View file

@ -0,0 +1,40 @@
class UltraVioletFilter < Nanoc3::Filter
identifier :ultraviolet
def run(content, params={})
require 'rubygems'
require 'uv'
code_rule = %r{(<code class="([^"]+?)"( file="([^"]+?)")?>(.+?)</code>)}m
new_content=content.gsub(code_rule) do |full|
@lang, @filename, @code = $2, $4, $5
if @lang =~ /^(zsh|bash|sh|csh|shell)$/
@lang='shell-unix-generic'
end
@codeprefix=''
@codesuffix=''
if not @filename.nil? and @filename != ""
create_file_for_code
end
@codeprefix+
Uv.parse(@code, "xhtml", @lang, false, @config[:ultraviolet_theme])+
@codesuffix
end
return new_content
end
private
def create_file_for_code
# Create a plaintext file version for download.
webpath = @item.path
url = webpath + 'code/' + @filename
@codeprefix=%{<div class="code"><div class="file"><a href="#{url}"> &#x27A5; #{@filename} </a></div><div class="withfile">\n}
@codesuffix=%{\n</div></div>}
code_path = "output#{webpath}code"
puts %{\t\tEcriture de #{code_path}/#{@filename}}
FileUtils.mkdir_p code_path
File.open(%{#{code_path}/#{@filename}}, 'w'){|f|f.write(@code)}
end
end

166
lib/y.rb Normal file
View file

@ -0,0 +1,166 @@
# All files in the 'lib' directory will be loaded
# before nanoc starts compiling.
def allExceptCode( f, content )
regexp=/<code[^>]*>.*?<\/code>/m
tmp=""
mem=[]
content.scan(regexp).each do |c|
mem <<= c
end
i=0
content.split(regexp).each do |x|
tmp <<= send(f,x)
if not mem[i].nil?
tmp <<= mem[i]
i+=1
end
end
tmp
end
module Nanoc3::Filters
class MathJaxKramdownRepair < Nanoc3::Filter
identifiers :math_repair
def description(content)
content.gsub(/<div class="math">(.+?)<\/div>/m) do
return %{$$ #{$1} $$}
end
end
def run(content, params={})
allExceptCode( :description , content )
end
end
class Description < Nanoc3::Filter
identifiers :description
def description(content)
content.gsub(/^\s*<desc( [^>]*)?>(.+?)<\/desc>/m) do
n=0
if $1 then
summary=$1
summary.slice!(0)
else
summary="no description"
end
'<div><table class="description" summary="'+summary+'">'+$2.gsub(/([^:]+):(.+?)::/m) do
n+=1
if n % 2 == 0
sombre=' class="assombris10"'
else
sombre=' class="assombris20"'
end
'<tr'+sombre+'><td class="definitionCell">'+$1+'</td><td class="valueCell">'+$2+'</td></tr>'
end+'</table></div>'
end
end
def run(content, params={})
allExceptCode( :description , content )
end
end
class FrenchSpace < Nanoc3::Filter
identifiers :frenchspace
def ameliorate(content)
content.gsub(/ ([:;!?]|&eq;|&ne;)/) { "&nbsp;"+$1 }
end
def run(content, params={})
allExceptCode( :ameliorate, content )
end
end
class Footnotes < Nanoc3::Filter
identifiers :footnotes
def hr_before_footnote(content)
content.gsub(/<div class="footnotes">/) { %{<hr/>#{$&}} }
end
def run(content, params={})
allExceptCode( :hr_before_footnote, content )
end
end
class FirstHierarchy < Nanoc3::Filter
identifiers :firsthi
def run(content, params={})
content.gsub(/\A(\s|\n)*<h[1-4]/m)do
$& + ' class="first"'
end.gsub(/<div[^>]*class="corps"[^>]*>(\s)*<h[1-4]/m) do
$& + ' class="first"'
end.gsub(/class="first" class="first"/) do
'class="first"'
end
end
end
class YTypography < Nanoc3::Filter
identifiers :ytypo
def ytypofunc(content)
content.gsub(/<sc>(.*?)<\/sc>/m) do
%{<span class="sc">}+$1+%{</span>}
end.gsub(/''(.*?)''/m)do
%{<code>}+$1+%{</code>}
end.gsub(/\(c\)/) do
%{<small>&copy;</small>}
end.gsub(/\(r\)/) do
%{<small>&reg;</small>}
end.gsub(/-(&gt;|>)/) do
%{&rarr;}
end.gsub(/(&lt;|<)-/) do
%{&larr;}
end
end
def run(content, params={})
allExceptCode( :ytypofunc, content )
end
end
class YAbbreviations < Nanoc3::Filter
identifiers :yabbreviations
def makeabbreviations(text)
{
'WebDav' => 'Web-based Distributed Authoring and Versionning',
'cms' => 'Content Management System',
'xml' => 'eXtended Markup Language',
}.each do |keyword,abbreviation|
text=text.gsub(/\b#{keyword}\b/i) do
%{<abbr title="#{abbreviation}"><span class="sc">#{keyword}</span></abbr>}
end
end
return text
end
def run(content, params={})
allExceptCode(:makeabbreviations, content )
end
end
class MultiCorps < Nanoc3::Filter
identifiers :multicorps
def run(content, params={})
content.gsub(/^.*newcorps.*$/) do
%{\n</div>\n\n<div class="corps">\n}
end.gsub(/^.*begindiv\((.*)\).*$/) do
%{\n<div class="#{$1}">\n}
end.gsub(/^.*enddiv.*$/) do
%{\n</div>\n}
end
end
end
end
def block(title, url, text, position="left")
return %{<div class="block #{position}">
<h3>
<a href="#{url}"> #{title}
<span class="nicer">»</span>
</a>
</h3>
<p>
#{text}
</p>
</div>}
end

121
multi/blog.erb Normal file
View file

@ -0,0 +1,121 @@
-----
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>
en: <li> <a href="#last-articles"><%= number_of_articles %> latest articles <%=dArr%></a> </li>
fr: <li> <a href="#last-articles">Les <%= number_of_articles %> derniers articles <%=dArr%></a></li>
en: <li> <a href="#tagcloud">Tag Cloud <%=dArr%></a></li>
fr: <li> <a href="#tagcloud">Nuage de mots clés <%=dArr%></a></li>
<li> <a href="#archives">Achives <%=dArr%></a></li>
en: <li> <a href="#two-words-about-the-content">Two words about the content <%=dArr%></a></li>
fr: <li> <a href="#un-petit-mot-sur-le-contenu">Un petit mot sur le contenu <%=dArr%></a></li>
</ul>
<h2 id="last-articles">
en: Last <%= number_of_articles %> Articles
fr: 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>
fr: <%= link_to(%{en lire plus <span class="nicer">»</span>}, a) %>
en: <%= 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) %>
en: <h2 id="two-words-about-the-content">
en: Two words about the content
fr: <h2 id="un-petit-mot-sur-le-contenu">
fr: Un petit mot sur le contenu
</h2>
<div class="corps">
en: <p>
en: Here you'll can find mostly technical articles.
en: Some are just reminder of technical tips.
en: But some are long and technically detailled articles.
en: </p>
en: <hr/>
en: <p>
en: I do my best to traduce each page in french and in english.
en: It not always easy. English is not my natural language.
en: I make many errors, orthographic, grammatical, typographical&hellip;
en: </p>
en: <p>
en: <strong> Thanks not to judge me based on these errors! And don't forget content is more important than presentation! </strong>
en: </p><p>
en: 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.
en: </p><p>
en: I wish you to find something useful or interesting on this website.
en: </p>
fr: <p>
fr: Vous trouverez ici des articles qui sont pour la plupart
fr: écrits en anglais et qui sont techniques.
fr: Certain sont justes là pour me souvenir de petits trucs, que
fr: d'autres pourraient trouver utiles. Mais il y a aussi de
fr: long articles techniques qui vont un peu plus dans les détails.
fr: </p><p>
fr: <hr/>
fr: <p>
fr: Je fais de mon mieux pour traduire chaque page en anglais et en français.
fr: Cependant, ce n'est pas toujours évident.
fr: Il m'arrive de faire de nombreuses fautes d'orthographes, des erreurs typographiques et autres.
fr: </p>
fr: <p>
fr: <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>
fr: </p><p>
fr: L'impression que ce site laisse de moi n'est certainement pas l'impression que je vous laisserais si on se rencontrait.
fr: </p><p>
fr: Je vous souhaite de trouver ce que vous cherchez sur ce site.
fr: </p>

133
multi/index.erb Normal file
View file

@ -0,0 +1,133 @@
---
en: title: YPassword
fr: 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>
en: <div class="block left">
en: <h3>
en: <a href="<%=@config[:webprefix]%>/en/blog/" onclick="setLanguage('en')">
en: Blog
en: <span class="nicer">»</span>
en: </a>
en: </h3>
en: <p>
en: Computer, Philosophy <i>&amp;</i> Life.
en: </p>
en: </div>
en: <div class="block left">
en: <h3>
en: <a href="<%=@config[:webprefix]%>/en/softwares" onclick="setLanguage('en')">
en: Softwares
en: <span class="nicer">»</span>
en: </a>
en: </h3>
en: <p>
en: Password Manager,
en: Screensavers <i>&amp;</i>
en: Scientific Applications.
en: </p>
en: </div>
en: <div class="block right">
en: <h3>
en: <a href="<%=@config[:webprefix]%>/en/about/contact" onclick="setLanguage('en')">Contact
en: <span class="nicer">»</span>
en: </a>
en: </h3>
en: <p>
en: Don't be shy, I'll be happy to talk to <i>you</i>.
en: </p>
en: </h3>
en: </div>
fr: <div class="block left">
fr: <h3>
fr: <a href="<%=@config[:webprefix]%>/fr/blog/" onclick="setLanguage('fr')">
fr: Blog
fr: <span class="nicer">»</span>
fr: </a>
fr: </h3>
fr: <p>
fr: Ordinateurs, philosophie <i>&amp;</i> des choses de la vie.
fr: </p>
fr: </div>
fr: <div class="block left">
fr: <h3>
fr: <a href="<%=@config[:webprefix]%>/fr/softwares" onclick="setLanguage('fr')">
fr: Logiciels
fr: <span class="nicer">»</span>
fr: </a>
fr: </h3>
fr: <p>
fr: Des économiseurs d'écran,
fr: un gestionnaire de mots de passe <i>&amp;</i>
fr: des applications scientifiques.
fr: </p>
fr: </div>
fr: <div class="block right">
fr: <h3>
fr: <a href="<%=@config[:webprefix]%>/fr/about/contact" onclick="setLanguage('fr')">
fr: Contact
fr: <span class="nicer">»</span>
fr: </a>
fr: </h3>
fr: <p>
fr: Au diable la timidité, n'hésitez pas à me contacter, je serai ravi de <i>vous</i> parler.
fr: </p>
fr: </div>
fr: <div class="flush"></div>
fr: <div class="block left">
fr: <h3>
fr: <a href="http://j.mp/btfRJ2">
fr: Curriculum Vitæ
fr: <span class="nicer">»</span>
fr: </a>
fr: </h3>
fr: <p>
fr: Doctorat &rarr; Post Doc &rarr; Consultant<br/>
fr: <i>Geek &rarr; G33K &rarr; G33|&lt;
fr: </i>
fr: </p>
fr: </h4>
fr: </div>
fr: <div class="block left">
fr: <h3>
fr: <a href="http://yann.esposito.free.fr/enseignement/enseignement.php">
fr: Enseignement
fr: <span class="nicer">»</span>
fr: </a>
fr: </h3>
fr: <p>
fr: Informatique:<br/>
fr: TD, TD <i>&amp;</i> solutions<br/>
fr: BAC+1 à BAC+5<br/>
fr: <i><a href="http://yann.esposito.free.fr/enseignement/projetrez0/projetrez0.html">Projet réseau anonyme
fr: <span class="nicer">»</span></a>
fr: </i>
fr: </p>
fr: </div>
fr: <div class="block right">
fr: <h3>
fr: <a href="http://web.me.com/yann.esposito/Perso/Welcome.html">
fr: Photos
fr: <span class="nicer">»</span>
fr: </a>
fr: </h3>
fr: <p>
fr: <a href="mailto:yannesposito@gmail.com?Subject=Permission%20site%20famille" >
fr: Cliquez ici pour avoir le mot de passe.
fr: <span class="nicer">»</span>
fr: </a>
fr: </p>
fr: </div>
<div class="flush"></div>

View file

View file

@ -0,0 +1,195 @@
<!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>Blog</title>
<meta name="description" content="">
<meta name="author" content="">
<!-- 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="/Scratch/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="http://feeds.feedburner.com/yannespositocomen"/>
</head>
<body lang="en">
<header>
<nav id="mainnav">
<ul>
<ul><li><a href="/Scratch/en/">YPassword</a></li>
<li><span class="active" title="You're here.">Blog</span></li></ul>
</ul>
</nav>
<div id="choixrss"><a id="rss" href="http://feeds.feedburner.com/yannespositocomen">Subscribe</a></div>
<div id="choixlang"><a href="/Scratch/fr/blog/" onclick="setLanguage('fr')">en Français</a></div>
</header>
<div id="metacontainer">
<div id="container">
<div id="main" role="main">
<hgoup>
<h1>Blog</h1>
</hgroup>
<article>
<div class="content">
<ul>
<li> <a href="#last-articles">5 latest articles <span class="nicer">&dArr;</span></a> </li>
<li> <a href="#tagcloud">Tag Cloud <span class="nicer">&dArr;</span></a></li>
<li> <a href="#archives">Achives <span class="nicer">&dArr;</span></a></li>
<li> <a href="#two-words-about-the-content">Two words about the content <span class="nicer">&dArr;</span></a></li>
</ul>
<h2 id="last-articles">
Last 5 Articles
</h2>
</div>
<div class="corps">
<div>
<script type="text/javascript">
$(document).ready( function(){$('.list').hide();$('#tagcloud a').removeAttr("href")} );
function tagSelected(id) {
$('.list').hide();
$('#'+id).fadeIn();
$('.tag.selected').removeClass('selected');
$('#tag_'+id).addClass('selected');
}
</script><div id="tagcloud"></div><div id="hiddenDivs" ></div>
</div>
</div>
<h2 id="archives">Archives</h2>
<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>
</div>
<footer>
<ul class="article_metadata">
<li>Modified: <time> 05/02/2011</time></li>
<li><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Copyright ©, Yann Esposito</a></li>
</ul>
</footer>
</article>
</div>
</div> <!--! end of #container -->
</div> <!--! end of #metacontainer -->
<footer>
<div id="webpageinfo">
<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Copyright ©, Yann Esposito</a>
<div>
Entirely done with
<a href="http://www.vim.org">Vim</a>
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>
<script type="text/javascript">
var clicky = { log: function(){ return; }, goal: function(){ return; }};
var clicky_site_id = 66374971;
(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/66374971ns.gif" /></p></noscript>
</body>
</html>

186
site/Scratch/en/index.html Normal file
View file

@ -0,0 +1,186 @@
<!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>YPassword</title>
<meta name="description" content="">
<meta name="author" content="">
<!-- 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="/Scratch/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="http://feeds.feedburner.com/yannespositocomen"/>
</head>
<body lang="en">
<header>
<nav id="mainnav">
<ul>
<ul><li><span class="active" title="You're here.">YPassword</span></li>
<li><a href="/Scratch/en/blog/">Blog</a></li></ul>
</ul>
</nav>
<div id="choixrss"><a id="rss" href="http://feeds.feedburner.com/yannespositocomen">Subscribe</a></div>
<div id="choixlang"><a href="/Scratch/fr/" onclick="setLanguage('fr')">en Français</a></div>
</header>
<div id="metacontainer">
<div id="container">
<div id="main" role="main">
<hgoup>
<h1>
<span style="font-weight: normal; margin-top: 0; line-height: 1ex">
<span style="letter-spacing:-.10em">YPassword</span>
</span>
</h1>
<h2>
<span style="letter-spacing: 1em">Yogsototh</span>
</h2>
</hgroup>
<article>
<div class="content">
<div class="flush"></div>
<div class="block left">
<h3>
<a href="/Scratch/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="/Scratch/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="/Scratch/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>
</div>
<footer>
<ul class="article_metadata">
<li>Modified: <time> 05/02/2011</time></li>
<li><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Copyright ©, Yann Esposito</a></li>
</ul>
</footer>
</article>
</div>
</div> <!--! end of #container -->
</div> <!--! end of #metacontainer -->
<footer>
<div id="webpageinfo">
<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Copyright ©, Yann Esposito</a>
<div>
Entirely done with
<a href="http://www.vim.org">Vim</a>
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>
<script type="text/javascript">
var clicky = { log: function(){ return; }, goal: function(){ return; }};
var clicky_site_id = 66374971;
(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/66374971ns.gif" /></p></noscript>
</body>
</html>

View file

View file

@ -0,0 +1,198 @@
<!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>Blog</title>
<meta name="description" content="">
<meta name="author" content="">
<!-- 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="/Scratch/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="http://feeds.feedburner.com/yannespositocomfr"/>
</head>
<body lang="fr">
<header>
<nav id="mainnav">
<ul>
<ul><li><a href="/Scratch/fr/">Bienvenue</a></li>
<li><span class="active" title="You're here.">Blog</span></li></ul>
</ul>
</nav>
<div id="choixrss"><a id="rss" href="http://feeds.feedburner.com/yannespositocomfr">s'abonner</a></div>
<div id="choixlang"><a href="/Scratch/en/blog/" onclick="setLanguage('en')">in English</a></div>
</header>
<div id="metacontainer">
<div id="container">
<div id="main" role="main">
<hgoup>
<h1>Blog</h1>
</hgroup>
<article>
<div class="content">
<ul>
<li> <a href="#last-articles">Les 5 derniers articles <span class="nicer">&dArr;</span></a></li>
<li> <a href="#tagcloud">Nuage de mots clés <span class="nicer">&dArr;</span></a></li>
<li> <a href="#archives">Achives <span class="nicer">&dArr;</span></a></li>
<li> <a href="#un-petit-mot-sur-le-contenu">Un petit mot sur le contenu <span class="nicer">&dArr;</span></a></li>
</ul>
<h2 id="last-articles">
Les 5 derniers articles
</h2>
</div>
<div class="corps">
<div>
<script type="text/javascript">
$(document).ready( function(){$('.list').hide();$('#tagcloud a').removeAttr("href")} );
function tagSelected(id) {
$('.list').hide();
$('#'+id).fadeIn();
$('.tag.selected').removeClass('selected');
$('#tag_'+id).addClass('selected');
}
</script><div id="tagcloud"></div><div id="hiddenDivs" ></div>
</div>
</div>
<h2 id="archives">Archives</h2>
<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>
</div>
<footer>
<ul class="article_metadata">
<li>modifié le : <time> 02/05/2011</time></li>
<li><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.fr">Droits de reproduction ©, Yann Esposito</a></li>
</ul>
</footer>
</article>
</div>
</div> <!--! end of #container -->
</div> <!--! end of #metacontainer -->
<footer>
<div id="webpageinfo">
<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.fr">Droits de reproduction ©, Yann Esposito</a>
<div>
Site entièrement réalisé avec
<a href="http://www.vim.org">Vim</a>
et
<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>
<script type="text/javascript">
var clicky = { log: function(){ return; }, goal: function(){ return; }};
var clicky_site_id = 66374971;
(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/66374971ns.gif" /></p></noscript>
</body>
</html>

231
site/Scratch/fr/index.html Normal file
View file

@ -0,0 +1,231 @@
<!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>Bienvenue</title>
<meta name="description" content="">
<meta name="author" content="">
<!-- 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="/Scratch/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="http://feeds.feedburner.com/yannespositocomfr"/>
</head>
<body lang="fr">
<header>
<nav id="mainnav">
<ul>
<ul><li><span class="active" title="You're here.">Bienvenue</span></li>
<li><a href="/Scratch/fr/blog/">Blog</a></li></ul>
</ul>
</nav>
<div id="choixrss"><a id="rss" href="http://feeds.feedburner.com/yannespositocomfr">s'abonner</a></div>
<div id="choixlang"><a href="/Scratch/en/" onclick="setLanguage('en')">in English</a></div>
</header>
<div id="metacontainer">
<div id="container">
<div id="main" role="main">
<hgoup>
<h1>
<span style="font-weight: normal; margin-top: 0; line-height: 1ex">
<span style="letter-spacing:-.10em">YPassword</span>
</span>
</h1>
<h2>
<span style="letter-spacing: 1em">Yogsototh</span>
</h2>
</hgroup>
<article>
<div class="content">
<div class="flush"></div>
<div class="block left">
<h3>
<a href="/Scratch/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="/Scratch/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="/Scratch/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>
</div>
<footer>
<ul class="article_metadata">
<li>modifié le : <time> 02/05/2011</time></li>
<li><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.fr">Droits de reproduction ©, Yann Esposito</a></li>
</ul>
</footer>
</article>
</div>
</div> <!--! end of #container -->
</div> <!--! end of #metacontainer -->
<footer>
<div id="webpageinfo">
<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.fr">Droits de reproduction ©, Yann Esposito</a>
<div>
Site entièrement réalisé avec
<a href="http://www.vim.org">Vim</a>
et
<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>
<script type="text/javascript">
var clicky = { log: function(){ return; }, goal: function(){ return; }};
var clicky_site_id = 66374971;
(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/66374971ns.gif" /></p></noscript>
</body>
</html>

12
site/Scratch/sitemap.xml Normal file
View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">
<url>
<loc>http://yannesposito.com/Scratch/en/blog/feed/feed.xml</loc>
</url>
<url>
<loc>http://yannesposito.com/Scratch/sitemap.xml</loc>
</url>
<url>
<loc>http://yannesposito.com/Scratch/fr/blog/feed/feed.xml</loc>
</url>
</urlset>

View file

@ -1,16 +1,28 @@
@charset "UTF-8";
/* line 19, ../src/main.scss */
/* line 26, ../src/main.scss */
body {
background-color: #f6f6f0;
font-family: 'Kreon', Palatino, Georgia, arial, serif;
}
/* line 23, ../src/main.scss */
/* line 31, ../src/main.scss */
a {
color: #7689a6;
border: none;
text-decoration: none;
}
/* line 36, ../src/main.scss */
a:hover {
color: #88aadd;
}
/* line 40, ../src/main.scss */
#metacontainer {
border-bottom: 1px solid #888;
}
/* line 26, ../src/main.scss */
/* line 43, ../src/main.scss */
body > header {
margin: 0;
color: #CCC;
@ -23,7 +35,7 @@ body > header {
box-shadow: #333333 0px 1px 5px 0;
}
/* line 34, ../src/main.scss */
/* line 51, ../src/main.scss */
body > footer {
border-top: solid 2px rgba(0, 0, 0, 0.1);
border-bottom: solid 1px rgba(0, 0, 0, 0.1);
@ -39,17 +51,17 @@ body > footer {
box-shadow: #888888 0px 1px 5px 0;
}
/* line 45, ../src/main.scss */
/* line 62, ../src/main.scss */
nav {
border-bottom: solid 1px rgba(0, 0, 0, 0.1);
}
/* line 48, ../src/main.scss */
/* line 65, ../src/main.scss */
nav ul {
list-style-type: none;
}
/* line 51, ../src/main.scss */
/* line 68, ../src/main.scss */
nav ul li {
display: inline-block;
height: 50px;
@ -59,11 +71,10 @@ nav ul li {
border-right: solid 1px rgba(0, 0, 0, 0.2);
}
/* line 59, ../src/main.scss */
/* line 76, ../src/main.scss */
nav ul li a {
color: rgba(255, 255, 255, 0.8);
display: block;
text-decoration: none;
margin-right: 0px;
margin-left: 0px;
text-shadow: -1px -1px rgba(0, 0, 0, 0.2), 1px 1px rgba(0, 0, 0, 0.2);
@ -71,23 +82,23 @@ nav ul li a {
height: 100%;
}
/* line 68, ../src/main.scss */
/* line 84, ../src/main.scss */
nav ul li a:hover {
color: rgba(255, 255, 255, 0.8);
background-color: rgba(255, 255, 255, 0.1);
}
/* line 72, ../src/main.scss */
/* line 88, ../src/main.scss */
#main {
margin: 0px auto;
}
/* line 75, ../src/main.scss */
/* line 91, ../src/main.scss */
#container {
margin: 0px auto;
}
/* line 79, ../src/main.scss */
/* line 95, ../src/main.scss */
h1, h2, h3, h4, h5, h6 {
font-family: 'Expletus Sans',Futura,sans-serif;
text-shadow: 0px -1px 0px #2233aa, 0px 1px 0px white;

View file

@ -1,21 +0,0 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title></title>
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link rel="stylesheet" media="all" href="stylesheets/less.css"/>
<link rel="stylesheet" media="all" href="stylesheets/main.css"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<!-- Adding "maximum-scale=1" fixes the Mobile Safari auto-zoom bug: http://filamentgroup.com/examples/iosScaleBug/ -->
</head>
<body lang="en">
<div id="centraler">
<div id="container" style="margin: 0 auto;">
<div style="height: 600px; background: rgb(60,97,158)"></div>
</div>
</div>
</body>
</html>

View file

@ -3,10 +3,10 @@
/* TEAM */
<your title>: <your name>
Site:
Twitter:
Location:
Creator: Yann Esposito
Site: yannesposito.com
Twitter: yogsototh
Location: France
/* THANKS */
Names (& URL):

View file

@ -10,16 +10,33 @@ $default-box-shadow-h-offset : 0px;
// 2C5490 -> dark
// 7689A6 -> grey
$mainColor: #88AADD;
$lightGrey: #BCD0EE;
$light : #A9C5EE;
$dark : #2C5490;
$darkGrey : #7689A6;
$backgroundColor: #f6f6f0;
$higlightColor: #8AD;
$higlightColorShadow: #23A;
$topColor: #2C5490;
$footerColor: #BCD0EE;
$linkColor: $darkGrey;
body {
background-color: $backgroundColor;
font-family: 'Kreon', Palatino, Georgia, arial, serif;
}
a {
color: $linkColor;
border: none;
text-decoration: none;
}
a:hover {
color: $higlightColor;
}
#metacontainer{
border-bottom: 1px solid #888;
}
@ -58,7 +75,6 @@ nav ul li {
}
nav ul li a { color: rgba(255,255,255,0.8);
display: block;
text-decoration: none;
margin-right: 0px;
margin-left: 0px;
text-shadow: -1px -1px rgba(0,0,0,0.2), 1px 1px rgba(0,0,0,0.2);

View file

@ -1,153 +0,0 @@
/* Less Framework 4
* http://lessframework.com
* by Joni Korpi
* License: http://creativecommons.org/licenses/MIT/ */
/* line 7, ../../../../../../var/lib/gems/1.8/gems/compass-less-plugin-1.0/stylesheets/less/_reset.scss */
html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6,
p, blockquote, pre, a, abbr, address, cite, code, del, dfn, em,
img, ins, kbd, q, samp, small, strong, sub, sup, var, b, i, hr,
dl, dt, dd, ol, ul, li, fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, figure, figcaption, hgroup,
menu, footer, header, nav, section, summary, time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
}
/* line 14, ../../../../../../var/lib/gems/1.8/gems/compass-less-plugin-1.0/stylesheets/less/_reset.scss */
article, aside, canvas, figure, figure img, figcaption, hgroup,
footer, header, nav, section, audio, video {
display: block;
}
/* line 18, ../../../../../../var/lib/gems/1.8/gems/compass-less-plugin-1.0/stylesheets/less/_reset.scss */
a img {
border: 0;
}
/* line 1, ../../../../../../var/lib/gems/1.8/gems/compass-less-plugin-1.0/stylesheets/less/typography/_16px.scss */
.gigantic {
font-size: 110px;
line-height: 120px;
letter-spacing: -2px;
}
/* line 7, ../../../../../../var/lib/gems/1.8/gems/compass-less-plugin-1.0/stylesheets/less/typography/_16px.scss */
.huge, h1 {
font-size: 68px;
line-height: 72px;
letter-spacing: -1px;
}
/* line 13, ../../../../../../var/lib/gems/1.8/gems/compass-less-plugin-1.0/stylesheets/less/typography/_16px.scss */
.large, h2 {
font-size: 42px;
line-height: 48px;
}
/* line 18, ../../../../../../var/lib/gems/1.8/gems/compass-less-plugin-1.0/stylesheets/less/typography/_16px.scss */
.bigger, h3 {
font-size: 26px;
line-height: 36px;
}
/* line 23, ../../../../../../var/lib/gems/1.8/gems/compass-less-plugin-1.0/stylesheets/less/typography/_16px.scss */
.big, h4 {
font-size: 22px;
line-height: 30px;
}
/* line 28, ../../../../../../var/lib/gems/1.8/gems/compass-less-plugin-1.0/stylesheets/less/typography/_16px.scss */
body {
font: 16px/24px Georgia, serif;
}
/* line 32, ../../../../../../var/lib/gems/1.8/gems/compass-less-plugin-1.0/stylesheets/less/typography/_16px.scss */
.small, small {
font-size: 13px;
line-height: 18px;
}
/* line 18, ../src/partials/_global.scss */
body {
background: #e8e8e8;
color: #3c3c3c;
-webkit-text-size-adjust: 100%;
}
/* line 34, ../../../../../../var/lib/gems/1.8/gems/compass-less-plugin-1.0/stylesheets/less/_framework.scss */
::selection {
background: rgb(255,255,158);
}
/* line 35, ../../../../../../var/lib/gems/1.8/gems/compass-less-plugin-1.0/stylesheets/less/_framework.scss */
::-moz-selection {
background: rgb(255,255,158);
}
/* line 36, ../../../../../../var/lib/gems/1.8/gems/compass-less-plugin-1.0/stylesheets/less/_framework.scss */
img::selection {
background: transparent;
}
/* line 37, ../../../../../../var/lib/gems/1.8/gems/compass-less-plugin-1.0/stylesheets/less/_framework.scss */
img::-moz-selection {
background: transparent;
}
/* line 38, ../../../../../../var/lib/gems/1.8/gems/compass-less-plugin-1.0/stylesheets/less/_framework.scss */
body {
-webkit-tap-highlight-color: rgb(255,255,158);
}
/* Default Layout: 992px.
* Gutters: 24px.
* Outer margins: 48px.
* Leftover space for scrollbars @1024px: 32px. */
/* line 6, ../src/partials/_default.scss */
#container {
width: 896px;
padding: 72px 48px 84px;
}
/* Tablet Layout: 768px.
* Gutters: 24px.
* Outer margins: 28px.
* Inherits styles from: Default Layout. */
@media only screen and (min-width: 768px) and (max-width: 991px) {
/* line 7, ../src/partials/_tablet.scss */
#container {
width: 712px;
padding: 48px 28px 60px;
}
}
/* Mobile Layout: 320px.
* Gutters: 24px.
* Outer margins: 34px.
* Inherits styles from: Default Layout. */
@media only screen and (max-width: 767px) {
/* line 7, ../src/partials/_mobile.scss */
#container {
width: 252px;
padding: 48px 34px 60px;
}
}
/* Wide Mobile Layout: 480px.
* Gutters: 24px.
* Outer margins: 22px.
* Inherits styles from: Default Layout, Mobile Layout. */
@media only screen and (min-width: 480px) and (max-width: 767px) {
/* line 7, ../src/partials/_wide-mobile.scss */
#container {
width: 436px;
padding: 36px 22px 48px;
}
}
/* Retina media query.
Overrides styles for devices with a
device-pixel-ratio of 2+, such as iPhone 4. */
@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-device-pixel-ratio: 2) {}

View file

@ -1,4 +0,0 @@
/* line 1, ../src/main.scss */
#container {
margin: 0 auto;
}

View file

@ -0,0 +1,57 @@
#!/usr/bin/env ruby
class Frequencies
def initialize
@nbwords=0
@tag=Hash.new
end
def nbwords
@nbwords
end
def is_bad_word(w)
if w.length < 3
return true
end
if w !~ /\A(\w|\d)*\Z/
return true
end
return false
end
def update_density(content)
content.split(/\b/).each do |m|
if is_bad_word(m)
next
end
@nbwords += 1
if @tag.has_key?(m)
@tag[m]+=1
else
@tag[m]=1
end
end
end
def show_tags
@tag.keys.sort_by do |k|
@tag[k]
end.each do |k|
puts %{#{@tag[k]} #{k}}
end
end
end
f=Frequencies.new
ARGV.each do |file|
puts '['+file+']'
fic=File.open(file)
fic.each_line do |l|
f.update_density(l)
end
fic.close
end
f.show_tags

69
tasks/auto_tags/density.rb Executable file
View file

@ -0,0 +1,69 @@
#!/usr/bin/env ruby
class Density
def density(content)
tag=Hash.new
nbwords=0
content.split(/\b/).each do |m|
if m.length < 3
next
end
if m !~ /\A(\w|\d)*\Z/
next
end
nbwords += 1
if tag.has_key?(m)
tag[m]+=1
else
tag[m]=1
end
end
nbwords=nbwords.to_f
res=Hash.new
tag.each do |w,v|
if v == 1
next
end
res[w]=v/nbwords
end
return res
end
def initialize
fic=File.open('frequencies.val')
@sum=0
@all_freq=Hash.new
fic.each_line do |l|
l =~ /([^ ]*) (.*)/
nb=$1.to_i
@all_freq[$2]=nb
@sum+=nb
end
fic.close
end
def show_tags(hash)
hash.keys.sort_by do |k|
-hash[k]/( @all_freq[k] / @sum )
end[0..10].each do |k|
puts %{#{hash[k]}: #{k}}
end
end
end
freq_for={}
d=Density.new
ARGV.each do |file|
puts '['+file+']'
fic=File.open(file)
content=""
fic.each_line do |l|
content <<= l
end
fic.close
freq_for[file]=d.density(content)
d.show_tags(freq_for[file])
end

File diff suppressed because it is too large Load diff

72
tasks/auto_tags/tf.rb Executable file
View file

@ -0,0 +1,72 @@
#!/usr/bin/env ruby
def tf(content)
tag=Hash.new
nbwords=0
content.split(/\b/).each do |m|
if m.length<3
next
end
if m !~ /\A(\w|\d)*\Z/
next
end
nbwords += 1
if tag.has_key?(m)
tag[m]+=1
else
tag[m]=1
end
end
nbwords=nbwords.to_f
res=Hash.new
tag.each do |w,v|
if v == 1
next
end
res[w]=v/nbwords
end
return res
end
def show_tags(hash)
hash.keys.sort_by do |k|
-hash[k]
end[0..10].each do |k|
puts %{#{hash[k]}: #{k}}
end
end
freq_for={}
allcontent=""
ARGV.each do |file|
puts '['+file+']'
fic=File.open(file)
content=""
fic.each_line do |l|
content <<= l
end
fic.close
freq_for[file]=tf(content)
# show_tags(freq_for[file])
# puts '==============='
allcontent <<= content
end
# puts 'ALL FREQ'
all_freq=tf(allcontent)
# show_tags(all_freq)
# puts '==============='
res_for={}
freq_for.each do |file,hash|
puts %{==== Frequencie for #{file} =====}
res_for[file]=Hash.new
hash.each do |k,v|
if all_freq[k] == 0
next
end
res_for[file][k] = v/all_freq[k]
# puts %{#{v} / #{all_freq[k]} : #{k}}
end
show_tags(res_for[file])
end

22
tasks/autopublish Executable file
View file

@ -0,0 +1,22 @@
#!/usr/bin/env zsh
source ~/.zshrc
publishdir="$HOME/Sites/blog"
publisherhost="YiMac.local"
if [[ $HOST != "YiMac.local" ]]; then
print -- "You're Not on '$publisherhost' host"
exit 1
fi
if [[ ! -d $publishdir ]]; then
print -- "Directory '$publishdir' not found"
exit 1
fi
# actions are:
# go to the directory containing the webroot project
# pull updates from webroot
# regen all website
# publish to mobile me
cd $publishdir && git pull && touch layouts/default.html && ./tasks/recompile && ./tasks/publish

29
tasks/config Normal file
View file

@ -0,0 +1,29 @@
#!/usr/bin/env zsh
# Configuration
mobileMeUser="yann.esposito"
webroot=$HOME/Sites/blog/output
siteName="Scratch"
export PATH="$PATH:$HOME/Sites/blog/tasks"
# Récupération des fichiers
if [[ $(hostname) == 'ubuntu' ]]; then
iDisk='/mnt/iDisk'
else
iDisk="/Volumes/$mobileMeUser"
fi
srcRep="$webroot/$siteName"
destRep="$iDisk/Web/Sites/$siteName"
[[ ! -d $webroot ]] && {
print -- "$webroot n'existe pas ; vérifiez la conf" >&2;
exit 1
}
[[ ! -d $destRep ]] && {
print -- "$destRep n'existe pas, veuillez remonter le FS" >&2;
exit 1
}

19
tasks/create-reference-file.sh Executable file
View file

@ -0,0 +1,19 @@
#!/usr/bin/env zsh
source $0:h/config
if (($#<1)); then
baseRep="$srcRep"
else
baseRep="$1"
fi
for fic in $baseRep/**/*(.); do
print -n -- "${fic#${baseRep}} "
extension="$fic:e"
if [[ $extension = "html" || $extension = "xml" ]]; then
perl -pe 's%<a href="(&#x6d;|&#109;|m)[^>]*>[^>]*</a>%%gim' $fic | openssl sha1
else
openssl sha1 < $fic
fi
done

55
tasks/ghpublish Executable file
View file

@ -0,0 +1,55 @@
#!/usr/bin/env zsh
rootdir=$HOME/Sites/webroot
function log {
print -P -- $*
}
function debug {
# print -- $*
eval $*
}
current_branch=$(git branch | egrep '^\*' | awk '{print $2}')
cd $rootdir || { print -- "Unable to go to $HOME/Sites/webroot"; exit 1 }
git co master || { exit 1 }
git pull || { exit 1 }
# empty regen depencies cache because of a bug
\rm -f ./tmp/*(N)
./tasks/recompile
if git status | grep 'nothing to commit'>/dev/null 2>&1; then
else
git add .
git commit -m "regeneration"
fi
# update & push gh-pages
log "Update and push gh-pages"
debug git co gh-pages
(( $? == 0 )) || { exit 1 }
debug git pull
(( $? == 0 )) || { exit 1 }
debug \rm -rf *(N)
(( $? == 0 )) || { exit 1 }
debug git co master output
(( $? == 0 )) || { exit 1 }
debug git unstage output
debug mv output/index.html .
(( $? == 0 )) || { exit 1 }
debug mv output/Scratch/* .
(( $? == 0 )) || { exit 1 }
debug \rm -rf output
(( $? == 0 )) || { exit 1 }
debug cp site/404.html 404.html
(( $? == 0 )) || { exit 1 }
debug echo "yannesposito.com" > CNAME
(( $? == 0 )) || { exit 1 }
debug git add .
(( $? == 0 )) || { exit 1 }
debug git commit -m '"updated website"'
(( $? == 0 )) || { exit 1 }
debug git push origin gh-pages:gh-pages
(( $? == 0 )) || { exit 1 }
debug git co $current_branch

20
tasks/hpublish Executable file
View file

@ -0,0 +1,20 @@
#!/usr/bin/env zsh
if [[ $HOST = "YiMac.local" ]]; then
cd $HOME/Sites/webroot
git co master
(( $? == 0 )) || { exit 1 }
git pull
(( $? == 0 )) || { exit 1 }
# empty regen depencies cache because of a bug
# \rm -f ./tmp/*
./tasks/recompile
if git status | grep 'nothing to commit'>/dev/null 2>&1; then
else
git add .
git commit -m "regeneration"
fi
git push heroku master
else
ssh yimac ./Sites/webroot/tasks/hpublish
fi

96
tasks/incPublish Executable file
View file

@ -0,0 +1,96 @@
#!/usr/bin/env zsh
# Script synchronisant le site sur me.com
# normalement, le site est indisponible le moins de temps possible
# le temps de deux renommages de répertoire
# configuration
mobileMeUser="yann.esposito"
webroot=$HOME/Sites/webroot/output
siteName="Scratch"
# Get Environment
if [[ $(hostname) == 'ubuntu' ]]; then
iDisk='/mnt/iDisk'
else
iDisk="/Volumes/$mobileMeUser"
fi
srcRep="$webroot/$siteName"
destRep="$iDisk/Web/Sites/$siteName"
# print error and exit
function err { print -P -- "$*" >&2; exit 1 ; }
[[ ! -d $webroot ]] && err "$webroot n'existe pas ; vérifiez la conf"
[[ ! -d $destRep ]] && err "$destRep n'existe pas, veuillez remonter le FS"
if [[ $1 == '-h' ]]; then
print -- "usage : $0:h [-h|-a|-s|-t]"
print -- " -h affiche l'aide"
exit 0
fi
function trymkdir {
target="$1"
print -- mkdir $target
local essai=1
if ((!testmode)); then
while mkdir $target; do
print -- "Echec: essai n°$essai"
((essai++))
done
fi
}
function trycp {
element="$1"
target="$2"
if [[ ! -d ${target:h} ]]; then
trymkdir ${target:h}
fi
local essai=1
print -- cp $element $target
if ((!testmode)); then
while cp $element $target; do
print -- "Echec: essai n°$essai"
((essai++))
done
fi
}
function createReferenceFile {
for element in $srcRep/**/*(.); do
print -n "${element#${srcRep}} "
perl -pe 's%<a href="(&#x6d;|&#109;|m)[^>]*>[^>]*</a>%%gim' $element | openssl sha1
done
}
localRefFile="$srcRep/reference.yrf"
remoteRefFile="/tmp/remoteRefFile.yrf"
function incrementalPublish {
# -- get server Reference File
if [[ -e $destRep/reference.yrf ]]; then
trycp $destRep/reference.yrf $remoteRefFile
else
err "Utilisez le mode rsync ; impossible de trouver $destRep/reference.yrf"
fi
# -- make local Reference File
createReferenceFile > $localRefFile
# -- use the diff between them to update
# get the list of files to update
set -a filesToUpdate
filesToUpdate=( $( diff -y $localRefFile $remoteRefFile | perl -ne 'if (m/([^ ]*) ([0-9a-f])*[ ]*\|/) { print "$1\n"; }elsif (m/([^ ]*) ([0-9a-f]*)[ ]*</) { print "$1\n"; }elsif(m/>\s*([^\s]*) /) { print "$1\n"; }' ) )
# get
for fic in $filesToUpdate; do
print trycp $srcRep/$fic $destRep/$fic
done
}
print -- "Root = $webroot"
print -- "Dest = $destRep"
incrementalPublish

60
tasks/multi.vim Normal file
View file

@ -0,0 +1,60 @@
" clear all preceeding definition
syntax clear
" case sensitive language
syntax case match
" Begining
syntax region multiInline start=/^..: / end=/$/ contains=ALL oneline
highlight link multiInline Type
" To add in your Vimrc
"
" multilanguage folders
autocmd BufEnter *.md setlocal foldmethod=expr
" se lance avec execute FrenchView()
fun! FrenchView()
%g/^en: .*$\n^en: /foldclose
%g/^fr: .*$\n^fr: /foldopen
" setlocal foldexpr=getline(v:lnum)=~'^en:\ '?1:0
endfun
" se lance avec execute EnglishView()
fun! EnglishView()
%g/^fr: .*$\n^fr: /foldclose
%g/^en: .*$\n^en: /foldopen
" setlocal foldexpr=getline(v:lnum)=~'^fr:\ '?1:0
endfun
fun! MyFoldLevel(lnum)
if getline(a:lnum)=~'^fr:\ '
if getline(a:lnum+1)=~'^fr:\ '
return '1'
else
return '<1'
endif
else
if getline(a:lnum)=~'^en:\ '
if getline(a:lnum+1)=~'^en:\ '
return '1'
else
return '<1'
endif
else
return 0
endif
endif
endfun
" se lance avec execute MultiView()
fun! MultiView()
setlocal foldexpr=MyFoldLevel(v:lnum)
endfun
:command FR execute FrenchView()
:command EN execute EnglishView()
:command MM execute MultiView()
autocmd BufEnter *.md execute MultiView()
autocmd BufEnter latest.md set scrollbind
autocmd BufEnter latest.md execute FrenchView()
autocmd BufEnter latest.md vsplit
autocmd BufEnter latest.md execute EnglishView()

65
tasks/new_blog_entry Executable file
View file

@ -0,0 +1,65 @@
#!/usr/bin/env zsh
# print usage if no title is given
if (($#<1)); then
print -- "Create a new blog entry setting default parameters such as the date."
print -P -- "%BUsage:%b\t$0:t post_title"
exit 1
fi
cd $0:t/..
root="$PWD"
title="$*"
# basefilename is the filename where all spaces
# were replaced by '-'
# and all accentued letter by corresponding ASCII one
basefilename="$( print $title | perl -pe 'chomp(); s#ç#c#g; s#àâ#a#g; s#éèê#e#g; s#ô#o#g; s#û#u#g; s#\W#-#g')"
# construct the final filename
yearmonthday=$( date "+%Y-%m-%d" )
linkname="$root/latest.md"
filename="$root/multi/blog/${yearmonthday}-$basefilename.md"
[[ ! -d ${filename:h} ]] && mkdir -p ${filename:h}
dirname="$root/output/Scratch/img/blog/${yearmonthday}-${basefilename}"
[[ -e $filename ]] && {
print -P -- "%BAttention%b : $filename existe déjà."
print -P -- "%BError try with a new name%b"
exit 3
}
# now title and filename are well defined
print " title = $title"
print "filename = $filename"
now=$( date "+%Y-%m-%dT%H:%M:%S+02:00" )
> $filename cat << ENDFORMAT
-----
isHidden: false
menupriority: 1
kind: article
created_at: $now
fr: title: $title
en: title: $title
author_name: Yann Esposito
author_uri: yannesposito.com
# tags:
-----
<%= blogimage("main.png","Title image") %>
begindiv(intro)
en: <%= tldr %>
fr: <%= tlal %>
enddiv
ENDFORMAT
print "imagedir = $dirname"
mkdir $dirname
ln -sf ./multi/${filename#*/multi/} $linkname
vim $linkname

128
tasks/publish Executable file
View file

@ -0,0 +1,128 @@
#!/usr/bin/env zsh
# Script synchronisant le site sur me.com
# normalement, le site est indisponible le moins de temps possible
# le temps de deux renommages de répertoire
# get configuration
# mostly directories
source $0:h/config
# get trycp function (copy until success)
source $0:h/webdav-framework
if [[ $1 == '-h' ]]; then
print -- "usage : $0:h [-h|-s|-d]"
print -- " -h affiche l'aide"
print -- " -d modification directe (pas de swap)"
print -- " -s swappe simplement les répertoires"
fi
# publication incrementale
function incrementalPublish {
local ydestRep=$destRep$suffix
localRef="$srcRep/map.yrf"
print -- "Creation du fichier de references"
create-reference-file.sh > $localRef
remoteRef="/tmp/remoteSiteMapRef.$$.yrf"
if [[ ! -e "$ydestRep/map.yrf" ]]; then
# pas de fichier de reference sur la cible
print -- "pas de fichier de reference sur la cible, passage en mode rsync"
rsyncPublish
swap
else
trycp "$ydestRep/map.yrf" "$remoteRef"
typeset -U filesToUpdate
filesToUpdate=( $(diff $localRef $remoteRef | awk '/^[<>]/ {print $2}' ) )
if ((${#filesToUpdate} == 1)); then
print -- "Seul le fichier ${filesToUpdate} sera téléversé"
elif ((${#filesToUpdate}<10)); then
print -- "${#filesToUpdate} fichiers seront téléversés :"
print -- "${filesToUpdate}"
else
print -- "${#filesToUpdate} fichiers seront téléversés"
fi
# copy all file with some differences
# except the map in case of error
for element in $filesToUpdate; do
if [[ $element == "/map.yrf" ]]; then
continue
fi
if [[ -e $srcRep$element ]]; then
trycp $srcRep$element $ydestRep$element
else
tryrm $ydestRep$element
fi
done
# if all went fine, copy the map file
trycp $srcRep/map.yrf $ydestRep/map.yrf
# remove the temporary file
\rm $remoteRef
# if we have used the tmp directory we swap
if [[ "$suffix" != "" ]]; then
swap
fi
fi
}
# publication via rsync
function rsyncPublish {
result=1
essai=1
while (( $result > 0 )); do
print -- rsync -arv $srcRep/ $destRep.tmp
if ((!testmode)); then
rsync -arv $srcRep/ $destRep.tmp
fi
result=$?
if (( $result > 0 )); then
print -P -- "%BEchec du rsync%b (essai n°$essai)" >&2
fi
((essai++))
done
}
# swap
function swap {
print -P -- "%B[Directory Swap (tmp <=> target)]%b"
[[ -e $destRep.old ]] && tryrm $destRep.old
print -- " renommage du repertoire sandard vers le .old"
tryrename $destRep $destRep.old
print -- " renommage du repertoire tmp (nouveau) vers le standard"
print -P -- "%B[Site Indisponible]%b $(date)"
tryrename $destRep.tmp $destRep
print -P -- "%B[Site Disponible]%b $(date)"
print -- " renommage du repertoire old vers le tmp"
tryrename $destRep.old $destRep.tmp
print -P -- " publication terminée"
}
print -- "Root = $webroot"
print -- "Dest = $destRep"
if [[ "$1" = "-s" ]]; then
swap
else
if [[ "$1" = "-a" ]]; then
print -Pn "Copie de l'init "
\cp -f ${webroot:t}/index.html ${destRep:h}/index.html
if [[ $? -eq 0 ]]; then
print -P "[%Bdone%b]"
else
print -P "[%BFailed%b]"
exit 1
fi
fi
if [[ "$1" = "-d" ]]; then
suffix=""
else
suffix=".tmp"
fi
print -P -- "%BSync%b[${Root:t} => ${destRep:t}$suffix]"
incrementalPublish
fi

42
tasks/recompile Executable file
View file

@ -0,0 +1,42 @@
#!/usr/bin/env zsh
source ~/.zshrc
languages=( fr en )
typeset -a exclu
function join {
char=$1
shift
res=$1
shift
for arg in $@; do
res=$res$char$arg
done
print $res
}
typeset -a priority_list
for fic in multi/**/*(.); do
for language in $languages; do
dest=content/html/$language/${fic#multi/}
exclu=()
if [[ ! -e $dest || $fic -nt $dest ]]; then
print $dest
[[ ! -d ${dest:h} ]] && mkdir ${dest:h}
for l in $languages; do
case $l in
$language) continue ;;
esac
exclu=( $exclu $l )
done
awk '! /^('$exclu'): / { sub(/^'$language': /,""); print $0 }' < $fic > $dest
priority_list=( $priority_list ${${dest#content/}:r} )
fi
done
done
cmd="nanoc co $priority_list"
print -- '==='
print -- $cmd
eval $cmd

7
tasks/reinitWebsite.sh Executable file
View file

@ -0,0 +1,7 @@
#!/usr/bin/env zsh
for rep in output/Scratch/{en,fr,assets}(/N) output/Scratch/sitemap.xml(.N); do
print -- "Suppression de $rep"
git co $rep
done
print -- "Website reinit from HEAD"

7
tasks/resetWebSite.sh Executable file
View file

@ -0,0 +1,7 @@
#!/usr/bin/env zsh
for rep in output/Scratch/{en,fr,assets}(/N); do
print -- "Suppression de $rep"
\rm -rf $rep
done
print -- "Le site est complètement nettoyé"

11
tasks/serve.py Executable file
View file

@ -0,0 +1,11 @@
#!/usr/bin/env python
import os # pour le chdir
import SimpleHTTPServer
import SocketServer
# minimal web server.
os.chdir(os.environ['HOME']+'/Sites/webroot/output')
PORT = 8000
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
httpd = SocketServer.TCPServer(("", PORT), Handler)
print "serving at port", PORT
httpd.serve_forever()

108
tasks/webdav-framework Normal file
View file

@ -0,0 +1,108 @@
#!/usr/bin/env zsh
function samelineprint {
print -n -P -- "\r$*"
}
# avec 1 essai par seconde: 300 = 5 minutes
maxessais=300
# try to create a directory until success
function trymkdir {
target="$1"
print -- mkdir -p $target
local essai=1
while ! mkdir -p $target; do
samelineprint "Echec: essai n°$essai"
((essai++))
((essai>maxessais)) && exit 5
done
print
}
# try to copy until success
function trycp {
element="$1"
target="$2"
if [[ ! -d ${target:h} ]]; then
trymkdir ${target:h}
fi
local essai=1
print -- cp $element $target
while ! \cp $element $target; do
samelineprint "Echec: essai n°$essai"
((essai++))
((essai>maxessais)) && exit 5
done
print
}
# try to remove until success
function tryrm {
target="$1"
local essai=1
local options=''
[[ -d $target ]] && options='-rf'
print -- rm $options $target
while ! rm $options $target; do
samelineprint "Echec: essai n°$essai"
((essai++))
((essai>maxessais)) && exit 5
done
essai=1
while [[ -e $element ]]; do
samelineprint "rm reussi mais fichier source non disparu n°$essai"
sleep 1
((essai++))
((essai>maxessais)) && exit 5
done
print
}
# try to rename until success
function tryrename {
element="$1"
target="$2"
local essai=1
while [[ -e $target ]]; do
samelineprint "Echec n°$essai le fichier $target existe déjà"
((essai++))
((essai>maxessais)) && exit 5
sleep 1
done
print -- mv $element $target
while ! mv $element $target; do
samelineprint "Echec: essai n°$essai"
((essai++))
((essai>maxessais)) && exit 4
done
essai=1
while [[ -e $element ]]; do
samelineprint "mv reussi mais fichier source non disparu n°$essai"
sleep 1
((essai++))
((essai>maxessais)) && exit 5
done
print
}
# try to move until success
function trymv {
element="$1"
target="$2"
local essai=1
print -- mv $element $target
while ! mv $element $target; do
samelineprint "Echec: essai n°$essai"
((essai++))
((essai>maxessais)) && exit 5
done
essai=1
while [[ -e $element ]]; do
samelineprint "mv reussi mais fichier source non disparu n°$essai"
sleep 1
((essai++))
((essai>maxessais)) && exit 5
done
print
}