Commits

Anonymous committed 9351dca

added index list, import comments from sofa. Lot of css work.

  • Participants
  • Parent commits fc29022

Comments (0)

Files changed (25)

_attachments/css/.benoitc.css.swp

Binary file added.

_attachments/css/benoitc.css

+/* 18px base font size / 25px baseline */
+body {
+	font-size: 100%;   /* 18px (probably) */
+	line-height:1.5;
+	letter-spacing:-0.015em;
+	margin:0 10px;
+	font-family: 'lucida sans unicode', 'lucida grande',
+		helvetica, 'bitstream vera sans', sans-serif;
+	color:#223;
+	background-color:#fff;
+}
+
+#container {
+	max-width:40em;
+	margin:0 auto;
+}
+
+h1, h2, h3 {
+	font-family:georgia, 'bitstream vera sans serif', 'lucida grande',
+		helvetica, verdana, sans-serif;
+	font-weight:normal;
+	letter-spacing:-0.05em;
+	color:#000;
+}
+i, em {
+	font-style:italic;
+}
+b, strong {
+	font-weight:bold;
+	color:#000;
+}
+blockquote {
+	color:#555;
+}
+blockquote em {
+	color:#333;
+	font-style:italic;
+}
+blockquote strong {
+	color:#333;
+	font-weight: normal;
+}
+dt {
+	font-weight:bold;
+	color:#000;
+}
+tt, pre, code, samp, kbd {
+	font-family: consolas, 'lucida console', 'bitstream vera sans mono',
+		'courier new', monospace;
+	color: #000;
+}
+pre {
+	color:#333;
+	background-color:#f9f9f9;
+}
+code {
+	color:#007A00;
+}
+pre code {
+	color:#333;
+}
+a, a:link {
+	color:#023;
+	background:#eef;
+}
+a:visited {
+	color:#345;
+	background:#fff;
+}
+a:hover {
+	background:#ccf;
+	color:#000;
+	text-decoration:none;
+}
+
+
+/* TYPOGRAPHY */
+
+p, ul, ol, dl, pre, blockquote, table, form {
+	margin:1em 0;
+}
+dl {
+	margin-left:2em;
+}
+hr {
+	color:#eee;
+	background-color:#ccc;
+	border:0;
+	height:1px;
+	margin:1.5em 0;
+}
+blockquote {
+	font-size:0.83333em;  /* 15px */
+	line-height:1.66666;   /* 25px */
+	margin:1.2em 3em;
+	padding:0;
+}
+tt, pre, code, samp, kbd {
+	font-size: 16px;
+	line-height:1.1;
+}
+pre {
+	margin:1.5em 0;
+	padding:6px 4px 4px 6px;
+	border:1px solid #eee;
+	border-left-width:20px;
+	overflow:auto;
+}
+h1 {
+	font-size:2.3333em;      /* 42px */
+	line-height:1.1904;      /* 50px */
+	margin:0.5952em 0;       /* 25px */
+}
+h2 {
+	font-size:1.66666667em;  /* 30px */
+	line-height:1.2;         /* 36px */
+	margin:1em 0;
+}
+h3 {
+	font-size:1.22222222em;  /* 22px */
+	line-height:1.13636363;  /* 25px */
+	margin:1em 0;
+}
+h4 {
+	font-size:1em;
+	font-weight:bold;
+	line-height:1.5;
+	margin:1em 0;
+}
+
+.content header {
+	margin:1em 20px;
+	text-align:center;
+}
+.content header h1 {
+    font-family: georgia;
+    font-size: 2.6em;
+    color: #111;
+    line-height: 100%;
+    margin-bottom: 0.5em;
+    font-weight: bold;
+    font-style: italic;
+}
+.content header time {
+	display: block;
+}
+.content header time,
+.content header p {
+	font-variant:small-caps;
+	text-transform:capitalize;
+	text-align: center;
+}
+
+.content footer {
+	display: block;
+	border-top:1px solid #DDDDDD;
+	margin-top:1em;
+	background-color: #e5f1f4;
+}
+
+/* Header / Titling
+--------------------------------------------------------------------------- */
+header.page {
+	display: block;
+	position: relative;
+	width: 100%;
+	height: 100px;
+	clear: both;
+
+}
+
+header.page h1 {
+	display: block;
+	float: right;
+	text-align: right;
+	margin: 5px 0;
+	padding: 15px 115px 0 0;
+	background: url(../img/avatar.png) right top no-repeat;
+	height: 100px;
+	z-index: 90;
+	width: 300px;
+}
+header.page h2 {
+	margin-top: -70px;
+	padding: 0 115px 0 0;	
+	z-index: 100;
+	color:#345;
+	text-align: right;
+	float: right;
+}
+
+header.page h1 a, 
+header.pag h1 a:link, 
+header.page h1 a:visited, 
+header.page h1 a:hover {
+	color: #000;
+	text-decoration:none;
+	background:transparent;
+}
+
+
+header.page #mainav {
+	display: block;
+	z-index: 80;
+	width: 150px;
+	float: left;
+	position: relative;
+}
+
+#mainav ul,
+#mainnav ul li,
+#mainav li a {
+	margin: 0;
+	padding: 0;
+}
+
+#mainav ul {
+	position: relative;
+	list-style: none;
+	margin: 20px 0;
+	padding: 0;
+}
+
+#mainav a,
+#mainav li {
+	font-size: 80%;
+	line-height: 1;
+}
+
+
+
+/* COMMENTS */
+
+ol.comments {
+	padding-left:25px;
+}
+ol.comments > li {
+	margin-bottom:3em;
+}
+ol.comments h3 {
+	color:#555;
+}
+ol.comments h3 .commentor {
+	font-family: 'lucida sans unicode', 'lucida grande',
+		helvetica, 'bitstream vera sans', sans-serif;
+}
+ol.comments .comment-meta {
+	font-size:0.8888em;    /* 16px */
+	line-height:1.125;
+	text-align: right;
+	color: #555;
+}
+ol.comments .commentor {
+	color:#000;
+	background:#fff;
+}
+#comments form.leave {
+	margin-left: 40px;
+}
+#comments form.leave textarea {
+	width: 100%;
+}
+
+/* ADMIN STUFF */
+
+#edit {
+    height: 100%;
+    overflow:hidden;
+}
+#edit #fedit {
+    display: block;
+    position: relative;
+     width: 50%;
+    float: left;
+    height: 100%;
+
+}
+
+#edit #mdpreview {
+    display: block;
+    position: relative;
+    width: 48%;
+    float: right;
+    height: 100%;
+    margin:0;
+   padding: 0; 
+    overflow: auto;    
+}
+
+#fedit p {
+    display: block;
+    padding-bottom: 5px;
+}
+#fedit form label {
+    display: block;
+    width: 14em;
+    height: 11px;
+    float: left;
+    padding: 0 1em 3px 0;
+}
+#fedit input[type='text'], 
+#fedit input[type='password'],
+#fedit select {
+    width: 174px;
+    border: 1px solid;
+    margin: 0;
+}
+
+#fedit textarea {
+    width: 99%;
+    height: 100%;
+    border: 1px solid;
+    height: 280px;
+}
+
+
+/* FOOTER */
+
+#main-footer {
+    display: block;
+	clear:both;
+	color:#555;
+	font-size:0.88888888em;
+	line-height:1.5625;
+	border-top:1px solid #ddd;
+	padding:19px 0 0 0;
+	margin:40px 0 20px 0;
+	text-align:center;
+}
+#main-footer p {
+	margin:0;
+}
+#main-footer form {
+	float:right;
+}
+#main-footer input{
+	font-size:10px;
+}
+
+/* MISC HELPER STYLES */
+
+p small, p.note, .intro {
+	font-size:0.8333333em; /* 15px */
+	line-height:1.85;
+	color:#555;
+	margin:1.45em 0;
+}
+ul.clean, ol.clean {
+	list-style-type: none;
+	padding-left: 0;
+}
+.caps {
+	font-variant:small-caps;
+}
+.clear {
+	clear:both;
+}
+.left{
+	float:left;
+}
+.right{
+	float:right;
+}
+.intro {
+	border:1px solid #ccc;
+	padding:0.5em;
+	font-style:italic;
+}
+
+.friendpaste,
+.friendpaste *,
+.friendpaste * * {
+	margin: 0;
+	padding: 0;
+}
+
+.friendpaste table,
+.friendpaste pre,
+.friendpaste table pre,
+.friendpaste pre table{
+	margin: 0;
+	padding: 0;
+	line-height: 16px;
+}
+.friendpaste pre {
+	overflow: none;
+}
+.friendpaste table.sourceTable {
+	display: inline;
+}
+
+.friendpaste td {
+	font-size: 16px;
+}
+/* INDEX */
+
+body#home #header p {
+	font-size:0.846em;             /* 15px */
+	line-height:1.81818;
+}
+
+.index article.entry {
+	display: block;
+	margin:3em 0;
+}
+.index header.meta p {
+	font-size:0.846em;             /* 15px */
+	line-height:1.8; /* 25px */
+	color:#555;
+	margin:0;
+	text-align:right;
+}
+.index h3 {
+	font-weight:bold;
+	font-family:'lucida sans unicode', 'lucida grande',
+		helvetica, 'bitstream vera sans', sans-serif;
+	display:inline;
+}
+.index h3 + p{
+	display:inline;
+	margin-left:5px;
+}
+.index img.icon {
+	margin-left:-30px;
+	margin-right:10px;
+}
+
+
+/* PRINT */
+
+@media print {
+	html, body, #container {
+		margin:0;
+	}
+	#container {
+		width:100%;
+		max-width:100%;
+	}
+	#header {
+		margin-top:0;
+	}
+	#footer {
+		display:none;
+	}
+	a, a:link, a:visited {
+		color:#000;
+		background:#fff;
+		text-decoration:none;
+	}
+	@page {
+		size:8.5in 11in;
+	}
+}
+
+
+/* RESUME */
+
+.chrono h3 {
+	margin-bottom:0;
+}
+.chrono p.period {
+	text-align:right;
+	font-weight:bold;
+}
+.chrono p.biz {
+	float:left;
+}
+.chrono .stuff {
+	clear:all;
+}
+.chrono li li {
+	list-style-type:disc;
+}
+@media print {
+	.chrono p.biz a {
+		font-weight:bold;
+	}
+}
+
+/* ABOUT */
+
+.about img.me {
+	float:left;
+	border:1px solid #333;
+	margin:5px 25px 25px 0;
+}
+
+
+/* FUCKING IE */
+
+* html body{width:40em}
+* html div.index{width:34.5em}
+
+/* vim: set ft=css ts=4 sw=4 noexpandtab: */
+

