my eye

Move render_breadcrumbs to webint and prepare for spaification

Committed 533c17

--- a/canopy/templates/__init__.py
+++ b/canopy/templates/__init__.py

 # TODO from micropub.readability import Readability
 import web
 from mf import discover_post_type
+from web.framework import templates
 from webagt import Document
 from webint_live import app as live_app
 from webint_posts import app as posts_app
     "livestream",
     "get_key",
     "get_onion",
+    "render_breadcrumbs",
 ]
 
 tx = web.tx
 livestream = live_app.view.stream
+render_breadcrumbs = templates.render_breadcrumbs
 
 
 def pformat(obj):

--- a/canopy/templates/template.html
+++ b/canopy/templates/template.html

 </div>
 </header>
 
-$def render_breadcrumbs(breadcrumbs, separator="&#x25b8;", padding="&ensp;"):
-    $ """
-    $ 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", ...)
-    $
-    $ """
-    $ 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>\
-
 <article id=content\
 $if "classes" in resource:
      class="$' '.join(resource.classes)"\
 >
 $if path:
     $ breadcrumbs = []
-    $ parts = path.split("/")
-    $ app = parts[0]
-    $if len(parts) > 1:
-        $ breadcrumbs += [app, app.capitalize()]
     $if "breadcrumbs" in resource:
-        $ breadcrumbs += list(resource["breadcrumbs"])
-    $if breadcrumbs:
-        <nav class=breadcrumbs>$:render_breadcrumbs(breadcrumbs)</nav>
+        $ breadcrumbs = list(resource["breadcrumbs"])
+    <nav class=breadcrumbs>$:render_breadcrumbs(breadcrumbs, path)</nav>
 $if "title" in resource:
     $if getattr(resource, "show_title", True):
         <header>