diff --git a/ERRATA.md b/ERRATA.md new file mode 100644 index 0000000..42cf1d5 --- /dev/null +++ b/ERRATA.md @@ -0,0 +1,84 @@ +Errata +========== + +* The code as I found it is considerably out of sync with *CouchDB: + The Definitive Guide*. (But then the book seems to be in need of an + update for other reasons anyway.) + +* **Sofa** requires CouchDB version >= 1.1.0 in order for `require`d + code in view `map`s to be actually included. In earlier versions + of CouchDB, the `map` will, from the point of view of the user, + silently fail and mysteriously (to the user) no results are + returned. Furthermore, in the versions I have seen that **do** + support this, the code to be `require`d **must be** in + `views/libs/`. `Require`ing code in other locations will, again + silently, fail. + +* There are now 3 copies of `md5.js` shipped with **Sofa** -- I had to + add one into `views/libs/` so that the `views/comments/map.js` + didn't fail (silently, as above). + +* **Sofa** can be successfully initially deployed via `couchapp.py`, + but **not** via `erica`: the latter fails to correctly install + `_attachments/`, complaining thus: + + > <<"{\"error\":\"bad_request\",\"reason\":\"Attachment name can't start with '_'\"}\n">>}}} + + (full stack trace may be found at the end of this file). However, + after the initial deployment, I was able to use `erica`. + +* `jquery.scrollTo` seems to work only intermittently, but since it is + used only by the 'preview' functionality as a (cool!) convenience, I + didn't wish to spend much time on it. + +* Some versions of `CouchDB` (pre-1.1.0?) do *not* like the + `views/lib/` directory to *not* have a `map.js` file in it, and go + so far as to return an `undefined` in its place. I just put a + **valid but unused** `map.js` in the `views/lib/` directory to get + around this. If one doesn't do this, `CouchDB` will complain thusly: + +> [{view,0, +> [<<"lib">>], +> undefined, +> {btree,<0.8974.16>,nil, +> #Fun, +> #Fun, +> #Fun, +> #Fun}, +> [],[]}, +> {view,1, +> [<<"recent-posts">>], +> <<"function(doc) {\n if (doc.type == \"post\") {\n emit(new Dat +> e(doc.created_at), doc);\n }\n};\n">>, +> {btree,<0.8974.16>,nil, +> #Fun, +> #Fun, +> #Fun, +> #Fun}, +> [],[]}, + + and the web broweser will display: + +> {"error":"compilation_error","reason":"Expression does not eval to a function. ((new String(\"undefined\")))"} + + +Full`erica` deployment attempt stack trace: + +> DEBUG: push /my/home/dir/dev/couchdb/test/sofatest => iristest +> DEBUG: Detected Style: traditional +> DEBUG: File '".gitignore"' ignored. +> ERROR: push failed while processing /my/home/dir/dev/couchdb/test/sofatest: {'EXIT',{{badmatch,{error,{ok,"400", +> [{"Server","CouchDB/1.5.0 (Erlang OTP/R15B03)"}, +> {"Date","Sun, 30 Aug 2015 07:44:11 GMT"}, +> {"Content-Type","application/json"}, +> {"Content-Length","72"}, +> {"Cache-Control","must-revalidate"}], +> <<"{\"error\":\"bad_request\",\"reason\":\"Attachment name can't start with '_'\"}\n">>}}}, +> [{erica_push,do_push,4,[]}, +> {erica_push,push2,3,[]}, +> {erica_push,push1,3,[]}, +> {erica_core,run_modules,4,[]}, +> {erica_core,execute,4,[]}, +> {erica,main,1,[]}, +> {escript,run,2,[{file,"escript.erl"},{line,747}]}, +> {escript,start,1,[{file,"escript.erl"},{line,277}]}]}} diff --git a/_attachments/script/md5.js b/_attachments/script/md5.js index 46d2aab..411bca0 100644 --- a/_attachments/script/md5.js +++ b/_attachments/script/md5.js @@ -36,6 +36,7 @@ function md5_vm_test() /* * Calculate the MD5 of an array of little-endian words, and a bit length + keep */ function core_md5(x, len) { @@ -197,6 +198,7 @@ function bit_rol(num, cnt) /* * Convert a string to an array of little-endian words * If chrsz is ASCII, characters >255 have their hi-byte silently ignored. + keep */ function str2binl(str) { @@ -221,6 +223,7 @@ function binl2str(bin) /* * Convert an array of little-endian words to a hex string. + keep */ function binl2hex(binarray) { @@ -254,3 +257,7 @@ function binl2b64(binarray) } return str; } + +if (typeof exports != 'undefined') { + exports.hex = hex_md5; +}; diff --git a/evently/profile/profileReady/selectors/#preview/click.js b/evently/profile/profileReady/selectors/#preview/click.js index d03c4c4..0084573 100644 --- a/evently/profile/profileReady/selectors/#preview/click.js +++ b/evently/profile/profileReady/selectors/#preview/click.js @@ -7,7 +7,7 @@ function() { name : $$("#profile").profile.nickname, url : $$("#profile").profile.url, avatar : $$("#profile").profile.gravatar_url, - html : markdown.encode(Mustache.escape($("[name=comment]", f).val())), + html : markdown.encode(Mustache.escape($("[name=comment]").val())), created_at : JSON.parse(JSON.stringify(new Date())) }; diff --git a/helpers/md5.js b/helpers/md5.js index 0837f32..d8489fa 100644 --- a/helpers/md5.js +++ b/helpers/md5.js @@ -256,4 +256,6 @@ function binl2b64(binarray) } } return str; -} \ No newline at end of file +} + +exports.hex = hex_md5; diff --git a/lists/index.js b/lists/index.js index 531300b..1a5a587 100644 --- a/lists/index.js +++ b/lists/index.js @@ -31,7 +31,7 @@ function(head, req) { assets : path.asset(), posts : List.withRows(function(row) { var post = row.value; - key = row.key; + key = row.key[0]; return { title : post.title, author : post.author, diff --git a/templates/edit.html b/templates/edit.html index a7c9a2b..7bce82b 100644 --- a/templates/edit.html +++ b/templates/edit.html @@ -9,7 +9,7 @@
-
+

{{pageTitle}}

diff --git a/templates/post.html b/templates/post.html index 670a13c..9830fa9 100644 --- a/templates/post.html +++ b/templates/post.html @@ -21,9 +21,11 @@

{{ title }}

+
{{>scripts}} +