_attachments/css/layout.css

-body {
-    background-color: #FFFFFF url(../img/bg.gif) repeat-x scroll center top; 
-    color: #000;
-}
-
-#container {
-    width: 100%;
-}
-
-
-a {
-    color: #14456e;
-}
-h2, h3 {
-font-size:medium;
-}
-
-body {
-    -x-system-font:none;
-    font-family:'Gill Sans','Gill Sans MT',Verdana,sans-serif;
-    font-size:medium;
-    font-size-adjust:none;
-    font-stretch:normal;
-    font-style:normal;
-    font-variant:normal;
-    font-weight:normal;
-    line-height: 18px;
-    font-size: 12px;
-}
-
-
-
-img { border: none; }
-
-#main-footer {
-    clear: both;
-    width: 100%;
-}
-
-#edit {
-    height: 100%;
-    overflow:hidden;
-}
-#edit #fedit {
-    display: block;
-    position: relative;
-     width: 50%;
-    float: left;
-    height: 100%;
-
-}
-
-#edit #mdpreview {
-    display: block;
-    position: relative;
-    width: 48%;
-    float: right;
-    height: 100%;
-    margin:0;
-   padding: 0; 
-    overflow: auto;    
-}
-
-#fedit p {
-    display: block;
-    padding-bottom: 5px;
-}
-form label {
-    display: block;
-    width: 14em;
-    height: 11px;
-    float: left;
-    padding: 0 1em 3px 0;
-}
-input[type='text'], 
-input[type='password'],
-select {
-    width: 174px;
-    border: 1px solid;
-    margin: 0;
-}
-
-#fedit textarea {
-    width: 99%;
-    height: 100%;
-    border: 1px solid;
-    height: 280px;
-}

_attachments/css/typography.css

-
-pre,code    { margin: 1.5em 0; white-space: pre; }
-pre,code,tt { font: 1em 'andale mono', 'lucida console', monospace; line-height: 1.5; } 
-
-#mdpreview {
-    /*white-space: pre;*/
-}

_attachments/img/avatar.png

Added
New image

_attachments/img/bg.gif

Added
New image

_attachments/js/blog.js

-Date.prototype.parse_rfc3339 = function (string) {
-    var date=new Date(0);
-    var match = string.match(/(\d{4})-(\d\d)-(\d\d)\s*(?:[\sT]\s*(\d\d):(\d\d)(?::(\d\d))?(\.\d*)?\s*(Z|([-+])(\d\d):(\d\d))?)?/);
-    if (!match) return;
-    if (match[2]) match[2]--;
-    if (match[7]) match[7] = (match[7]+'000').substring(1,4);
-    var field = [null,'FullYear','Month','Date','Hours','Minutes','Seconds','Milliseconds'];
-    for (var i=1; i<=7; i++) if (match[i]) date['setUTC'+field[i]](match[i]);
-    if (match[9]) date.setTime(date.getTime()+(match[9]=='-'?1:-1)*(match[10]*3600000+match[11]*60000) );
-    return date.getTime();
-}
+
 
 function f(n) {    // Format integers to have at least two digits.
     return n < 10 ? '0' + n : n;
          f(this.getUTCSeconds())   + 'Z';
 };
 
