Added a simple plugin interface
This commit is contained in:
parent
2f74887f62
commit
e7d313cdc4
13
blogthon.cgi
13
blogthon.cgi
@ -101,6 +101,11 @@ except: errorpage('"staticpages_dir" is missing in configuration!')
|
||||
if not os.path.exists(staticpages_dir):
|
||||
errorpage('"staticpages_dir" does not exist!')
|
||||
|
||||
try: plugins_dir = configuration.get('personal', 'plugins_dir')
|
||||
except: errorpage('"plugins_dir" is missing in configuration!')
|
||||
if not os.path.exists(plugins_dir):
|
||||
errorpage('"plugins_dir" does not exist!')
|
||||
|
||||
try: style = configuration.get('look', 'style')
|
||||
except: errorpage('"style" is missing in configuration!')
|
||||
|
||||
@ -306,6 +311,12 @@ else:
|
||||
print ' </head>'
|
||||
print ' <body>'
|
||||
print ''
|
||||
|
||||
# Plugins
|
||||
sys.path.append(plugins_dir)
|
||||
for plugin in glob.glob(plugins_dir + '*.py'):
|
||||
__import__ (plugin.split('/')[1].replace('.py', ''))
|
||||
|
||||
# Site header
|
||||
print ' <div class="header">'
|
||||
print ' <div class="header_title">'
|
||||
@ -316,6 +327,7 @@ else:
|
||||
print ' </div>'
|
||||
print ' </div>'
|
||||
print ''
|
||||
|
||||
# RSS feed
|
||||
print ' <div class="rss">'
|
||||
if os.path.exists('styles/' + style.replace('.css', '') + '_img/rss.jpg'):
|
||||
@ -324,6 +336,7 @@ else:
|
||||
print ' <a href="?feed=rss" class="rss_link">rss</a>'
|
||||
print ' </div>'
|
||||
print ''
|
||||
|
||||
# Atom feed
|
||||
print ' <div class="atom">'
|
||||
if os.path.exists('styles/' + style.replace('.css', '') + '_img/atom.jpg'):
|
||||
|
@ -6,6 +6,7 @@ keywords: please,change,me
|
||||
entries_dir: entries/
|
||||
entries_suffix: txt
|
||||
staticpages_dir: static/
|
||||
plugins_dir: plugins/
|
||||
|
||||
[look]
|
||||
style: blogthon_noir.css
|
||||
|
16
plugins/plugin_example.py
Normal file
16
plugins/plugin_example.py
Normal file
@ -0,0 +1,16 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# This program is free software. It comes without any warranty, to
|
||||
# the extent permitted by applicable law. You can redistribute it
|
||||
# and/or modify it under the terms of the Do What The Fuck You Want
|
||||
# To Public License, Version 2, as published by Sam Hocevar. See
|
||||
# http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
|
||||
# Author: Stefan Ritter <xeno@thehappy.de>
|
||||
# Description: Example plugin
|
||||
|
||||
print ' <span style="position: absolute; top: 0px; right: 0px; color: #666666; font-size: 10px;">'
|
||||
print ' This blog is powered by Blogthon! '
|
||||
print ' </span>'
|
||||
print ''
|
Loading…
Reference in New Issue
Block a user