many many many Varia's websites, work in progress: https://many.vvvvvvaria.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
mb@mb 04c2824180 adding the 2 submodules again 7 years ago
..
Readme.rst adding the 2 submodules again 7 years ago
__init__.py adding the 2 submodules again 7 years ago
dateish.py adding the 2 submodules again 7 years ago

Readme.rst

Dateish Plugin for Pelican
==========================

This plugin adds the ability to treat arbitrary metadata fields as datetime
objects.

Usage
-----

For example, if you have the following pieces of metadata in an article:

.. code-block:: markdown

# my_article.markdown
Date: 2000-01-01
Idea_Date: 1993-03-04
Important_Dates: 2013-10-12
2013-11-08
2013-12-02

Normally, the Idea_Date and Important_Dates variables will be strings, so
you will not be able to use the strftime() Jinja filter on them.

With this plugin, you define in your settings file a list of the names of
the additional metadata fields you want to treat as dates:

.. code-block:: python

# pelicanconf.py
DATEISH_PROPERTIES = ['idea_date', 'important_dates']

Then you can use them in templates just like date:

.. code-block:: html+jinja

# mytemplate.html
<p>Idea date: {{ article.idea_date | strftime('%d %B %Y') }}</p>
{% for d in article.important_dates %}
<p>Important date: {{ d | strftime('%d %B %Y') }}</p>
{% endfor %}