From 16bc830b1965222e87c624ce2105f4a153392a2d Mon Sep 17 00:00:00 2001 From: RealOrangeOne Date: Fri, 1 Jul 2016 09:18:55 +0100 Subject: [PATCH] format titles better --- pelicanconf.py | 3 ++- plugins/filters.py | 5 +++++ theme/templates/category.html | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pelicanconf.py b/pelicanconf.py index e4d834b..64a0ad1 100644 --- a/pelicanconf.py +++ b/pelicanconf.py @@ -79,5 +79,6 @@ import filters JINJA_FILTERS = { "datetime": filters.format_datetime, "category_find": filters.category_find, - "limit": filters.limit + "limit": filters.limit, + "format_title": filters.format_title } diff --git a/plugins/filters.py b/plugins/filters.py index a778c89..3abfac0 100644 --- a/plugins/filters.py +++ b/plugins/filters.py @@ -16,3 +16,8 @@ def limit(line, length): if len(line) <= length: return line return " ".join(line.split(" ")[:length]) + '...' + + +def format_title(value): + space_split = " ".join(value.split("-")) + return space_split.title() diff --git a/theme/templates/category.html b/theme/templates/category.html index 0846d74..3acc878 100644 --- a/theme/templates/category.html +++ b/theme/templates/category.html @@ -15,7 +15,7 @@
-

{{ category.name|title }}

+

{{ category.name|format_title }}