+Date.prototype.setRFC3339 = function(dString){
+    var regexp = /(\d\d\d\d)(-)?(\d\d)(-)?(\d\d)(T)?(\d\d)(:)?(\d\d)(:)?(\d\d)(\.\d+)?(Z|([+-])(\d\d)(:)?(\d\d))/;
+
+    if (dString.toString().match(new RegExp(regexp))) {
+        var d = dString.match(new RegExp(regexp));
+        var offset = 0;
+
+        this.setUTCDate(1);
+        this.setUTCFullYear(parseInt(d[1],10));
+        this.setUTCMonth(parseInt(d[3],10) - 1);
+        this.setUTCDate(parseInt(d[5],10));
+        this.setUTCHours(parseInt(d[7],10));
+        this.setUTCMinutes(parseInt(d[9],10));
+        this.setUTCSeconds(parseInt(d[11],10));
+        if (d[12])
+            this.setUTCMilliseconds(parseFloat(d[12]) * 1000);
+        else
+            this.setUTCMilliseconds(0);
+        if (d[13] != 'Z') {
+            offset = (d[15] * 60) + parseInt(d[17],10);
+            offset *= ((d[14] == '-') ? -1 : 1);
+            this.setTime(this.getTime() - offset * 60 * 1000);
+        }
+    } else {
+        this.setTime(Date.parse(dString));
+    }
+    return this;
+};
+
+/* for now use only one date */
+Date.ext.locales['fr'] = {
+        a: ['dim', 'lun', 'mar', 'mer', 'jeu', 'ven', 'sam'],
+        A: ['dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi'],
+        b: ['jan', 'fév', 'mar', 'avr', 'mai', 'jun', 'jui', 'aoû', 'sep', 'oct', 'nov', 'déc'],
+        B: ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre'],
+        c: '%a %d %b %Y %T %Z',
+        p: ['', ''],
+        P: ['', ''],
+        x: '%d.%m.%Y',
+        X: '%T'
+};
+
+
+function localizeDates() {
+  
+  var lastdate = '';
+  var now = new Date();
+
+  $('time').each(function() {
+    var el = $(this);
+    if (el.attr('title') == "GMT") {
+      var date = new Date().setRFC3339(el.attr('datetime'));
+      if (date.getTime()) {
+
+        el.attr('title', date.toUTCString());
+        el.html(date.strftime("%A %d %B %Y, %H h %M"));
+    }
+    }
+  });
+}
 
 
 function Blog(app) {
 
+    function stripScripts(s) {
+        return s && s.replace(/<script(.|\n)*?>/g, '');
+    };
+  
+    function safe(s,cap) {
+        if (cap && cap < s.length) {
+            s = s.substring(0,cap);
+            s += '...';
+        }
+        return s && s.replace(/<(.|\n)*?>/g, '');
+    };
+
     this.formatBody = function(body) {
         var converter = new Showdown.converter();
         return converter.makeHtml(body);
     this.link_for = function(docid) {
         return '<a href="'+app.showPath('post',docid)+'">'+docid+'</a>';
     }
+
+    /* comments */
+    function author(author) {
+        if (!author) return '';
+        if (!author.url) return '<span class="author">by ' + safe(author.name) + '</span>';
+        return '<span class="author">by <a href="'+author.url+'">' 
+        + safe(author.name) + '</a></span>';      
+    };
+
+    this.commentListing = function(c) {
+        var date = new Date().setRFC3339(c.created_at);
+        var date_html = new Date().setRFC3339(c.created_at).toLocaleString();
+        if (date.getTime) {
+            date_html = date.strftime("%A %d %B %Y, %H h %M");
+        }    
+        var date_title =  date.toUTCString();
+
+        return '<li><div class="body">'
+            +'<p>'+ stripScripts(c.html)
+            + '</p>'
+            + '</div>'
+            +'<p class="comment-meta">'
+            +'<img class="gravatar" src="http://www.gravatar.com/avatar/'+c.commenter.gravatar+'.jpg?s=40&d=identicon"/>'
+            + author(c.commenter) + ', '
+            + '<time title="GMT" datetime="'+c.created_at
+            + '" title="'+date_title+'" class="caps">'+date_html+ '</p>'
+            + '</li>';
+  };
 }
 
-

_attachments/js/strftime.js

+/*
+ strftime for Javascript
+ Copyright (c) 2008, Philip S Tellis <philip@bluesmoon.info>
+ All rights reserved.
+ 
+ This code is distributed under the terms of the BSD licence
+ 
+ Redistribution and use of this software in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+
+   * Redistributions of source code must retain the above copyright notice, this list of conditions
+     and the following disclaimer.
+   * Redistributions in binary form must reproduce the above copyright notice, this list of
+     conditions and the following disclaimer in the documentation and/or other materials provided
+     with the distribution.
+   * The names of the contributors to this file may not be used to endorse or promote products
+     derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * \file strftime.js
+ * \author Philip S Tellis \<philip@bluesmoon.info\>
+ * \version 1.3
+ * \date 2008/06
+ * \brief Javascript implementation of strftime
+ * 
+ * Implements strftime for the Date object in javascript based on the PHP implementation described at
+ * http://www.php.net/strftime  This is in turn based on the Open Group specification defined
+ * at http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html This implementation does not
+ * include modified conversion specifiers (i.e., Ex and Ox)
+ *
+ * The following format specifiers are supported:
+ *
+ * \copydoc formats
+ *
+ * \%a, \%A, \%b and \%B should be localised for non-English locales.
+ *
+ * \par Usage:
+ * This library may be used as follows:
+ * \code
+ *     var d = new Date();
+ *
+ *     var ymd = d.strftime('%Y/%m/%d');
+ *     var iso = d.strftime('%Y-%m-%dT%H:%M:%S%z');
+ *
+ * \endcode
+ *
+ * \sa \link Date.prototype.strftime Date.strftime \endlink for a description of each of the supported format specifiers
+ * \sa Date.ext.locales for localisation information
+ * \sa http://www.php.net/strftime for the PHP implementation which is the basis for this
+ * \sa http://tech.bluesmoon.info/2008/04/strftime-in-javascript.html for feedback
+ */
+
+//! Date extension object - all supporting objects go in here.
+Date.ext = {};
+
+//! Utility methods
+Date.ext.util = {};
+
+/**
+\brief Left pad a number with something
+\details Takes a number and pads it to the left with the passed in pad character
+\param x	The number to pad
+\param pad	The string to pad with
+\param r	[optional] Upper limit for pad.  A value of 10 pads to 2 digits, a value of 100 pads to 3 digits.
+		Default is 10.
+
+\return The number left padded with the pad character.  This function returns a string and not a number.
+*/
+Date.ext.util.xPad=function(x, pad, r)
+{
+	if(typeof(r) == 'undefined')
+	{
+		r=10;
+	}
+	for( ; parseInt(x, 10)<r && r>1; r/=10)
+		x = pad.toString() + x;
+	return x.toString();
+};
+
+/**
+\brief Currently selected locale.
+\details
+The locale for a specific date object may be changed using \code Date.locale = "new-locale"; \endcode
+The default will be based on the lang attribute of the HTML tag of your document
+*/
+Date.prototype.locale = 'en-GB';
+//! \cond FALSE
+if(document.getElementsByTagName('html') && document.getElementsByTagName('html')[0].lang)
+{
+	Date.prototype.locale = document.getElementsByTagName('html')[0].lang;
+}
+//! \endcond
+
+/**
+\brief Localised strings for days of the week and months of the year.
+\details
+To create your own local strings, add a locale object to the locales object.
+The key of your object should be the same as your locale name.  For example:
+   en-US,
+   fr,
+   fr-CH,
+   de-DE
+Names are case sensitive and are described at http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
+Your locale object must contain the following keys:
+\param a	Short names of days of week starting with Sunday
+\param A	Long names days of week starting with Sunday
+\param b	Short names of months of the year starting with January
+\param B	Long names of months of the year starting with February
+\param c	The preferred date and time representation in your locale
+\param p	AM or PM in your locale
+\param P	am or pm in your locale
+\param x	The  preferred date representation for the current locale without the time.
+\param X	The preferred time representation for the current locale without the date.
+
+\sa Date.ext.locales.en for a sample implementation
+\sa \ref localisation for detailed documentation on localising strftime for your own locale
+*/
+Date.ext.locales = { };
+
+/**
+ * \brief Localised strings for English (British).
+ * \details
+ * This will be used for any of the English dialects unless overridden by a country specific one.
+ * This is the default locale if none specified
+ */
+Date.ext.locales.en = {
+	a: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
+	A: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
+	b: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
+	B: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
+	c: '%a %d %b %Y %T %Z',
+	p: ['AM', 'PM'],
+	P: ['am', 'pm'],
+	x: '%d/%m/%y',
+	X: '%T'
+};
+
+//! \cond FALSE
+// Localised strings for US English
+Date.ext.locales['en-US'] = Date.ext.locales.en;
+Date.ext.locales['en-US'].c = '%a %d %b %Y %r %Z';
+Date.ext.locales['en-US'].x = '%D';
+Date.ext.locales['en-US'].X = '%r';
+
+// Localised strings for British English
+Date.ext.locales['en-GB'] = Date.ext.locales.en;
+
+// Localised strings for Australian English
+Date.ext.locales['en-AU'] = Date.ext.locales['en-GB'];
+//! \endcond
+
+//! \brief List of supported format specifiers.
+/**
+ * \details
+ * \arg \%a - abbreviated weekday name according to the current locale
+ * \arg \%A - full weekday name according to the current locale
+ * \arg \%b - abbreviated month name according to the current locale
+ * \arg \%B - full month name according to the current locale
+ * \arg \%c - preferred date and time representation for the current locale
+ * \arg \%C - century number (the year divided by 100 and truncated to an integer, range 00 to 99)
+ * \arg \%d - day of the month as a decimal number (range 01 to 31)
+ * \arg \%D - same as %m/%d/%y
+ * \arg \%e - day of the month as a decimal number, a single digit is preceded by a space (range ' 1' to '31')
+ * \arg \%g - like %G, but without the century
+ * \arg \%G - The 4-digit year corresponding to the ISO week number
+ * \arg \%h - same as %b
+ * \arg \%H - hour as a decimal number using a 24-hour clock (range 00 to 23)
+ * \arg \%I - hour as a decimal number using a 12-hour clock (range 01 to 12)
+ * \arg \%j - day of the year as a decimal number (range 001 to 366)
+ * \arg \%m - month as a decimal number (range 01 to 12)
+ * \arg \%M - minute as a decimal number
+ * \arg \%n - newline character
+ * \arg \%p - either `AM' or `PM' according to the given time value, or the corresponding strings for the current locale
+ * \arg \%P - like %p, but lower case
+ * \arg \%r - time in a.m. and p.m. notation equal to %I:%M:%S %p
+ * \arg \%R - time in 24 hour notation equal to %H:%M
+ * \arg \%S - second as a decimal number
+ * \arg \%t - tab character
+ * \arg \%T - current time, equal to %H:%M:%S
+ * \arg \%u - weekday as a decimal number [1,7], with 1 representing Monday
+ * \arg \%U - week number of the current year as a decimal number, starting with
+ *            the first Sunday as the first day of the first week
+ * \arg \%V - The ISO 8601:1988 week number of the current year as a decimal number,
+ *            range 01 to 53, where week 1 is the first week that has at least 4 days
+ *            in the current year, and with Monday as the first day of the week.
+ * \arg \%w - day of the week as a decimal, Sunday being 0
+ * \arg \%W - week number of the current year as a decimal number, starting with the
+ *            first Monday as the first day of the first week
+ * \arg \%x - preferred date representation for the current locale without the time
+ * \arg \%X - preferred time representation for the current locale without the date
+ * \arg \%y - year as a decimal number without a century (range 00 to 99)
+ * \arg \%Y - year as a decimal number including the century
+ * \arg \%z - numerical time zone representation
+ * \arg \%Z - time zone name or abbreviation
+ * \arg \%% - a literal `\%' character
+ */
+Date.ext.formats = {
+	a: function(d) { return Date.ext.locales[d.locale].a[d.getDay()]; },
+	A: function(d) { return Date.ext.locales[d.locale].A[d.getDay()]; },
+	b: function(d) { return Date.ext.locales[d.locale].b[d.getMonth()]; },
+	B: function(d) { return Date.ext.locales[d.locale].B[d.getMonth()]; },
+	c: 'toLocaleString',
+	C: function(d) { return Date.ext.util.xPad(parseInt(d.getFullYear()/100, 10), 0); },
+	d: ['getDate', '0'],
+	e: ['getDate', ' '],
+	g: function(d) { return Date.ext.util.xPad(parseInt(Date.ext.util.G(d)/100, 10), 0); },
+	G: function(d) {
+			var y = d.getFullYear();
+			var V = parseInt(Date.ext.formats.V(d), 10);
+			var W = parseInt(Date.ext.formats.W(d), 10);
+
+			if(W > V) {
+				y++;
+			} else if(W===0 && V>=52) {
+				y--;
+			}
+
+			return y;
+		},
+	H: ['getHours', '0'],
+	I: function(d) { var I=d.getHours()%12; return Date.ext.util.xPad(I===0?12:I, 0); },
+	j: function(d) {
+			var ms = d - new Date('' + d.getFullYear() + '/1/1 GMT');
+			ms += d.getTimezoneOffset()*60000;
+			var doy = parseInt(ms/60000/60/24, 10)+1;
+			return Date.ext.util.xPad(doy, 0, 100);
+		},
+	m: function(d) { return Date.ext.util.xPad(d.getMonth()+1, 0); },
+	M: ['getMinutes', '0'],
+	p: function(d) { return Date.ext.locales[d.locale].p[d.getHours() >= 12 ? 1 : 0 ]; },
+	P: function(d) { return Date.ext.locales[d.locale].P[d.getHours() >= 12 ? 1 : 0 ]; },
+	S: ['getSeconds', '0'],
+	u: function(d) { var dow = d.getDay(); return dow===0?7:dow; },
+	U: function(d) {
+			var doy = parseInt(Date.ext.formats.j(d), 10);
+			var rdow = 6-d.getDay();
+			var woy = parseInt((doy+rdow)/7, 10);
+			return Date.ext.util.xPad(woy, 0);
+		},
+	V: function(d) {
+			var woy = parseInt(Date.ext.formats.W(d), 10);
+			var dow1_1 = (new Date('' + d.getFullYear() + '/1/1')).getDay();
+			// First week is 01 and not 00 as in the case of %U and %W,
+			// so we add 1 to the final result except if day 1 of the year
+			// is a Monday (then %W returns 01).
+			// We also need to subtract 1 if the day 1 of the year is 
+			// Friday-Sunday, so the resulting equation becomes:
+			var idow = woy + (dow1_1 > 4 || dow1_1 <= 1 ? 0 : 1);
+			if(idow == 53 && (new Date('' + d.getFullYear() + '/12/31')).getDay() < 4)
+			{
+				idow = 1;
+			}
+			else if(idow === 0)
+			{
+				idow = Date.ext.formats.V(new Date('' + (d.getFullYear()-1) + '/12/31'));
+			}
+
+			return Date.ext.util.xPad(idow, 0);
+		},
+	w: 'getDay',
+	W: function(d) {
+			var doy = parseInt(Date.ext.formats.j(d), 10);
+			var rdow = 7-Date.ext.formats.u(d);
+			var woy = parseInt((doy+rdow)/7, 10);
+			return Date.ext.util.xPad(woy, 0, 10);
+		},
+	y: function(d) { return Date.ext.util.xPad(d.getFullYear()%100, 0); },
+	Y: 'getFullYear',
+	z: function(d) {
+			var o = d.getTimezoneOffset();
+			var H = Date.ext.util.xPad(parseInt(Math.abs(o/60), 10), 0);
+			var M = Date.ext.util.xPad(o%60, 0);
+			return (o>0?'-':'+') + H + M;
+		},
+	Z: function(d) { return d.toString().replace(/^.*\(([^)]+)\)$/, '$1'); },
+	'%': function(d) { return '%'; }
+};
+
+/**
+\brief List of aggregate format specifiers.
+\details
+Aggregate format specifiers map to a combination of basic format specifiers.
+These are implemented in terms of Date.ext.formats.
+
+A format specifier that maps to 'locale' is read from Date.ext.locales[current-locale].
+
+\sa Date.ext.formats
+*/
+Date.ext.aggregates = {
+	c: 'locale',
+	D: '%m/%d/%y',
+	h: '%b',
+	n: '\n',
+	r: '%I:%M:%S %p',
+	R: '%H:%M',
+	t: '\t',
+	T: '%H:%M:%S',
+	x: 'locale',
+	X: 'locale'
+};
+
+//! \cond FALSE
+// Cache timezone values because they will never change for a given JS instance
+Date.ext.aggregates.z = Date.ext.formats.z(new Date());
+Date.ext.aggregates.Z = Date.ext.formats.Z(new Date());
+//! \endcond
+
+//! List of unsupported format specifiers.
+/**
+ * \details
+ * All format specifiers supported by the PHP implementation are supported by
+ * this javascript implementation.
+ */
+Date.ext.unsupported = { };
+
+
+/**
+ * \brief Formats the date according to the specified format.
+ * \param fmt	The format to format the date in.  This may be a combination of the following:
+ * \copydoc formats
+ *
+ * \return	A string representation of the date formatted based on the passed in parameter
+ * \sa http://www.php.net/strftime for documentation on format specifiers
+*/
+Date.prototype.strftime=function(fmt)
+{
+	// Fix locale if declared locale hasn't been defined
+	// After the first call this condition should never be entered unless someone changes the locale
+	if(!(this.locale in Date.ext.locales))
+	{
+		if(this.locale.replace(/-[a-zA-Z]+$/, '') in Date.ext.locales)
+		{
+			this.locale = this.locale.replace(/-[a-zA-Z]+$/, '');
+		}
+		else
+		{
+			this.locale = 'en-GB';
+		}
+	}
+
+	var d = this;
+	// First replace aggregates
+	while(fmt.match(/%[cDhnrRtTxXzZ]/))
+	{
+		fmt = fmt.replace(/%([cDhnrRtTxXzZ])/g, function(m0, m1)
+				{
+					var f = Date.ext.aggregates[m1];
+					return (f == 'locale' ? Date.ext.locales[d.locale][m1] : f);
+				});
+	}
+
+
+	// Now replace formats - we need a closure so that the date object gets passed through
+	var str = fmt.replace(/%([aAbBCdegGHIjmMpPSuUVwWyY%])/g, function(m0, m1) 
+			{
+				var f = Date.ext.formats[m1];
+				if(typeof(f) == 'string') {
+					return d[f]();
+				} else if(typeof(f) == 'function') {
+					return f.call(d, d);
+				} else if(typeof(f) == 'object' && typeof(f[0]) == 'string') {
+					return Date.ext.util.xPad(d[f[0]](), f[1]);
+				} else {
+					return m1;
+				}
+			});
+	d=null;
+	return str;
+};
+
+/**
+ * \mainpage strftime for Javascript
+ *
+ * \section toc Table of Contents
+ * - \ref intro_sec
+ * - <a class="el" href="strftime.js">Download full source</a> / <a class="el" href="strftime-min.js">minified</a>
+ * - \subpage usage
+ * - \subpage format_specifiers
+ * - \subpage localisation
+ * - \link strftime.js API Documentation \endlink
+ * - \subpage demo
+ * - \subpage changelog
+ * - \subpage faq
+ * - <a class="el" href="http://tech.bluesmoon.info/2008/04/strftime-in-javascript.html">Feedback</a>
+ * - \subpage copyright_licence
+ *
+ * \section intro_sec Introduction
+ *
+ * C and PHP developers have had access to a built in strftime function for a long time.
+ * This function is an easy way to format dates and times for various display needs.
+ *
+ * This library brings the flexibility of strftime to the javascript Date object
+ *
+ * Use this library if you frequently need to format dates in javascript in a variety of ways.  For example,
+ * if you have PHP code that writes out formatted dates, and want to mimic the functionality using
+ * progressively enhanced javascript, then this library can do exactly what you want.
+ *
+ *
+ *
+ *
+ * \page usage Example usage
+ *
+ * \section usage_sec Usage
+ * This library may be used as follows:
+ * \code
+ *     var d = new Date();
+ *
+ *     var ymd = d.strftime('%Y/%m/%d');
+ *     var iso = d.strftime('%Y-%m-%dT%H:%M:%S%z');
+ *
+ * \endcode
+ *
+ * \subsection examples Examples
+ * 
+ * To get the current time in hours and minutes:
+ * \code
+ * 	var d = new Date();
+ * 	d.strftime("%H:%M");
+ * \endcode
+ *
+ * To get the current time with seconds in AM/PM notation:
+ * \code
+ * 	var d = new Date();
+ * 	d.strftime("%r");
+ * \endcode
+ *
+ * To get the year and day of the year for August 23, 2009:
+ * \code
+ * 	var d = new Date('2009/8/23');
+ * 	d.strftime("%Y-%j");
+ * \endcode
+ *
+ * \section demo_sec Demo
+ *
+ * Try your own examples on the \subpage demo page.  You can use any of the supported
+ * \subpage format_specifiers.
+ *
+ *
+ *
+ *
+ * \page localisation Localisation
+ * You can localise strftime by implementing the short and long forms for days of the
+ * week and months of the year, and the localised aggregates for the preferred date
+ * and time representation for your locale.  You need to add your locale to the
+ * Date.ext.locales object.
+ *
+ * \section localising_fr Localising for french
+ *
+ * For example, this is how we'd add French language strings to the locales object:
+ * \dontinclude index.html
+ * \skip Generic french
+ * \until };
+ * The % format specifiers are all defined in \ref formats.  You can use any of those.
+ *
+ * This locale definition may be included in your own source file, or in the HTML file
+ * including \c strftime.js, however it must be defined \em after including \c strftime.js
+ *
+ * The above definition includes generic french strings and formats that are used in France.
+ * Other french speaking countries may have other representations for dates and times, so we
+ * need to override this for them.  For example, Canadian french uses a Y-m-d date format,
+ * while French french uses d.m.Y.  We fix this by defining Canadian french to be the same
+ * as generic french, and then override the format specifiers for \c x for the \c fr-CA locale:
+ * \until End french
+ *
+ * You can now use any of the French locales at any time by setting \link Date.prototype.locale Date.locale \endlink
+ * to \c "fr", \c "fr-FR", \c "fr-CA", or any other french dialect:
+ * \code
+ *     var d = new Date("2008/04/22");
+ *     d.locale = "fr";
+ *
+ *     d.strftime("%A, %d %B == %x");
+ * \endcode
+ * will return:
+ * \code
+ *     mardi, 22 avril == 22.04.2008
+ * \endcode
+ * While changing the locale to "fr-CA":
+ * \code
+ *     d.locale = "fr-CA";
+ *
+ *     d.strftime("%A, %d %B == %x");
+ * \endcode
+ * will return:
+ * \code
+ *     mardi, 22 avril == 2008-04-22
+ * \endcode
+ *
+ * You can use any of the format specifiers defined at \ref formats
+ *
+ * The locale for all dates defaults to the value of the \c lang attribute of your HTML document if
+ * it is set, or to \c "en" otherwise.
+ * \note
+ * Your locale definitions \b MUST be added to the locale object before calling
+ * \link Date.prototype.strftime Date.strftime \endlink.
+ *
+ * \sa \ref formats for a list of format specifiers that can be used in your definitions
+ * for c, x and X.
+ *
+ * \section locale_names Locale names
+ *
+ * Locale names are defined in RFC 1766. Typically, a locale would be a two letter ISO639
+ * defined language code and an optional ISO3166 defined country code separated by a -
+ * 
+ * eg: fr-FR, de-DE, hi-IN
+ *
+ * \sa http://www.ietf.org/rfc/rfc1766.txt
+ * \sa http://www.loc.gov/standards/iso639-2/php/code_list.php
+ * \sa http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm
+ * 
+ * \section locale_fallback Locale fallbacks
+ *
+ * If a locale object corresponding to the fully specified locale isn't found, an attempt will be made
+ * to fall back to the two letter language code.  If a locale object corresponding to that isn't found
+ * either, then the locale will fall back to \c "en".  No warning will be issued.
+ *
+ * For example, if we define a locale for de:
+ * \until };
+ * Then set the locale to \c "de-DE":
+ * \code
+ *     d.locale = "de-DE";
+ *
+ *     d.strftime("%a, %d %b");
+ * \endcode
+ * In this case, the \c "de" locale will be used since \c "de-DE" has not been defined:
+ * \code
+ *     Di, 22 Apr
+ * \endcode
+ *
+ * Swiss german will return the same since it will also fall back to \c "de":
+ * \code
+ *     d.locale = "de-CH";
+ *
+ *     d.strftime("%a, %d %b");
+ * \endcode
+ * \code
+ *     Di, 22 Apr
+ * \endcode
+ *
+ * We need to override the \c a specifier for Swiss german, since it's different from German german:
+ * \until End german
+ * We now get the correct results:
+ * \code
+ *     d.locale = "de-CH";
+ *
+ *     d.strftime("%a, %d %b");
+ * \endcode
+ * \code
+ *     Die, 22 Apr
+ * \endcode
+ *
+ * \section builtin_locales Built in locales
+ *
+ * This library comes with pre-defined locales for en, en-GB, en-US and en-AU.
+ *
+ * 
+ *
+ *
+ * \page format_specifiers Format specifiers
+ * 
+ * \section specifiers Format specifiers
+ * strftime has several format specifiers defined by the Open group at 
+ * http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html
+ *
+ * PHP added a few of its own, defined at http://www.php.net/strftime
+ *
+ * This javascript implementation supports all the PHP specifiers
+ *
+ * \subsection supp Supported format specifiers:
+ * \copydoc formats
+ * 
+ * \subsection unsupportedformats Unsupported format specifiers:
+ * \copydoc unsupported
+ *
+ *
+ *
+ *
+ * \page demo strftime demo
+ * <div style="float:right;width:45%;">
+ * \copydoc formats
+ * </div>
+ * \htmlinclude index.html
+ *
+ *
+ *
+ *
+ * \page faq FAQ
+ * 
+ * \section how_tos Usage
+ *
+ * \subsection howtouse Is there a manual on how to use this library?
+ *
+ * Yes, see \ref usage
+ *
+ * \subsection wheretoget Where can I get a minified version of this library?
+ *
+ * The minified version is available <a href="strftime-min.js" title="Minified strftime.js">here</a>.
+ *
+ * \subsection which_specifiers Which format specifiers are supported?
+ *
+ * See \ref format_specifiers
+ *
+ * \section whys Why?
+ *
+ * \subsection why_lib Why this library?
+ *
+ * I've used the strftime function in C, PHP and the Unix shell, and found it very useful
+ * to do date formatting.  When I needed to do date formatting in javascript, I decided
+ * that it made the most sense to just reuse what I'm already familiar with.
+ *
+ * \subsection why_another Why another strftime implementation for Javascript?
+ *
+ * Yes, there are other strftime implementations for Javascript, but I saw problems with
+ * all of them that meant I couldn't use them directly.  Some implementations had bad
+ * designs.  For example, iterating through all possible specifiers and scanning the string
+ * for them.  Others were tied to specific libraries like prototype.
+ *
+ * Trying to extend any of the existing implementations would have required only slightly
+ * less effort than writing this from scratch.  In the end it took me just about 3 hours
+ * to write the code and about 6 hours battling with doxygen to write these docs.
+ *
+ * I also had an idea of how I wanted to implement this, so decided to try it.
+ *
+ * \subsection why_extend_date Why extend the Date class rather than subclass it?
+ *
+ * I tried subclassing Date and failed.  I didn't want to waste time on figuring
+ * out if there was a problem in my code or if it just wasn't possible.  Adding to the
+ * Date.prototype worked well, so I stuck with it.
+ *
+ * I did have some worries because of the way for..in loops got messed up after json.js added
+ * to the Object.prototype, but that isn't an issue here since {} is not a subclass of Date.
+ *
+ * My last doubt was about the Date.ext namespace that I created.  I still don't like this,
+ * but I felt that \c ext at least makes clear that this is external or an extension.
+ *
+ * It's quite possible that some future version of javascript will add an \c ext or a \c locale
+ * or a \c strftime property/method to the Date class, but this library should probably
+ * check for capabilities before doing what it does.
+ *
+ * \section curiosity Curiosity
+ *
+ * \subsection how_big How big is the code?
+ *
+ * \arg 26K bytes with documentation
+ * \arg 4242 bytes minified using <a href="http://developer.yahoo.com/yui/compressor/">YUI Compressor</a>
+ * \arg 1477 bytes minified and gzipped
+ *
+ * \subsection how_long How long did it take to write this?
+ *
+ * 15 minutes for the idea while I was composing this blog post:
+ * http://tech.bluesmoon.info/2008/04/javascript-date-functions.html
+ *
+ * 3 hours in one evening to write v1.0 of the code and 6 hours the same
+ * night to write the docs and this manual.  As you can tell, I'm fairly
+ * sleepy.
+ *
+ * Versions 1.1 and 1.2 were done in a couple of hours each, and version 1.3
+ * in under one hour.
+ *
+ * \section contributing Contributing
+ *
+ * \subsection how_to_rfe How can I request features or make suggestions?
+ *
+ * You can leave a comment on my blog post about this library here:
+ * http://tech.bluesmoon.info/2008/04/strftime-in-javascript.html
+ *
+ * \subsection how_to_contribute Can I/How can I contribute code to this library?
+ *
+ * Yes, that would be very nice, thank you.  You can do various things.  You can make changes
+ * to the library, and make a diff against the current file and mail me that diff at
+ * philip@bluesmoon.info, or you could just host the new file on your own servers and add
+ * your name to the copyright list at the top stating which parts you've added.
+ *
+ * If you do mail me a diff, let me know how you'd like to be listed in the copyright section.
+ *
+ * \subsection copyright_signover Who owns the copyright on contributed code?
+ *
+ * The contributor retains copyright on contributed code.
+ *
+ * In some cases I may use contributed code as a template and write the code myself.  In this
+ * case I'll give the contributor credit for the idea, but will not add their name to the
+ * copyright holders list.
+ *
+ *
+ *
+ *
+ * \page copyright_licence Copyright & Licence
+ *
+ * \section copyright Copyright
+ * \dontinclude strftime.js
+ * \skip Copyright
+ * \until rights
+ *
+ * \section licence Licence
+ * \skip This code
+ * \until SUCH DAMAGE.
+ *
+ *
+ *
+ * \page changelog ChangeLog
+ *
+ * \par 1.3 - 2008/06/17:
+ * - Fixed padding issue with negative timezone offsets in %r
+ *   reported and fixed by Mikko <mikko.heimola@iki.fi>
+ * - Added support for %P
+ * - Internationalised %r, %p and %P
+ *
+ * \par 1.2 - 2008/04/27:
+ * - Fixed support for c (previously it just returned toLocaleString())
+ * - Add support for c, x and X
+ * - Add locales for en-GB, en-US and en-AU
+ * - Make en-GB the default locale (previous was en)
+ * - Added more localisation docs
+ *
+ * \par 1.1 - 2008/04/27:
+ * - Fix bug in xPad which wasn't padding more than a single digit
+ * - Fix bug in j which had an off by one error for days after March 10th because of daylight savings
+ * - Add support for g, G, U, V and W
+ *
+ * \par 1.0 - 2008/04/22:
+ * - Initial release with support for a, A, b, B, c, C, d, D, e, H, I, j, m, M, p, r, R, S, t, T, u, w, y, Y, z, Z, and %
+ */
+{
+   "title": "Carnet d'un artisan web."
+}
+<!DOCTYPE html>
+<html lang="fr">
+<head>
+    <meta charset="utf-8"/>
+    <title>benoît chesneau web, artisan web.</title>
+
+    <!--[if IE]>
+
+    <script>
+        // allow IE to recognize HTMl5 elements
+        document.createElement('section');
+        document.createElement('article');
+        document.createElement('aside');
+        document.createElement('footer');
+        document.createElement('header');
+        document.createElement('nav');
+        document.createElement('time');
+
+    </script>
+    <![endif]-->
+    <link rel="openid.server" href="http://www.myopenid.com/server">
+    <link rel="openid.delegate" href="http://bchesneau.myopenid.com/">
+    <link rel="home index" href="http://benoitc.org/" type="text/html">
+    <link rel="me author" href="http://benoitc.org/apropos.html" type="text/html">
+
+    <link rel="stylesheet" href="<%= assets %>/css/screen.css" type="text/css" media="screen, projection" />
+
+    <script src="/_utils/script/json2.js"></script>
+    <script src="/_utils/script/jquery.js"></script>
+    <script src="/_utils/script/jquery.couch.js"></script>
+
+
+</head>
+
+
+<body>
+    <header>
+        <h1>
+            <a rel="me author" href="<%= assets %>/about.html">Benoît Chesneau</a>
+        </h1>
+    </header>
+    <section id="items">
+
+<% if (day_change) { %>
+<h2 class="date"><%= last_day %></h2>
+<% } %>
+<article>
+    <header>
+    <hp><a href="<%= item.link %>" title="<%= item.title %>"><img
+            src="<%= item.service.iconUrl %>" alt=""></a> - <a
+            href="<%= item.service.profileUrl %>"><%= item.service.id
+            %></a></p>
+    </header>
+    
+    <p><%= item.title %></p>
+    
+</article>
+
+    </section>
+    <footer>
+        <p> Benoît Chesneau</p>    
+    </footer>
+</body>
+</html>

lib/helpers/couchapp.js

          f(this.getUTCHours())     + ':' +
          f(this.getUTCMinutes())   + ':' +
          f(this.getUTCSeconds())   + 'Z';
-};
+};
+
+Date.prototype.setRFC3339 = function(dString){
+    var regexp = /(\d\d\d\d)(-)?(\d\d)(-)?(\d\d)(T)?(\d\d)(:)?(\d\d)(:)?(\d\d)(\.\d+)?(Z|([+-])(\d\d)(:)?(\d\d))/;
+
+    if (dString.toString().match(new RegExp(regexp))) {
+        var d = dString.match(new RegExp(regexp));
+        var offset = 0;
+
+        this.setUTCDate(1);
+        this.setUTCFullYear(parseInt(d[1],10));
+        this.setUTCMonth(parseInt(d[3],10) - 1);
+        this.setUTCDate(parseInt(d[5],10));
+        this.setUTCHours(parseInt(d[7],10));
+        this.setUTCMinutes(parseInt(d[9],10));
+        this.setUTCSeconds(parseInt(d[11],10));
+        if (d[12])
+            this.setUTCMilliseconds(parseFloat(d[12]) * 1000);
+        else
+            this.setUTCMilliseconds(0);
+        if (d[13] != 'Z') {
+            offset = (d[15] * 60) + parseInt(d[17],10);
+            offset *= ((d[14] == '-') ? -1 : 1);
+            this.setTime(this.getTime() - offset * 60 * 1000);
+        }
+    } else {
+        this.setTime(Date.parse(dString));
+    }
+    return this;
+};
+

lib/templates/.post.html.swp

Binary file added.

lib/templates/edit.html

     <link rel="home index" href="http://benoitc.org/" type="text/html">
     <link rel="me author" href="http://benoitc.org/benoitc.html" type="text/html">
 
-    <link rel="stylesheet" href="<%= assets %>/css/layout.css" type="text/css" media="screen, projection" />
-    <link rel="stylesheet" href="<%= assets %>/css/default.css" type="text/css" media="screen, projection" />
+    <link rel="stylesheet" href="<%= assets %>/css/benoitc.css" type="text/css" media="screen, projection" />
     
-    <link rel="stylesheet" href="<%= assets %>/css/typography.css" type="text/css" media="screen, projection" />
 
 
 </head>
         </div>
 
         <footer id="main-footer">
-            <p class="copyright">Copyright &copy; 2009 by <a rel="me author"
-                href="benoitc.html">Benoît Chesneau</a> </p>
-        </footer>
+        <p>2009 (c) <a href="<%= assets %>/apropos.html">Benoît Chesneau</a> - <a rel="license" href="http://creativecommons.org/licenses/by/2.0/fr/">Certains droits reservés</a>.</p>
+        </footer> 
 
     
 </body>
     <script src="<%= assets %>/js/textarea.jquery.js"></script>
     <script src="<%= assets %>/js/jquery.couchapp.js"></script>
     <script src="<%= assets %>/js/editor.js"></script>
+    <script src="<%= assets %>/js/strftime.js"></script>
     <script src="<%= assets %>/js/blog.js"></script>
     <script src="<%= assets %>/js/urlify.js"></script>
 

lib/templates/index/head.html

+<!DOCTYPE html>
+<html lang="fr">
+<head>
+    <meta charset="utf-8"/>
+    <title>benoît chesneau web, artisan web.</title>
+
+    <!--[if IE]>
+
+    <script>
+        // allow IE to recognize HTMl5 elements
+        document.createElement('section');
+        document.createElement('article');
+        document.createElement('aside');
+        document.createElement('footer');
+        document.createElement('header');
+        document.createElement('nav');
+        document.createElement('time');
+
+    </script>
+    <![endif]-->
+    <link rel="openid.server" href="http://www.myopenid.com/server">
+    <link rel="openid.delegate" href="http://bchesneau.myopenid.com/">
+    <link rel="home index" href="http://benoitc.org/" type="text/html">
+    <link rel="me author" href="http://benoitc.org/benoitc.html" type="text/html">
+    <link type='application/atom+xml' href='<%= feedPath %>' rel='alternate' title='Writings'>
+
+    <link rel="stylesheet" href="<%= assets %>/css/benoitc.css" type="text/css" media="screen, projection" />
+</head>
+
+
+<body class="index">
+    <div id="container">
+        <header class="page">
+            <nav id="mainav">
+                <ul>
+                    <li><a href="#">archives</a></li>
+                    <li><a href="#">fil</a></li>
+                    <li><a href="<%= feedPath %>" type='application/atom+xml'>suivre</a></li>
+                </ul>
+            </nav>
+            <h1>
+                <a rel="me author" href="<%= assets %>/benoitc.html">Benoît Chesneau</a>
+            </h1>
+            <h2>artisan web</h2>
+
+            
+        </header>

