my eye

Fix breadcrumb whitespace on root, header and article classes on spaify

Committed b6d55a

--- a/web/framework/__init__.py
+++ b/web/framework/__init__.py

         chromeless = str(tx.request.headers.get("X-Chromeless", "0")) == "1"
         naked = getattr(tx.response, "naked", False)
         if chromeless:
-            body = "<article id=content>"
+            body = "<article id=content"
+            if "article_classes" in tx.response.body:
+                body += f' class="{" ".join(tx.response.body.article_classes)}"'
+            body += ">"
             if tx.request.uri.path:
                 breadcrumbs = []
                 if "breadcrumbs" in tx.response.body:
                     breadcrumbs = list(tx.response.body.breadcrumbs)
-                body += f"""<nav class=breadcrumbs>
-                {templates.render_breadcrumbs(breadcrumbs, tx.request.uri.path)}
-                </nav>"""
+                body += str(
+                    templates.render_breadcrumbs(breadcrumbs, tx.request.uri.path)
+                )
             title = getattr(tx.response.body, "title", None)
             if title:
-                body += f"<header><h1>{title}</h1></header>"
+                body += f"<h1>{title}</h1>"
             body += f"{tx.response.body}</article>"
             body += "<div class=page-related>"
             if "aside" in tx.response.body:

--- a/web/framework/templates/render_breadcrumbs.html
+++ b/web/framework/templates/render_breadcrumbs.html

     $ 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
-    $ ups = " ".join(["up"] * remaining)
-    $ remaining = remaining - 1
-    $ intro_padding = ""
-    $if path:
-        $ intro_padding = padding
-    $ path = path + "/" + crumb_path
-    <span>\
-    $if crumb_icon:
-        <span class="crumb-icon-$crumb_icon"></span>&thinsp;\
-    $:intro_padding<a href=$path \
-    $if crumb_classes:
-        class="$' '.join(crumb_classes)"
-    rel="$ups">$:crumb_title</a>\
-    $:padding<span class=crumb-sep>$:separator</span></span>\
+$if len(fullparts) > 1:
+    <nav class=breadcrumbs>
+    $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
+        $ ups = " ".join(["up"] * remaining)
+        $ remaining = remaining - 1
+        $ intro_padding = ""
+        $if path:
+            $ intro_padding = padding
+        $ path = path + "/" + crumb_path
+        <span>\
+        $if crumb_icon:
+            <span class="crumb-icon-$crumb_icon"></span>&thinsp;\
+        $:intro_padding<a href=$path \
+        $if crumb_classes:
+            class="$' '.join(crumb_classes)"
+        rel="$ups">$:crumb_title</a>\
+        $:padding<span class=crumb-sep>$:separator</span></span>\
+    </nav>