my eye

Add render_breadcrumbs for server side rendering

Committed d486c1

index 0000000..73fa0d5
--- /dev/null

+$def with (breadcrumbs, fullpath, separator="▸", padding=" ")
+$ """
+$ Render a `separator` delimited list of linkified `breadcrumbs`.
+$
+$ `breadcrumbs` should be a single tuple that will be read two items at a time:
+$
+$     ("path", "Name", "subpath", "Subname", ...)
+$
+$ """
+$ fullparts = fullpath.split("/")
+$ app = fullparts[0]
+$if len(fullparts) > 1:
+    $ breadcrumbs = [app, app.capitalize()] + breadcrumbs
+$ remaining = int(len(breadcrumbs) / 2)
+$ path = ""
+$for crumb_path, crumb_title in zip(*(breadcrumbs[i::2] for i in (0, 1))):
+    $ crumb_path = str(crumb_path)
+    $ crumb_icon, crumb_classes = None, None
+    $if isinstance(crumb_title, tuple):
+        $ crumb_icon, crumb_classes, crumb_title = crumb_title
+    $ path = path + "/" + crumb_path
+    $ ups = " ".join(["up"] * remaining)
+    $ remaining = remaining - 1
+    <span>\
+    $if crumb_icon:
+        <span class="crumb-icon-$crumb_icon"></span>&thinsp;\
+     <a href=$path \
+    $if crumb_classes:
+        class="$' '.join(crumb_classes)"
+    rel="$ups">$:crumb_title</a>\
+    $:padding<span class=crumb-sep>$:separator</span></span>\