Christian Jann committed 5103ead

Temporary fixed the handling of special characters in tags e.g. "µC" inside the tagcloud sidebar

"µC" tag with the "|lower"-filter does not work because the resulting html file is named "_c.html"
and not "µc.html", I've just added a second array with taglinks, but it would be better to
replace all "|lower" filters in the templates with an custom "|cleanurl"-filter, witch uses
the same function that is used to generate the filenames e.g. utils.name_from_title.

But adding an filter inside like
"env.filters['cleanurl'] = utils.name_from_title" hasn't worked:
"TemplateAssertionError: no filter named 'cleanurl'".

What now?

  • Participants
  • Parent commits 1bcc4e3

Comments (0)

Files changed (3)


 from sphinx.util.compat import Directive
 import tinkerer
 from tinkerer.ext.uistr import UIStr
+from tinkerer.utils import name_from_title
             in env.blog_posts[:20]]
     # tags & categories
     tags = dict((t, 0) for t in env.filing["tags"])
+    taglinks = dict((t, name_from_title(t)) for t in env.filing["tags"])
     categories = dict((c, 0) for c in env.filing["categories"])
     for post in env.blog_posts:
         p = env.blog_metadata[post]
         for cat in p.filing["categories"]:
             categories[cat[1]] += 1
     context["tags"] = tags
+    context["taglinks"] = taglinks
     context["categories"] = categories
     # if there is metadata for the page, it is not an auto-generated one


     {%- set count_max = tags.values()|sort|last %}
     {%- for tag, x in tags|dictsort %}
       {%- set size = (fontsize_max-fontsize_min)*(x-count_min)/(count_max-count_min) + fontsize_min %}
-      <a href="{{ pathto('tags/' + tag|lower) }}" style="font-size: {{ size|int }}pt">{{ tag }}</a>
+      <a href="{{ pathto('tags/' + taglinks[tag]) }}" style="font-size: {{ size|int }}pt">{{ tag }}</a>
       {%- if not loop.last %}&nbsp;&nbsp;{%- endif %}
     {%- endfor %}


 # jinja environment
 env = Environment(loader=PackageLoader("tinkerer", "__templates"))
+#env.filters['cleanurl'] = utils.name_from_title
 def render(template, destination, context={}):