i18n date display, short date format setting, comma between multiple authors.

This commit is contained in:
Ahmet Bakan 2014-09-10 21:14:35 -07:00
parent f5a8f5ce58
commit 1112610724
7 changed files with 16 additions and 15 deletions

View file

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
"""Classes for handling posts and archives."""
import os
@ -52,6 +53,7 @@ CONFIG = [
('fontawesome_css_file', False, True),
('post_date_format', '%b %d, %Y', True),
('post_date_format_short', '%b %d', True),
('post_auto_image', 0, True),
('post_auto_excerpt', 1, True),
('post_redirect_refresh', 5, True),

View file

@ -185,7 +185,7 @@ def process_posts(app, doctree):
except ValueError:
raise ValueError('invalid post update date in: ' + docname)
un[0].replace_self(nodes.title('', str(un[0][0]) + ' ' +
un[0].replace_self(nodes.title(u'', un[0][0].astext() + u' ' +
update.strftime(pdf)))
# for now, let updates look like note
un['classes'] = ['note', 'update']
@ -335,7 +335,7 @@ def process_postlist(app, doctree, docname):
if True:
par.append(nodes.Text(
post.date.strftime(blog.post_date_format) + ' - '))
post.date.strftime(_(blog.post_date_format)) + ' - '))
bli.append(par)
ref = nodes.reference()

View file

@ -36,10 +36,10 @@
<ul class="ablog-archive">
<li>{% if post.published %}
{% if fa %}<i class="fa fa-calendar"></i>{% endif %}
{{ post.date.strftime("%b %d, %Y") }}
{{ post.date.strftime(gettext(ablog.post_date_format)) }}
{% else %}
{% if fa %}<i class="fa fa-pencil"></i>{% endif %}
{% if post.date %}{{ post.date.strftime("%b %d, %Y") }}
{% if post.date %}{{ post.date.strftime(gettext(ablog.post_date_format)) }}
{% else %} Draft {% endif %}
{% endif %}
</li>

View file

@ -4,10 +4,10 @@
<h2>
{% if post.published %}
{% if fa %}<i class="fa fa-calendar"></i>{% endif %}
{{ post.date.strftime("%b %d, %Y") }}
{{ post.date.strftime(gettext(ablog.post_date_format)) }}
{% else %}
{% if fa %}<i class="fa fa-pencil"></i>{% endif %}
{% if post.date %}{{ post.date.strftime("%b %d, %Y") }}
{% if post.date %}{{ post.date.strftime(gettext(ablog.post_date_format)) }}
{% else %} Draft {% endif %}
{% endif %}
</h2>

View file

@ -1,15 +1,14 @@
{% if post.published and post.date != post.update %}
<li>{% if fa %}<i class="fa fa-pencil-square-o"></i>{% else %}{{ gettext('Update') }}:{% endif %}
{{ post.update.strftime("%b %d, %Y") }}</li>
{{ post.update.strftime(gettext(ablog.post_date_format)) }}</li>
{% endif %}
{% if post.author %}
<li>{% if fa %}<i class="fa-fw fa fa-user"></i>{% else %}{{ gettext('Author') }}:{% endif %}
{% for coll in post.author %}
{% if coll|length %}
<a href="{{ pathto(coll.docname) }}">{{ coll }}</a>
{% else %}{{ coll }}{% endif %}
{% if loop.index < post.author|length %}<br>{% endif %}
<a href="{{ pathto(coll.docname) }}">{{ coll }}</a>{% if loop.index < post.author|length %},{% endif %}
{% else %}{{ coll }}{% if loop.index < post.author|length %},{% endif %}{% endif %}
{% endfor %}</li>
{% endif %}
@ -17,9 +16,8 @@
<li>{% if fa %}<i class="fa-fw fa fa-location-arrow"></i>{% else %}{{ gettext('Location') }}:{% endif %}
{% for coll in post.location %}
{% if coll|length %}
<a href="{{ pathto(coll.docname) }}">{{ coll }}</a>
{% else %}{{ coll }}{% endif %}
{% if loop.index < post.location|length %}<br>{% endif %}
<a href="{{ pathto(coll.docname) }}">{{ coll }}</a>{% if loop.index < post.location|length %},{% endif %}
{% else %}{{ coll }}{% if loop.index < post.location|length %},{% endif %}{% endif %}
{% endfor %}</li>
{% endif %}

View file

@ -3,7 +3,7 @@
<ul>
{% set pcount = 1 %}
{% for recent in ablog.recent(5, pagename) %}
<li><a href="{{ pathto(recent.docname) }}{{ anchor(recent) }}">{{ recent.date.strftime("%b %d") + " - " + recent.title }}</a></li>
<li><a href="{{ pathto(recent.docname) }}{{ anchor(recent) }}">{{ recent.date.strftime(gettext(ablog.post_date_format_short)) + " - " + recent.title }}</a></li>
{% endfor %}
</ul>
{% endif %}

View file

@ -19,7 +19,8 @@ extensions = [
'ablog'
]
#language = 'de'
#language = 'tr'
# PROJECT
version = release = ablog.__version__