add tidbits macro and tagicon macro

add stub for icon selecting function
M muyhomepage2/app/build.py +3 -0
@@ 25,6 25,9 @@ class TemplateConfig(configuration.Confi
             self._jenv = jinja2.Environment(loader=self.templateloader())
         return self._jenv
 
+    def besticon(self, tags):
+        return None
+
 
 def build(config):
     website = site.Site()

          
M muyhomepage2/pagehandlers/handler.py +4 -0
@@ 8,6 8,10 @@ class PageHandler(object):
     def content(self):
         raise NotImplementedError('PageHandler.content')
 
+    @property
+    def tags(self):
+        return sorted(self.page.tags)
+
     def finalname(self):
         if 'x-force-file-name' in self.page.headers:
             return self.page.headers['x-force-file-name']

          
M muyhomepage2/site.py +8 -0
@@ 1,5 1,6 @@ 
 
 import os
+from muyhomepage2 import util
 from muyhomepage2 import page
 from muyhomepage2 import metadata
 

          
@@ 22,6 23,13 @@ class Site(object):
                 tmap.setdefault(tag, []).append(page)
         return tmap
 
+    def taglink(self, tag):
+        for page in self.pages:
+            if page.title == ('Tag:%s' % tag):
+                return './%s.html' % util.encodetitle(page.title)
+        return None
+
+
 
 def write_site_pages(wsite, filename):
     pdata = ((p.filename, p.contentcode, p.title, p.action)

          
M skins/default/base.html +15 -1
@@ 105,7 105,21 @@ 
   </div>
 
   <!-- begin main content section -->
-  <div id="page-main">{% block main %}{% endblock %}
+  <div id="page-main">
+  {% block main %}
+  {% macro tidbits(_current) %}
+    <ul class="tidbits">
+      <li>
+          <a href="mailto:phglogistonjohn+web@gmail.com?={{_current.page.title}}">
+              Comment on {{_current.page.title}}
+          </a>
+      </li>
+      <li>
+          <!-- repeat tidbits -->
+      </li>
+    </ul>
+  {% endmacro %}
+  {% endblock %}
   </div>
   <!-- end main content section -->
 

          
A => skins/default/components.html +38 -0
@@ 0,0 1,38 @@ 
+
+{% macro tidbits(curr, ws) %}
+<!-- SUBSECTION BEGIN(tidbits) -->
+<ul class="tidbits">
+  <li>
+      <a href="mailto:phglogistonjohn+web@gmail.com?={{curr.page.title}}">
+          Comment on {{curr.page.title}}
+      </a>
+  </li>
+  <li>Created: <span class="value">{{curr.createdon}}</span></li>
+  <li>Modified: <span class="value">{{curr.modifiedon}}</span></li>
+  <li>
+    <a href="./all-tags.html">Tags</a>:
+    <span class="value">
+      {% for tag in curr.tags %}
+        <span class="pagetag">{% if ws.taglink(tag) -%}
+        <a href="{{ws.taglink(tag)}}">{{tag}}</a>{% else -%}
+        {{tag}}{% endif -%}
+        </span>{% if not loop.last -%},{% endif %}
+      {% endfor %}
+    </span>
+  </li>
+
+</ul>
+<!-- SUBSECTION END(tidbits) -->
+{% endmacro %}
+
+{% macro tagicon(curr, conf) %}
+<!-- SUBSECTION BEGIN(tagicon) -->
+{% if conf.besticon(curr.tags) %}
+<div class="tagicon">
+   {% set tag, icon = conf.besticon(curr.tags) %}
+  <img src="{{icon}}" alt="{{tag}}"></img>
+  <div class="caption">{{tag}}</div>
+</div>
+{% endif %}
+<!-- SUBSECTION END(tagicon) -->
+{% endmacro %}

          
M skins/default/page.html +4 -10
@@ 1,23 1,17 @@ 
 {% extends "base.html" %}
+{% import "components.html" as components %}
 
 {% block main %}
 <div id="page-content">
   <h2>{{current.page.title}}</h2>
+  {{ components.tagicon(current, config) }}
+
   <div></div>
   <div class="written-text">
     {{current.content()}}
   </div>
   <div></div>
 
-  <ul class="tidbits">
-    <li>
-        <a href="mailto:phglogistonjohn+web@gmail.com?={{current.page.title}}">
-            Comment on {{current.page.title}}
-        </a>
-    </li>
-    <li>
-        <!-- repeat tidbits -->
-    </li>
-  </ul>
+  {{ components.tidbits(current, site) }}
 </div>
 {% endblock %}