lib/templates/index/row.html

+<article class="entry article">
+    <header class="meta">
+        <p><time title="GMT" datetime="<%= post.created_at %>"
+        class="caps"><%= fcreated_at %></time></p>
+    </header>
+    <h3>
+        <a href="<%= link %>"><%= post.title %></a>
+    </h3>
+    <p><%= post.summary %></p>
+</article>

lib/templates/index/tail.html

+        <footer id="main-footer">
+        <p>2009 (c) <a href="<%= assets %>/apropos.html">Benoît Chesneau</a> - <a rel="license" href="http://creativecommons.org/licenses/by/2.0/fr/">Certains droits reservés</a>.</p>
+        </footer>
+    </div>
+</body>
+    <script src="/_utils/script/json2.js"></script>
+    <script src="/_utils/script/jquery.js"></script>
+    <script src="/_utils/script/jquery.couch.js"></script>
+    <script src="<%= assets %>/js/jquery.couchapp.js"></script>
+    <script src="<%= assets %>/js/strftime.js"></script>
+    <script src="<%= assets %>/js/blog.js"></script>
+    <script>
+        $(document).ready(function() {
+            localizeDates();
+        });
+
+    </script>
+</html>

lib/templates/post.html

     <link rel="home index" href="http://benoitc.org/" type="text/html">
     <link rel="me author" href="http://benoitc.org/benoitc.html" type="text/html">
 
-    <link rel="stylesheet" href="<%= assets %>/css/layout.css" type="text/css" media="screen, projection" />
-    <link rel="stylesheet" href="<%= assets %>/css/default.css" type="text/css" media="screen, projection" />
-    
-    <link rel="stylesheet" href="<%= assets %>/css/typography.css" type="text/css" media="screen, projection" />
+    <link rel="stylesheet" href="<%= assets %>/css/benoitc.css" type="text/css" media="screen, projection" />
 
 
 </head>
 
 
 <body>
-    <header>
-        <h1>
-            <a rel="me author" href="<%= assets %>/benoitc.html">Benoît Chesneau</a>
-        </h1>
-    </header>
-    <article>
+    <div id="container">
         <header>
-            <h1><%= doc.title %></h1>
-        </header>    
-        <%= doc.html %>
-        <footer></footer>
-    </article>
-    
-    <footer id="main-footer">
-            <p class="copyright">Copyright &copy; 2009 by <a rel="me author"
-                href="benoitc.html">Benoît Chesneau</a> </p>
-    </footer>
+            
+        </header>
+        <section id="maincontent"> 
+        <article class="article content">
+            <header>
+                <h1><%= doc.title %></h1>
+                <time title="GMT" datetime="<%= doc.created_at %>" class="caps"><%= fcreated_at %></time>     
+                <p><a rel="me author" href="http://benoitc.org/benoitc.html">Benoît Chesneau</a></p>       
+            </header>    
+            <%= doc.html %>
+            <footer>
+            <p>Cette entrée a été marquée <%= labels %> — Suivez un un des libellés pour obtenir d'autres articles ou essais en relation.</p>
+            </footer>
+        </article>
+        </section>
+        <section id="comments">
+            <h2>Discutez</h2>
+            <ol></ol>
+            <h2>Laissez un commentaire</h2>
+            <form id="new-comment" action="post.html" class="leave" method="post">
+                <div>
+
+                    <label for="commenter-name">Nom</label>
+                    <br>
+                    <input name="commenter-name" type="text">
+                    <br>
+                    <label for="commenter-url">URL (optionnel)</label>
+                    <br>
+                    <input name="commenter-url" type="text">
+                    <br>
+                    <label for="commenter-email">Courriel</label>
+                    <small>(pour <a href="http://gravatar.com">Gravatar</a>)</small>
+                    <br />
+                    <input type="text" name="commenter-email" value="">
+                    <br />
+                    <label for="comment">Commentaire</label>
+                    <small>(syntaxe: <a href="http://daringfireball.net/projects/markdown/syntax" title="Markdown Syntax Reference">markdown</a>)</small>
+                    <br>
+                    <textarea id="comment" name="comment" rows="8" style="width: 100%;"></textarea>
+                    <input type="button" id="preview" value="Prévisualiser">&nbsp;<input value="Laissez un commentaire" type="submit">
+                </div>
+                <div id="comment-preview"></div>
+            </form>
+            
+        </section>
+
+        <footer id="main-footer">
+            <p>2009 (c) <a href="<%= assets %>/apropos.html">Benoît Chesneau</a> - <a rel="license" href="http://creativecommons.org/licenses/by/2.0/fr/">Certains droits reservés</a>.</p>
+        </footer> 
+    </div>
 </body>
