mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Add a base URL to the template context, fix the notmyidea theme to be a bit more
prettier.
This commit is contained in:
parent
ecd9a83ac8
commit
69c5fe3891
8 changed files with 38 additions and 26 deletions
1
TODO
1
TODO
|
|
@ -2,3 +2,4 @@
|
||||||
* Find a way to extend the existing templates instead of rewriting all from
|
* Find a way to extend the existing templates instead of rewriting all from
|
||||||
scratch.
|
scratch.
|
||||||
* update the templates for notmyidea.
|
* update the templates for notmyidea.
|
||||||
|
* put the output base folder in some variable
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ _DEFAULT_CONFIG = {'PATH': None,
|
||||||
'FEED': 'feeds/all.atom.xml',
|
'FEED': 'feeds/all.atom.xml',
|
||||||
'CATEGORY_FEED': 'feeds/%s.atom.xml',
|
'CATEGORY_FEED': 'feeds/%s.atom.xml',
|
||||||
'BLOGNAME': 'A Pelican Blog',
|
'BLOGNAME': 'A Pelican Blog',
|
||||||
'BLOGURL': ''}
|
}
|
||||||
|
|
||||||
|
|
||||||
def generate_output(path=None, theme=None, output_path=None, markup=None,
|
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
|
# get the list of files to parse
|
||||||
if not path:
|
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 = []
|
files = []
|
||||||
for root, dirs, temp_files in os.walk(path, followlinks=True):
|
for root, dirs, temp_files in os.walk(path, followlinks=True):
|
||||||
files.extend([os.sep.join((root, f)) for f in temp_files
|
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()
|
value = value.items()
|
||||||
context[item] = value
|
context[item] = value
|
||||||
|
|
||||||
|
if 'BLOGURL' not in context:
|
||||||
|
context['BLOGURL'] = output_path
|
||||||
|
|
||||||
# generate the output
|
# generate the output
|
||||||
generate = partial(generate_file, output_path)
|
generate = partial(generate_file, output_path)
|
||||||
for template in _DIRECT_TEMPLATES:
|
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:
|
for tag in tags:
|
||||||
generate('tag/%s.html' % tag, templates['tag'], context, tag=tag)
|
generate('tag/%s.html' % tag, templates['tag'], context, tag=tag)
|
||||||
for cat in categories:
|
for cat in categories:
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ h2, h3, h4, h5, h6 {
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
line-height: 1.1;
|
line-height: 1.1;
|
||||||
margin-bottom: .8em;
|
margin-bottom: .8em;
|
||||||
|
margin-top: .8em;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Anchors */
|
/* 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;}
|
li:last-child .hentry, #content > .hentry {border: 0; margin: 0;}
|
||||||
#content > .hentry {padding: 1em 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;}
|
.entry-title a:link, .entry-title a:visited {text-decoration: none;}
|
||||||
|
|
||||||
.hentry .post-info * {font-style: normal;}
|
.hentry .post-info * {font-style: normal;}
|
||||||
|
|
@ -335,20 +336,13 @@ li:last-child .hentry, #content > .hentry {border: 0; margin: 0;}
|
||||||
|
|
||||||
/* Blog Index */
|
/* Blog Index */
|
||||||
#posts-list {list-style: none; margin: 0;}
|
#posts-list {list-style: none; margin: 0;}
|
||||||
#posts-list .hentry {padding-left: 200px; position: relative;}
|
#posts-list .hentry {padding-left: 10px; 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 footer {
|
#posts-list footer {
|
||||||
left: 10px;
|
left: 10px;
|
||||||
position: absolute;
|
position: relative;
|
||||||
top: 1.5em;
|
float: left;
|
||||||
|
top: 0.5em;
|
||||||
width: 190px;
|
width: 190px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<section id="content" class="body">
|
<section id="content" class="body">
|
||||||
|
<div class="hentry">
|
||||||
<header> <h2 class="entry-title"><a href="{{ article.url }}" rel="bookmark" title="Permalink to {{ article.title}}">{{ article.title }}</a></h2> </header>
|
<header> <h2 class="entry-title"><a href="{{ article.url }}" rel="bookmark" title="Permalink to {{ article.title}}">{{ article.title }}</a></h2> </header>
|
||||||
|
<div class="entry-content">
|
||||||
<footer class="post-info">
|
<footer class="post-info">
|
||||||
<abbr class="published" title="{{ article.date.isoformat() }}">
|
<abbr class="published" title="{{ article.date.isoformat() }}">
|
||||||
{{ article.date.strftime('%Y-%m-%d %H:%M') }}
|
{{ article.date.strftime('%Y-%m-%d %H:%M') }}
|
||||||
|
|
@ -10,8 +12,8 @@
|
||||||
By <a class="url fn" href="#">{{ article.author }}</a>
|
By <a class="url fn" href="#">{{ article.author }}</a>
|
||||||
</address>
|
</address>
|
||||||
</footer><!-- /.post-info -->
|
</footer><!-- /.post-info -->
|
||||||
<div class="entry-content">
|
|
||||||
{{ article.content }}
|
{{ article.content }}
|
||||||
</div><!-- /.entry-content -->
|
</div><!-- /.entry-content -->
|
||||||
|
</div>
|
||||||
</section>
|
</section>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
||||||
|
|
@ -3,19 +3,19 @@
|
||||||
<head>
|
<head>
|
||||||
<title>{% block title %}{{ BLOGNAME }}{%endblock%}</title>
|
<title>{% block title %}{{ BLOGNAME }}{%endblock%}</title>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<link rel="stylesheet" href="css/main.css" type="text/css" />
|
<link rel="stylesheet" href="{{ BLOGURL }}/css/main.css" type="text/css" />
|
||||||
<link href="atom.xml" type="application/atom+xml" rel="alternate" title="{{ BLOGNAME }} ATOM Feed" />
|
<link href="atom.xml" type="{{ BLOGURL }}/application/atom+xml" rel="alternate" title="{{ BLOGNAME }} ATOM Feed" />
|
||||||
|
|
||||||
|
|
||||||
<!--[if IE]>
|
<!--[if IE]>
|
||||||
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
|
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
|
||||||
|
|
||||||
<!--[if lte IE 7]>
|
<!--[if lte IE 7]>
|
||||||
<link rel="stylesheet" type="text/css" media="all" href="css/ie.css"/>
|
<link rel="stylesheet" type="text/css" media="all" href="{{ BLOGURL }}/css/ie.css"/>
|
||||||
<script src="js/IE8.js" type="text/javascript"></script><![endif]-->
|
<script src="{{ BLOGURL }}/js/IE8.js" type="text/javascript"></script><![endif]-->
|
||||||
|
|
||||||
<!--[if lt IE 7]>
|
<!--[if lt IE 7]>
|
||||||
<link rel="stylesheet" type="text/css" media="all" href="css/ie6.css"/><![endif]-->
|
<link rel="stylesheet" type="text/css" media="all" href="{{ BLOGURL }}/css/ie6.css"/><![endif]-->
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
@ -24,10 +24,12 @@
|
||||||
<header id="banner" class="body">
|
<header id="banner" class="body">
|
||||||
<h1><a href="#">{{ BLOGNAME }} <strong>{{ BLOGSUBTITLE }}</strong></a></h1>
|
<h1><a href="#">{{ BLOGNAME }} <strong>{{ BLOGSUBTITLE }}</strong></a></h1>
|
||||||
<nav><ul>
|
<nav><ul>
|
||||||
<li class="active"><a href="{{ BLOGURL }}">blog</a></li>
|
|
||||||
{% for title, link in MENUITEMS %}
|
{% for title, link in MENUITEMS %}
|
||||||
<li><a href="{{ link }}">{{ title }}</a></li>
|
<li><a href="{{ link }}">{{ title }}</a></li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
{% for cat, null in categories %}
|
||||||
|
<li {% if cat == category %}class="active"{% endif %}><a href="{{ BLOGURL }}/category/{{ cat }}.html">{{ cat }}</a></li>
|
||||||
|
{% endfor %}
|
||||||
</ul></nav>
|
</ul></nav>
|
||||||
</header><!-- /#banner -->
|
</header><!-- /#banner -->
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
@ -38,7 +40,7 @@
|
||||||
<h2>blogroll</h2>
|
<h2>blogroll</h2>
|
||||||
<ul>
|
<ul>
|
||||||
{% for name, link in BLOGROLL %}
|
{% for name, link in BLOGROLL %}
|
||||||
<li><a href="{{ link }}">{{ name }}</a></li>
|
<li><a href="{{ BLOGURL }}/{{ link }}">{{ name }}</a></li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</div><!-- /.blogroll -->
|
</div><!-- /.blogroll -->
|
||||||
|
|
@ -47,7 +49,7 @@
|
||||||
<div class="social">
|
<div class="social">
|
||||||
<h2>social</h2>
|
<h2>social</h2>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="atom.xml" rel="alternate">atom feed</a></li>
|
<li><a href="{{ BLOGURL }}/atom.xml" rel="alternate">atom feed</a></li>
|
||||||
{% for name, link in SOCIAL %}
|
{% for name, link in SOCIAL %}
|
||||||
<li><a href="{{ link }}">{{ name }}</a></li>
|
<li><a href="{{ link }}">{{ name }}</a></li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
@ -58,7 +60,7 @@
|
||||||
|
|
||||||
<footer id="contentinfo" class="body">
|
<footer id="contentinfo" class="body">
|
||||||
<address id="about" class="vcard body">
|
<address id="about" class="vcard body">
|
||||||
Proudly powered by <a href="#">pelican</a>, which takes great advantages of <a href="http://python.org">python</a>.
|
Proudly powered by <a href="http://hg.lolnet.org/pelican/">pelican</a>, which takes great advantages of <a href="http://python.org">python</a>.
|
||||||
</address><!-- /#about -->
|
</address><!-- /#about -->
|
||||||
|
|
||||||
<p>The theme is by<a href="http://smashingmagazine.com">Smashing Magazine</a>, thanks!</p>
|
<p>The theme is by<a href="http://smashingmagazine.com">Smashing Magazine</a>, thanks!</p>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
{% block content %}
|
||||||
|
<ul>
|
||||||
|
{% for category, articles in categories %}
|
||||||
|
<li>{{ category }}</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% endblock %}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
{% extends "index.html" %}
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
{% block content_title %}{% endblock %}
|
||||||
{% for article in articles %}
|
{% for article in articles %}
|
||||||
{% if loop.index == 1 %}
|
{% if loop.index == 1 %}
|
||||||
<aside id="featured" class="body"><article>
|
<aside id="featured" class="body"><article>
|
||||||
|
|
@ -14,6 +15,7 @@
|
||||||
<h2 class="entry-title"><a href="{{ article.url }}" rel="bookmark" title="Permalink to {{ article.title}}">{{ article.title }}</a></h2>
|
<h2 class="entry-title"><a href="{{ article.url }}" rel="bookmark" title="Permalink to {{ article.title}}">{{ article.title }}</a></h2>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
|
<div class="entry-content">
|
||||||
<footer class="post-info">
|
<footer class="post-info">
|
||||||
<abbr class="published" title="{{ article.date.isoformat() }}">
|
<abbr class="published" title="{{ article.date.isoformat() }}">
|
||||||
{{ article.date.strftime('%Y-%m-%d %H:%M') }}
|
{{ article.date.strftime('%Y-%m-%d %H:%M') }}
|
||||||
|
|
@ -23,7 +25,6 @@
|
||||||
By <a class="url fn" href="#">{{ article.author }}</a>
|
By <a class="url fn" href="#">{{ article.author }}</a>
|
||||||
</address>
|
</address>
|
||||||
</footer><!-- /.post-info -->
|
</footer><!-- /.post-info -->
|
||||||
<div class="entry-content">
|
|
||||||
{{ article.summary }}
|
{{ article.summary }}
|
||||||
</div><!-- /.entry-content -->
|
</div><!-- /.entry-content -->
|
||||||
</article></li>
|
</article></li>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue