forked from github/pelican
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
|
||||
scratch.
|
||||
* 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',
|
||||
'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:
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<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>
|
||||
<div class="entry-content">
|
||||
<footer class="post-info">
|
||||
<abbr class="published" title="{{ article.date.isoformat() }}">
|
||||
{{ article.date.strftime('%Y-%m-%d %H:%M') }}
|
||||
|
|
@ -10,8 +12,8 @@
|
|||
By <a class="url fn" href="#">{{ article.author }}</a>
|
||||
</address>
|
||||
</footer><!-- /.post-info -->
|
||||
<div class="entry-content">
|
||||
{{ article.content }}
|
||||
</div><!-- /.entry-content -->
|
||||
</div>
|
||||
</section>
|
||||
{% endblock %}
|
||||
|
|
|
|||
|
|
@ -3,19 +3,19 @@
|
|||
<head>
|
||||
<title>{% block title %}{{ BLOGNAME }}{%endblock%}</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="css/main.css" type="text/css" />
|
||||
<link href="atom.xml" type="application/atom+xml" rel="alternate" title="{{ BLOGNAME }} ATOM Feed" />
|
||||
<link rel="stylesheet" href="{{ BLOGURL }}/css/main.css" type="text/css" />
|
||||
<link href="atom.xml" type="{{ BLOGURL }}/application/atom+xml" rel="alternate" title="{{ BLOGNAME }} ATOM Feed" />
|
||||
|
||||
|
||||
<!--[if IE]>
|
||||
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
|
||||
|
||||
<!--[if lte IE 7]>
|
||||
<link rel="stylesheet" type="text/css" media="all" href="css/ie.css"/>
|
||||
<script src="js/IE8.js" type="text/javascript"></script><![endif]-->
|
||||
<link rel="stylesheet" type="text/css" media="all" href="{{ BLOGURL }}/css/ie.css"/>
|
||||
<script src="{{ BLOGURL }}/js/IE8.js" type="text/javascript"></script><![endif]-->
|
||||
|
||||
<!--[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>
|
||||
|
||||
|
|
@ -24,10 +24,12 @@
|
|||
<header id="banner" class="body">
|
||||
<h1><a href="#">{{ BLOGNAME }} <strong>{{ BLOGSUBTITLE }}</strong></a></h1>
|
||||
<nav><ul>
|
||||
<li class="active"><a href="{{ BLOGURL }}">blog</a></li>
|
||||
{% for title, link in MENUITEMS %}
|
||||
<li><a href="{{ link }}">{{ title }}</a></li>
|
||||
{% 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>
|
||||
</header><!-- /#banner -->
|
||||
{% block content %}
|
||||
|
|
@ -38,7 +40,7 @@
|
|||
<h2>blogroll</h2>
|
||||
<ul>
|
||||
{% for name, link in BLOGROLL %}
|
||||
<li><a href="{{ link }}">{{ name }}</a></li>
|
||||
<li><a href="{{ BLOGURL }}/{{ link }}">{{ name }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div><!-- /.blogroll -->
|
||||
|
|
@ -47,7 +49,7 @@
|
|||
<div class="social">
|
||||
<h2>social</h2>
|
||||
<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 %}
|
||||
<li><a href="{{ link }}">{{ name }}</a></li>
|
||||
{% endfor %}
|
||||
|
|
@ -58,7 +60,7 @@
|
|||
|
||||
<footer id="contentinfo" class="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 -->
|
||||
|
||||
<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" %}
|
||||
{% block content %}
|
||||
{% block content_title %}{% endblock %}
|
||||
{% for article in articles %}
|
||||
{% if loop.index == 1 %}
|
||||
<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>
|
||||
</header>
|
||||
|
||||
<div class="entry-content">
|
||||
<footer class="post-info">
|
||||
<abbr class="published" title="{{ article.date.isoformat() }}">
|
||||
{{ article.date.strftime('%Y-%m-%d %H:%M') }}
|
||||
|
|
@ -23,7 +25,6 @@
|
|||
By <a class="url fn" href="#">{{ article.author }}</a>
|
||||
</address>
|
||||
</footer><!-- /.post-info -->
|
||||
<div class="entry-content">
|
||||
{{ article.summary }}
|
||||
</div><!-- /.entry-content -->
|
||||
</article></li>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue