Commits

Benoit Chesneau committed 0848c5d

use relative paths and some fixes

  • Participants
  • Parent commits a69e9c3
  • Tags pre-0.10

Comments (0)

Files changed (24)

+{
+	"env": {
+		"default": {
+			"db": "http://benoitc:test@127.0.0.1:5984/b"
+		}
+	}
+}

_attachments/account.html

     <link rel="me author" href="http://benoitc.org/about.html" type="text/html">
     <link rel="stylesheet" href="css/screen.css" type="text/css" media="screen, projection" />
 
-    
-
-
 </head>
 
 
 <body>
         <header>
         <h1>
-            <a rel="me author" href="about.html">Benoît Chesneau</a>
+            <a rel="me author" href="benoitc.html">Benoît Chesneau</a>
         </h1>
         </header>
         <section id="content">
     
     <script>
         $.CouchApp(function(app) {
-
-            // ugly hack for rewriting
-            var href = document.location.href;
-            var redirectUrl = '';
-            if (href.split('#').length > 1) {
-                var fragments = href.split('#')[1].split(',');
-
-                var redirectUrl = fragments.pop();
-            }
-            $('#content').append('<p>Attempting login.</p>');
-            app.attemptLogin(function(login) {
-                if (redirectUrl) document.location = unescape(redirectUrl).replace('_design/','_design%2F');
-                $('#content').append('<p>Success.</p>');
-                $('h1').text('Welcome '+login);
-                $('#content').append('<p>Now that you\'re logged in, you can <a href="edit.html">write blog posts.</a></p>');
-            }, function() {
-                $('h1').text('Incorrect login');
-                $('#content').append('<p>Fail.</p>');
-            });
-        }); 
+		      var redirectUrl = document.location.hash.replace('#','');
+		      $('#content').append('<p>Attempting login.</p>');
+		      app.attemptLogin(function(login) {
+		        if (redirectUrl) document.location = unescape(redirectUrl).replace('_design/','_design%2F');
+		        $('#content').append('<p>Success.</p>');
+		        $('h1').text('Welcome '+login);
+		        $('#content').append('<p>Now that you\'re logged in, you can <a href="_show/edit">write blog posts.</a></p>');
+		      }, function() {
+		        $('h1').text('Incorrect login');
+		        $('#content').append('<p>Fail.</p>');
+		      });
+		    });
     </script>
 
 </html>

_attachments/benoitc.html

         <header class="about">
             <p class="caps">À propos</p>
             <h1>Benoît Chesneau</h1>
-            <p><a href="/">Mon introspection numérique.</a></p>
+            <p><a href="_list/index">Mon introspection numérique.</a></p>
         </header>
         <section id="maincontent" class="about">
             <p><img

_attachments/js/jquery.couchapp.js

 // License for the specific language governing permissions and limitations under
 // the License.
 