+    <script src="/_utils/script/json2.js"></script>
+    <script src="/_utils/script/jquery.js"></script>
+    <script src="/_utils/script/jquery.couch.js"></script>
+    <script src="<%= assets %>/js/jquery.couchapp.js"></script>
+    <script src="<%= assets %>/js/strftime.js"></script>
+    <script src="<%= assets %>/js/showdown.js"></script>
+    <script src="<%= assets %>/js/blog.js"></script>
+    <script>
+        $(document).ready(function() {
+            localizeDates();
+            $.CouchApp(function(app) {
+                var docid = document.location.pathname.split('/').pop();
+                var B = new Blog(app);
+                function displayComments() {
+                    app.design.view("comments", {
+                    startkey: [docid],
+                    endkey: [docid, {}],
+                    reduce : false,
+                    success: function(json) {
+                        var ol = $("#comments ol");
+                        for (var i=0; i < json.rows.length; i++) {
+                            var c = json.rows[i].value;
+                        ol.append(B.commentListing(c));
+                        }
+                        $('#comments').fadeIn(2000);      
+                    }
+                    });
+                };
+              
+                  displayComments();
+                  localizeDates();
+
+                  var commentForm = app.docForm("form#new-comment", {
+                    fields : [
+                      "commenter-name", 
+                      "commenter-email", 
+                      "commenter-url", 
+                      "comment"
+                    ],
+                    template : {
+                      doc_type : "comment",
+                      post_id : docid,
+                      format : "markdown"
+                    },
+                    beforeSave : function(doc) {
+                      doc.html = B.formatBody(doc.comment);
+                      doc.created_at = new Date().rfc3339();
+                    },
+                    success : function(resp, doc) {
+                        $("#new-comment").html("<h3>votre commentaire vient d'être ajouté.</h3>");
+                      $("#comments ol").append(B.commentListing(doc));
+                      $("#comments ol li:last").hide().fadeIn(2000);
+                    }
+                  });
+                  
+                  $("#preview").click(function() {
+                    var doc = commentForm.localDoc();
+                    var html = B.formatBody(doc.comment);
+                    $('#comment-preview').html(html);
+                  });
+                });
+        });
+
+    </script>
 </html>
+function(head, row, req, row_info) {
+  // !json lib.templates.index
+  // !json blog
+  // !json locales
+  // !code lib.helpers.couchapp
+  // !code lib.helpers.ejs.ejs
+  // !code lib.helpers.ejs.view
+  // !code lib.helpers.template2
+    
+  var indexPath = listPath('index','recent-posts',{descending:true, limit:8});
+  var feedPath = listPath('index','recent-posts',{descending:true, limit:8, format:"atom"});
+  var archivesPath = listPath('index','archives',{descending:true, limit:25});
+  var streamPath = listPath('firehose','stream',{descending:true, limit:25});
+  return respondWith(req, {
+    html: function() {
+        if (head) {
+            return template(lib.templates.index.head, {
+                assets: assetPath()
+            });
+        } else if (row) {
+            if (req.path[4] == 'recent-posts' && row_info.row_number == 8) {
+               return {stop:true};
+            }
+
+            var pd, ld = [];
+            var day_change = false;
+            var month_change = false;
+
+            if (!row_info.first_key) {
+                day_change = true;
+                month_change = true;
+                ld = row.key.split('T');
+            } else {
+                if (!row_info.prev_key) {
+                    pd = row_info.first_key.split('T');
+                    ld = row.key.split('T');
+                    month_change = true;
+                } else {
+                    pd = row_info.prev_key.split("T");
+                    ld = row.key.split("T");
+                }
+
+                if (ld[0] != pd[0]) {
+                    day_change = true;
+                    if (ld[0].slice(5, 7) != pd[0].slice(5, 7)) {
+                        month_change = true;
+                    }
+                } 
+            }
+
+            var month = ld[0].slice(5, 7);
+            var lc_month = locales.fr.months[month];
+            var fcreated_at = new Date().setRFC3339(row.value.created_at).toLocaleString();
+            return template(lib.templates.index.row, {
+                    post: row.value,
+                    fcreated_at: fcreated_at,
+                    link: showPath('post', row.id),
+                    last_day: ld[0],
+                    month: lc_month,
+                    day: ld[0].slice(8, 10),
+                    day_change: day_change,
+                    month_change: month_change,
+                    row_info: row_info,
+                    assets: assetPath(),
+                    feedPath: feedPath,
+                    streamPath: streamPath
+            });
+        } else {
+            return template(lib.templates.index.tail, {
+                archivesPath: archivesPath,
+                assets: assetPath()
+            });
+        }
+    },
+    atom: function() {
+      // with first row in head you can do updated.
+      if (head) {
+        var f = <feed xmlns="http://www.w3.org/2005/Atom"/>;
+        f.title = blog.title;
+        f.id = makeAbsolute(req, indexPath);
+        f.link.@href = makeAbsolute(req, feedPath);
+        f.link.@rel = "self";
+        f.generator = 'benoitc.org';
+        f.updated = new Date().rfc3339();
+        return {body:f.toXMLString().replace(/\<\/feed\>/,'')};
+      } else if (row) {
+        var entry = <entry/>;
+        entry.id = makeAbsolute(req, '/'+encodeURIComponent(req.info.db_name)+'/'+encodeURIComponent(row.id));
+        entry.title = row.value.title;
+        entry.content = row.value.summary;
+        entry.content.@type = 'html';
+        entry.updated = row.value.created_at;
+        entry.author = <author><name>{row.value.author}</name></author>;
+        entry.link.@href = makeAbsolute(req, showPath('post', row.id));
+        entry.link.@rel = "alternate";
+        return {body:entry};
+      } else {
+        return {body: "</feed>"};
+      }
+    }
+  })
+};
+{
+    "months": {
+        "01": "Janvier",
+        "02": "Février",
+        "03": "Mars",
+        "04": "Avril",
+        "05": "Mai",
+        "06": "Juin",
+        "07": "Juillet",
+        "08": "Aout",
+        "09": "Septembre",
+        "10": "Octobre",
+        "11": "Novembre",
+        "12": "Décembre"
+    },
+
+    "date" : {
+        "a": ["dim", "lun", "mar", "mer", "jeu", "ven", "sam"],
+        "A": ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"],
+        "b": ["jan", "fév", "mar", "avr", "mai", "jun", "jui", "aoû", "sep", "oct", "nov", "déc"],
+        "B": ["janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre"],
+        "c": "%a %d %b %Y %T %Z",
+        "p": ["", ""],
+        "P": ["", ""],
+        "x": "%d.%m.%Y",
+        "X": "%T"
+    }
+}
+
   // !code lib.helpers.template2
   // !code lib.helpers.couchapp
 
+  var fcreated_at = new Date().setRFC3339(doc.created_at).toLocaleString();
 
+  var labels = [];
+  if (doc.labels) {
+      for(var i=0; i<doc.labels.length; i++) {
+          labels.push('<a href="' +
+                  listPath('index','archives',{descending:true, limit:25, key:doc.labels[i]})
+                  + '">'+ doc.labels[i] + '</a>');
+      }
+  }
   // we only show html
   return template(lib.templates.post, {
     doc: doc,
+    fcreated_at: fcreated_at,
     assets : assetPath(),
     editPostPath : showPath('edit', doc._id),
+    labels: labels.join(', '),
     index : listPath('index','recent-posts',{descending:true, limit:8})
   });
 }

views/comments/map.js

+function(doc) {
+  // !code lib.helpers.md5
+  if (doc.doc_type == "comment") {
+    doc.commenter.gravatar = hex_md5(doc.commenter.email);
+    emit([doc.post_id, doc.created_at], doc);
+  }  
+};

views/comments/reduce.js

+function(ks, vs, co) {
+  if (co) {
+    return sum(vs);
+  } else {
+    return vs.length;
+  }
+};

views/recent-posts/map.js

 function(doc) {
   // only posts have slugs, dates, and html
   if (doc.doc_type == "post") {
-    var summary = (doc.html.replace(/<(.|\n)*?>/g, '').substring(0,350) + '...');
+    var summary = '';
+    if (doc.html.length <= 350) {
+        summary = doc.html;
+    } else {
+        summary = (doc.html.replace(/<(.|\n)*?>/g, '').substring(0,350) + '...');
+    }
+
     emit(doc.created_at, {
       summary : summary,
       title : doc.title,