![](/style/images/good.png)
![](/style/images/bad.png)
Pelican Add Buddhist Calendar
source link: http://siongui.github.io/2016/02/23/pelican-add-buddhist-calendar/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Pelican Add Buddhist Calendar
February 23, 2016
Use Pelican static site generator to add Buddhist calendar in your theme.
Usually the datetime format (Gregorian calendar) in the theme looks like:
{{ article.date | strftime('%B %d, %Y') }}
Now we will change Gregorian calendar to Buddhist calendar. First define a Jinja2 macro:
{% macro Buddhist_calendar(datetime) -%} {{ datetime | strftime('%B %d') }}, {{ datetime.year + 543 }} {%- endmacro %}
Use the macro in your theme by:
{{ Buddhist_calendar(article.date) }}
Tested on: Ubuntu Linux 15.10, Python 2.7.10, Pelican 3.6.3.
References:
[1]add Buddhist calendar · siongui/pelican-template@4616e29 · GitHub
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK