From 69c5fe38917b0b746cbb8fc1ee44dd3c171fa152 Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Fri, 24 Sep 2010 20:30:09 +0100 Subject: [PATCH] Add a base URL to the template context, fix the notmyidea theme to be a bit more prettier. --- TODO | 1 + pelican/generator.py | 9 ++++++--- samples/themes/notmyidea/css/main.css | 18 ++++++----------- .../themes/notmyidea/templates/article.html | 4 +++- samples/themes/notmyidea/templates/base.html | 20 ++++++++++--------- .../notmyidea/templates/categories.html | 8 ++++++++ .../themes/notmyidea/templates/category.html | 1 + samples/themes/notmyidea/templates/index.html | 3 ++- 8 files changed, 38 insertions(+), 26 deletions(-) diff --git a/TODO b/TODO index 14983a79..8bc97c0a 100644 --- a/TODO +++ b/TODO @@ -2,3 +2,4 @@ * Find a way to extend the existing templates instead of rewriting all from scratch. * update the templates for notmyidea. +* put the output base folder in some variable diff --git a/pelican/generator.py b/pelican/generator.py index 184ca036..017c7bfd 100644 --- a/pelican/generator.py +++ b/pelican/generator.py @@ -26,7 +26,7 @@ _DEFAULT_CONFIG = {'PATH': None, 'FEED': 'feeds/all.atom.xml', 'CATEGORY_FEED': 'feeds/%s.atom.xml', 'BLOGNAME': 'A Pelican Blog', - 'BLOGURL': ''} + } def generate_output(path=None, theme=None, output_path=None, markup=None, @@ -52,7 +52,7 @@ def generate_output(path=None, theme=None, output_path=None, markup=None, # get the list of files to parse if not path: - raise Exception('you need to speciffy a path to search the docs on !') + raise Exception('you need to specify a path to search the docs on !') files = [] for root, dirs, temp_files in os.walk(path, followlinks=True): files.extend([os.sep.join((root, f)) for f in temp_files @@ -89,10 +89,13 @@ def generate_output(path=None, theme=None, output_path=None, markup=None, value = value.items() context[item] = value + if 'BLOGURL' not in context: + context['BLOGURL'] = output_path + # generate the output generate = partial(generate_file, output_path) for template in _DIRECT_TEMPLATES: - generate('%s.html' % template, templates[template], context) + generate('%s.html' % template, templates[template], context, blog=True) for tag in tags: generate('tag/%s.html' % tag, templates['tag'], context, tag=tag) for cat in categories: diff --git a/samples/themes/notmyidea/css/main.css b/samples/themes/notmyidea/css/main.css index 459eafdf..4431f59d 100644 --- a/samples/themes/notmyidea/css/main.css +++ b/samples/themes/notmyidea/css/main.css @@ -34,6 +34,7 @@ h2, h3, h4, h5, h6 { font-weight: 400; line-height: 1.1; margin-bottom: .8em; + margin-top: .8em; } /* Anchors */ @@ -323,7 +324,7 @@ img.left, figure.left {float: right; margin: 0 0 2em 2em;} li:last-child .hentry, #content > .hentry {border: 0; margin: 0;} #content > .hentry {padding: 1em 0;} -.entry-title {font-size: 1.429em; margin-bottom: 0;} +.entry-title {font-size: 1.429em; margin-bottom: 5px; margin-top: 0; } .entry-title a:link, .entry-title a:visited {text-decoration: none;} .hentry .post-info * {font-style: normal;} @@ -335,20 +336,13 @@ li:last-child .hentry, #content > .hentry {border: 0; margin: 0;} /* Blog Index */ #posts-list {list-style: none; margin: 0;} - #posts-list .hentry {padding-left: 200px; position: relative;} - #posts-list .hentry:hover { - background: #C64350; - color: #fff; - } - #posts-list .hentry:hover a:link, #posts-list .hentry:hover a:visited { - color: #F6CF74; - text-shadow: 1px 1px 1px #333; - } + #posts-list .hentry {padding-left: 10px; position: relative;} #posts-list footer { left: 10px; - position: absolute; - top: 1.5em; + position: relative; + float: left; + top: 0.5em; width: 190px; } diff --git a/samples/themes/notmyidea/templates/article.html b/samples/themes/notmyidea/templates/article.html index a9755195..3bc28f47 100644 --- a/samples/themes/notmyidea/templates/article.html +++ b/samples/themes/notmyidea/templates/article.html @@ -1,7 +1,9 @@ {% extends "base.html" %} {% block content %}
+

{{ article.title }}

+
-
{{ article.content }}
+
{% endblock %} diff --git a/samples/themes/notmyidea/templates/base.html b/samples/themes/notmyidea/templates/base.html index 59508385..503f57d2 100644 --- a/samples/themes/notmyidea/templates/base.html +++ b/samples/themes/notmyidea/templates/base.html @@ -3,19 +3,19 @@ {% block title %}{{ BLOGNAME }}{%endblock%} - - + + + + + @@ -24,10 +24,12 @@ {% block content %} @@ -38,7 +40,7 @@

blogroll

@@ -47,7 +49,7 @@

social