-// Usage:
-// $.CouchApp
-
-// Monkeypatching Date. 
-
-
-
-
+// Usage: The passed in function is called when the page is ready.
+// CouchApp passes in the app object, which takes care of linking to 
+// the proper database, and provides access to the CouchApp helpers.
+// $.CouchApp(function(app) {
+//    app.db.view(...)
+//    ...
+// });
 
 (function($) {
-  function getEnv() {
-    var href = document.location.href;
-    if (href.split('#').length <= 1)
-        return;
-    var fragments = href.split('#')[1].split(',');
-
-    if (fragments.length == 4) {
-        $.extend({
-            blog: {
-                'dbname': fragments[0],
-                'dname': fragments[1],
-                'cookie_path': fragments[2]
-            }
-        });
-    } else if (fragments.length == 3) {
-        $.extend({
-            blog: {
-                'dbname': fragments[0],
-                'dname': fragments[1]            
-            }
-        });
-    } else if (fragments.length == 2) {
-        $.extend({
-            blog: {
-                'dbname': fragments[0]            
-            }
-        });
-    }
-  }
 
   function f(n) {    // Format integers to have at least two digits.
       return n < 10 ? '0' + n : n;
   };
 
   var login;
-
+  
   function init(app) {
-
     $(function() {
-      getEnv();
-      if ($.blog && $.blog.dbname) {
-        var dbname = $.blog.dbname;
-      } else {
-        var dbname = document.location.href.split('/')[3];
-      }
-
-      if ($.blog && $.blog.dname) {
-        var dname = $.blog.dname;
-      } else {
-        var dname = unescape(document.location.href).split('/')[5];
-      }
-
+      var dbname = document.location.href.split('/')[3];
+      var dname = unescape(document.location.href).split('/')[5];
       var db = $.couch.db(dbname);
       var design = new Design(db, dname);
       
         return instance;
       }
       
-            
       app({
         showPath : function(form, docid) {
-          return '/'+[dbname, '_show', dname, form, docid].join('/')
+          return '/'+[dbname, '_design', dname, '_show', form, docid].join('/')
         },
         attemptLogin : function(win, fail) {
           // depends on nasty hack in blog validation function
-          if ($.blog && $.blog.cookie_path) {
-            var cookie_path = $.blog.cookie_path;
-          } else {
-            var cookie_path = "/" + dbname;
-          }
           db.saveDoc({"author":"_self"}, { error: function(s, e, r) {
             var namep = r.split(':');
             if (namep[0] == '_self') {
               login = namep.pop();
-              $.cookies.set("login", login, cookie_path)
+              $.cookies.set("login", login, '/'+dbname)
               win && win(login);
             } else {
-              $.cookies.set("login", "", cookie_path)
+              $.cookies.set("login", "", '/'+dbname)
               fail && fail(s, e, r);
             }
           }});        
       });
     });
   };
-  
+
   $.CouchApp = $.CouchApp || init;
-  
 
-})(jQuery);
-
+})(jQuery);
+{
+  "index" : ["_list","index/recent-posts?descending=true&limit=8"]
+}

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 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 %>/benoitc.html">Benoît Chesneau</a>
-        </h1>
-    </header>
-    <section id="items">
-

index/row.html

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

index/tail.html

-
-    </section>
-    <footer>
-        <p> Benoît Chesneau</p>    
-    </footer>
-</body>
-</html>

lib/helpers/couchapp.js

