close Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Changes between Version 1 and Version 2 of Scratchpad


Ignore:
Timestamp:
Jul 21, 2008, 2:03:23 PM (16 years ago)
Author:
cmlenz
Comment:

Added view definitions

Legend:

Unmodified
Added
Removed
Modified
  • Scratchpad

    v1 v2  
    55It uses [http://incubator.apache.org/couchdb/ CouchDB] (via the [http://code.google.com/p/couchdb-python/ CouchDB-Python] library) for storage, and [http://pygments.org/ Pygments] for syntax highlighting.
    66
     7== CouchDB Views ==
     8
     9All views are in Javascript.
     10
     11=== `_design/snippets` ===
     12
     13==== `by_author` ====
     14{{{
     15#!text/javascript
     16function(doc) {
     17  if (doc.author) {
     18    emit([doc.author, doc.time], {
     19      title: doc.title,
     20      author: doc.author,
     21      time: doc.time,
     22      mimetype: doc.mimetype,
     23      description: doc.description,
     24      num_comments: doc.comments ? doc.comments.length : 0
     25    });
     26  }
     27}
     28}}}
     29
     30==== `by_time` ====
     31{{{
     32#!text/javascript
     33function(doc) {
     34  emit([doc.time, doc.title], {
     35    title: doc.title, author: doc.author, time: doc.time,
     36    mimetype: doc.mimetype, description: doc.description,
     37    num_comments: doc.comments ? doc.comments.length : 0
     38  });
     39}
     40}}}
     41
     42==== `by_type` ====
     43{{{
     44#!text/javascript
     45function(doc) {
     46  emit([doc.mimetype, doc.time], {
     47    title: doc.title, author: doc.author, time: doc.time,
     48    mimetype: doc.mimetype, description: doc.description,
     49    num_comments: doc.comments ? doc.comments.length : 0
     50  })
     51}
     52}}}