-// this stuff should be properly namespaced etc
-
-// from couch.js
-function encodeOptions(options) {
-  var buf = []
-  if (typeof(options) == "object" && options !== null) {
-    for (var name in options) {
-      if (!options.hasOwnProperty(name)) continue;
-      var value = options[name];
-      if (name == "key" || name == "startkey" || name == "endkey") {
-        value = toJSON(value);
-      }
-      buf.push(encodeURIComponent(name) + "=" + encodeURIComponent(value));
-    }
-  }
-  if (!buf.length) {
-    return "";
-  }
-  return "?" + buf.join("&amp;");
-}
-
-function concatArgs(array, args) {
-  for (var i=0; i < args.length; i++) {
-    array.push(args[i]);
-  };
-  return array;
-};
-
-function makePath(array) {
-  var options, path;
-  
-  if (typeof array[array.length - 1] != "string") {
-    // it's a params hash
-    options = array.pop();
-    log({options:options});
-  }
-  path = array.map(function(item) {return encodeURIComponent(item)}).join('/');
-  if (options) {
-    return path + encodeOptions(options);
-  } else {
-    return path;    
-  }
-};
-
-// from prototype
-Object.extend = function(destination, source) {
-  for (var property in source)
-    destination[property] = source[property];
-  return destination;
-};
-
-function getEnv() {
-    default_env = {
-        'dbname': req.path[0],
-        'dname': req.path[2],
-        'cookie_path': '/' + req.path[0]
-    };
-
-    new_env = {};
-    if (typeof blog != "undefined" && blog.env) {
-         for(var host in blog.env) {
-             if (host == req.headers.Host) {
-                 new_env = blog.env[host];
-                 break;
-             }
-         }
-    }
-    Object.extend(default_env, new_env);
-    return default_env;
-};
-
-function assetPath() {
-  if (typeof blog != "undefined" && blog.env) {
-    for(var host in blog.env) {
-        if (host == req.headers.Host && blog.env[host].static_url) {
-            parts = ['', blog.env[host].static_url];
-            return makePath(concatArgs(parts, arguments));
-        }
-    }
-  }
-  parts = ['',req.path[0], '_design', req.path[2]];
-  return makePath(concatArgs(parts, arguments));
-};
-
-function showPath() {
-  if (typeof blog != "undefined" && blog.env) {
-    for(var host in blog.env) {
-        if (host == req.headers.Host && blog.env[host].show_url) {
-            parts = ['', blog.env[host].show_url];
-            return makePath(concatArgs(parts, arguments));
-        }
-    }
-  }
-
-  var parts = ['',req.path[0], '_show', req.path[2]];
-  return makePath(concatArgs(parts, arguments));
-};
-
-function listPath() {
-  if (typeof blog != "undefined" && blog.env) {
-    for(var host in blog.env) {
-        if (host == req.headers.Host && blog.env[host].list_url) {
-            parts = ['', blog.env[host].list_url];
-            return makePath(concatArgs(parts, arguments));
-        }
-    }
-  }
-
-  var parts = ['',req.path[0], '_list', req.path[2]];
-  return makePath(concatArgs(parts, arguments));
-};
-
-function makeAbsolute(req, path) {
-  return 'http://' + req.headers.Host + path;
-}
-
-function f(n) {    // Format integers to have at least two digits.
-    return n < 10 ? '0' + n : n;
-}
-
-Date.prototype.rfc3339 = function() {
-    return this.getUTCFullYear()   + '-' +
-         f(this.getUTCMonth() + 1) + '-' +
-         f(this.getUTCDate())      + 'T' +
-         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/helpers/template.js

-// Simple JavaScript Templating
-// John Resig - http://ejohn.org/ - MIT Licensed
-var cache = {};
+// simple helper to reder template from ejs
+//
 
-function template(str, data){
-  // Figure out if we're getting a template, or if we need to
-  // load the template - and be sure to cache the result.
-  var fn = cache[str] ||
+function template(str, data) {
+    html = new EJS({text: str}).render(data);
+    return html;
+}
 
-  // Generate a reusable function that will serve as a template
-  // generator (and which will be cached).
-    new Function("obj",
-      "var p=[],print=function(){p.push.apply(p,arguments);};" +
-          
-            // Introduce the data as local variables using with(){}
-            "with(obj){p.push('" +
-          
-            // Convert the template into pure JavaScript
-            str
-            .replace(/\n/g, "\\n")
-            .replace(/[\r\t]/g, " ")
-            .replace(/'(?=[^%]*%>)/g,"\t")
-            .split("'").join("\\'")
-            .split("\t").join("'")
-            .replace(/<%=(.+?)%>/g, "',$1,'")
-            .split("<%").join("');")
-            .split("%>").join("p.push('")
-            + "');}return p.join('');");
-  cache[str] = fn;
-  
-  // Provide some basic currying to the user
-  return data ? fn( data ) : fn;
-};
+

lib/helpers/template2.js

-// simple helper to reder template from ejs
-//
-
-function template(str, data) {
-    html = new EJS({text: str}).render(data);
-    return html;
-}
-
-

lib/templates/edit.html

     <link rel="home index" href="http://benoitc.org/" type="text/html">
     <link rel="me author" href="http://benoitc.org/static/benoitc.html" type="text/html">
 
-    <link rel="stylesheet" href="<%= assets %>/css/benoitc.css" type="text/css" media="screen, projection" />
+    <link rel="stylesheet" href="../../css/benoitc.css" type="text/css" media="screen, projection" />
     
 
 
 <body>
         <header>
         <h1>
-            <a rel="me author" href="<%= assets %>/benoitc.html">Benoît Chesneau</a>
+            <a rel="me author" href="../../benoitc.html">Benoît Chesneau</a>
         </h1>
         </header>
         <div id="edit">
         </div>
 
         <footer id="main-footer">
-        <p>2009 (c) <a href="<%= assets %>/<%= assets %>/benoitc.html">Benoît Chesneau</a> - <a rel="license" href="http://creativecommons.org/licenses/by/2.0/fr/">Certains droits reservés</a>.</p>
+        <p>2009 (c) <a href="../../benoitc.html">Benoît Chesneau</a> - <a rel="license" href="http://creativecommons.org/licenses/by/2.0/fr/">Certains droits reservés</a>.</p>
         </footer> 
 
     
     <script src="/_utils/script/jquery.js"></script>
     <script src="/_utils/script/jquery.cookies.js"></script>
     <script src="/_utils/script/jquery.couch.js"></script>
-
-    <script>
-        // ugly hack for rewriting
-        $.extend({
-            blog: {
-                dbname: "<%= env.dbname %>",
-                dname: "<%= env.dname %>",
-                cookie_path: "<% env.cookie_path %>"
-            }
-        });    
-    </script>
-
-    <script src="<%= assets %>/js/showdown.js"></script>
-
-    <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>
+    <script src="../../js/showdown.js"></script>
+    <script src="../../js/textarea.jquery.js"></script>
+    <script src="../../js/jquery.couchapp.js"></script>
+    <script src="../../js/editor.js"></script>
+    <script src="../../js/strftime.js"></script>
+    <script src="../../js/blog.js"></script>
+    <script src="../../js/urlify.js"></script>
 
     <script>
         $(document).ready(function() {
                     new Editor(); 
                     }, function() {
                     // callback
-                    $('body').append('<a href="<%= assets %>/account.html#<%= env.dbname %>,<%= env.dname %>,<%= env.cookie_path %>,'+document.location+'">redirect</a>');
+                    $('body').append('<a href="../../account.html#'+document.location+'">redirect</a>');
                     var absurl = $('body a:last')[0].href;
                     document.location = absurl;
                 });

lib/templates/index/head.html

     <link rel="me author" href="http://benoitc.org/static/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" />
+    <link rel="stylesheet" href="../../css/benoitc.css" type="text/css" media="screen, projection" />
 </head>
 
 
                 </ul>
             </nav>
             <h1>
-                <a rel="me author" href="<%= assets %>/benoitc.html">Benoît Chesneau</a>
+                <a rel="me author" href="../../benoitc.html">Benoît Chesneau</a>
             </h1>
             <h2>artisan web</h2>
 

lib/templates/index/tail.html

         <p class="next"><a href="<%= nextPath %>">articles suivants »</a></p>
 
         <footer id="main-footer">
-            <p>2009 (c) <a href="<%= assets %>/benoitc.html">Benoît Chesneau</a> - <a rel="license" href="http://creativecommons.org/licenses/by/2.0/fr/">Certains droits reservés</a>.</p>
+            <p>2009 (c) <a href="../../benoitc.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>
-        // ugly hack for rewriting
-        $.extend({
-            blog: {
-                dbname: "<%= env.dbname %>",
-                dname: "<%= env.dname %>"
-            }
-        });
-    </script>
-    <script src="<%= assets %>/js/jquery.couchapp.js"></script>
-    <script src="<%= assets %>/js/strftime.js"></script>
-    <script src="<%= assets %>/js/blog.js"></script>
+    <script src="../../js/jquery.couchapp.js"></script>
+    <script src="../../js/strftime.js"></script>
+    <script src="../../js/blog.js"></script>
     <script>
         $(document).ready(function() {
             localizeDates();

lib/templates/post.html

     <link rel="home index" href="http://benoitc.org" type="text/html">
     <link rel="me author" href="http://benoitc.org/static/benoitc.html" type="text/html">
 
-    <link rel="stylesheet" href="<%= assets %>/css/benoitc.css" type="text/css" media="screen, projection" />
+    <link rel="stylesheet" href="../../css/benoitc.css" type="text/css" media="screen, projection" />
 
 
 </head>
             <header>
                 <h1><%= doc.title %></h1>
                 <time title="GMT" datetime="<%= doc.created_at %>" class="caps"><%= fcreated_at %></time>     
-                <p><a rel="me author" href="<%= assets %>/benoitc.html">Benoît Chesneau</a></p>       
+                <p><a rel="me author" href="../../benoitc.html">Benoît Chesneau</a></p>       
             </header>    
             <%= doc.html %>
             <% if (labels) { %>
         </section>
 
         <footer id="main-footer">
-            <p>2009 (c) <a href="<%= assets %>/benoitc.html">Benoît Chesneau</a> - <a rel="license" href="http://creativecommons.org/licenses/by/2.0/fr/">Certains droits reservés</a>.</p>
+            <p>2009 (c) <a href="../../benoitc.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/jquery.js"></script>
     <script src="/_utils/script/jquery.couch.js"></script>
     <script src="/_utils/script/jquery.cookies.js"></script>
-
-    <script>
-        // ugly hack for rewriting
-        $.extend({
-            blog: {
-                dbname: "<%= env.dbname %>",
-                dname: "<%= env.dname %>"
-            }
-        });
-    </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 src="<%= assets %>/js/md5.js"></script>  
+    <script src="../../js/jquery.couchapp.js"></script>
+    <script src="../../js/strftime.js"></script>
+    <script src="../../js/showdown.js"></script>
+    <script src="../../js/blog.js"></script>
+    <script src="../../js/md5.js"></script>  
     <script>
         $(document).ready(function() {
             localizeDates();

lib/templates/search/head.html

     <link rel="me author" href="http://benoitc.org/static/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" />
+    <link rel="stylesheet" href="../../css/benoitc.css" type="text/css" media="screen, projection" />
 </head>
 
 
                 </ul>
             </nav>
             <h1>
-                <a rel="me author" href="<%= assets %>/benoitc.html">Benoît Chesneau</a>
+                <a rel="me author" href="../../benoitc.html">Benoît Chesneau</a>
             </h1>
             <h2>artisan web</h2>
 

lib/templates/search/tail.html

         <footer id="main-footer">
-            <p>2009 (c) <a href="<%= assets %>/benoitc.html">Benoît Chesneau</a> - <a rel="license" href="http://creativecommons.org/licenses/by/2.0/fr/">Certains droits reservés</a>.</p>
+            <p>2009 (c) <a href="../../benoitc.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>
-        // ugly hack for rewriting
-        $.extend({
-            blog: {
-                dbname: "<%= env.dbname %>",
-                dname: "<%= env.dname %>"
-            }
-        });
-    </script
-    <script src="<%= assets %>/js/jquery.couchapp.js"></script>
-    <script src="<%= assets %>/js/strftime.js"></script>
-    <script src="<%= assets %>/js/blog.js"></script>
+    <script src="../../js/jquery.couchapp.js"></script>
+    <script src="../../js/strftime.js"></script>
+    <script src="../../js/blog.js"></script>
     <script>
         $(document).ready(function() {
             localizeDates();
 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
+  // !code lib/helpers/ejs/*.js
+  // !code lib/helpers/template.js
+  // !code vendor/couchapp/date.js
+  // !code vendor/couchapp/path.js
     
   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','recent-posts',{descending:true, limit:25});
+  
+  registerType("sitemap", "application/x-xml");
+  
   return respondWith(req, {
     html: function() {
         if (head) {
             });
         } else if (row) {
             if (!req.query.limit && row_info.row_number == 7)
-                return {stop: true}
+                return {stop: true};
                 
             var fcreated_at = new Date().setRFC3339(row.value.created_at).toLocaleString();
             return template(lib.templates.index.row, {
             });
         } else {
             var nextPath = listPath('index','recent-posts', {
-                    startkey:row_info.prev_key, 
+                    startkey: ((row_info &&row_info.prev_key) || "#"), 
                     descending:true, 
                     limit:25 });
 
             return template(lib.templates.index.tail, {
                 nextPath: nextPath,
-                assets: assetPath(),
-                env: getEnv()
+                assets: assetPath()
             });
         }
     },
         f.link.@rel = "self";
         f.generator = 'benoitc.org';
         f.updated = new Date().rfc3339();
-        return {body:f.toXMLString().replace(/\<\/feed\>/,'')};
+        return {body:'<?xml version="1.0" encoding="UTF-8"?>\n'+
+                f.toXMLString().replace(/\<\/feed\>/,'')};
       } else if (row) {
         var entry = <entry/>;
         entry.id = makeAbsolute(req, '/'+encodeURIComponent(req.info.db_name)+'/'+encodeURIComponent(row.id));
 function(head, row, req, row_info) {
   // !json lib.templates.search
   // !json blog
-  // !json locales
-  // !code lib.helpers.couchapp
-  // !code lib.helpers.ejs.ejs
-  // !code lib.helpers.ejs.view
-  // !code lib.helpers.template2
+  // !code lib/helpers/ejs/*
+  // !code lib/helpers/template.js
+  // !code vendor/couchapp/date.js
+  // !code vendor/couchapp/path.js
     
   var indexPath = listPath('index','recent-posts',{descending:true, limit:8});
   var feedPath = listPath('search','topics',{descending:true, limit:8, format:"atom"});
         } else {
             return template(lib.templates.search.tail, {
                 archivesPath: archivesPath,
-                assets: assetPath(),
-                env: getEnv()
+                assets: assetPath()
             });
         }
     },
         f.link.@rel = "self";
         f.generator = 'benoitc.org';
         f.updated = new Date().rfc3339();
-        return {body:f.toXMLString().replace(/\<\/feed\>/,'')};
+        return {body:'<?xml version="1.0" encoding="UTF-8"?>\n'+
+                f.toXMLString().replace(/\<\/feed\>/,'')};
       } else if (row) {
         var entry = <entry/>;
         entry.id = makeAbsolute(req, '/'+encodeURIComponent(req.info.db_name)+'/'+encodeURIComponent(row.id));
 function(doc, req) {  
   // !json lib.templates.edit
   // !json blog
-  // !code lib.helpers.ejs.ejs
-  // !code lib.helpers.ejs.view
-  // !code lib.helpers.template2
-  // !code lib.helpers.couchapp
+  // !code lib/helpers/ejs/*
+  // !code lib/helpers/template.js
+  // !code vendor/couchapp/date.js
+  // !code vendor/couchapp/path.js
 
   // we only show html
   //
-  
 
   return template(lib.templates.edit, {
     doc : doc,
     docid : toJSON((doc && doc._id) || null), 
     assets : assetPath(),
-    index : listPath('index','recent-posts',{descending:true,limit:8}),
-    env: getEnv()
+    index : listPath('index','recent-posts',{descending:true,limit:8})
     });
 }
 function(doc, req) {  
   // !json lib.templates.post
   // !json blog
-  // !code lib.helpers.ejs.ejs
-  // !code lib.helpers.ejs.view
-  // !code lib.helpers.template2
-  // !code lib.helpers.couchapp
+  // !code lib/helpers/ejs/*
+  // !code lib/helpers/template.js
+  // !code vendor/couchapp/date.js
+  // !code vendor/couchapp/path.js
 
   var fcreated_at = new Date().setRFC3339(doc.created_at).toLocaleString();
 
     editPostPath : showPath('edit', doc._id),
     labels: labels.join(', '),
     index : listPath('index','recent-posts',{descending:true, limit:8}),
-    env: getEnv(),
     editPath: editPath
   });
 }

validate_doc_update.js

       if (author != userCtx.name)
         unauthorized("Only "+author+" may edit this document.");      
     } 
-  } else if (docid && docid.startswith('_design/') {
-        if (userCtx.roles.indexOf('_admin') == -1) {
-            unauthorized('Please log in.');
-        }
-  }
+  } 
 
   // authors and admins can always delete
   if (newDoc._deleted) return true;

vendor/couchapp/path.js

   if (!buf.length) {
     return "";
   }
-  return "?" + buf.join("&");
+  return "?" + buf.join("&amp;");
 }
 
 function concatArgs(array, args) {
 };
 
 function assetPath() {
-  var parts = ['',req.path[0], '_design', req.path[2]];
+  var p = req.path, parts = ['', p[0], p[1] , p[2]];
   return makePath(concatArgs(parts, arguments));
 };
 
 function showPath() {
-  var parts = ['',req.path[0], '_show', req.path[2]];
+  var p = req.path, parts = ['', p[0], p[1] , p[2], '_show'];
   return makePath(concatArgs(parts, arguments));
 };
 
 function listPath() {
-  var parts = ['',req.path[0], '_list', req.path[2]];
+  var p = req.path, parts = ['', p[0], p[1] , p[2], '_list'];
   return makePath(concatArgs(parts, arguments));
 };
 

views/comments/map.js

 function(doc) {
-  // !code lib.helpers.md5
+  // !code lib/helpers/md5.js
   if (doc.doc_type == "comment") {
     if (doc.commenter.email) {
         doc.commenter.gravatar = hex_md5(doc.commenter.email);