X-Git-Url: https://git.llucax.com/personal/website.git/blobdiff_plain/651c9404608ef9024f79a6d7d318a69ae7f9f0bc..1453a4609aa57e8a23beae626e4416468436824d:/source/blog/blog.cgi
diff --git a/source/blog/blog.cgi b/source/blog/blog.cgi
index f59201a..ba9db9f 100755
--- a/source/blog/blog.cgi
+++ b/source/blog/blog.cgi
@@ -982,6 +982,7 @@ class Article (object):
'uuid': self.uuid,
'tags': self.get_tags_links(),
'comments': len(self.comments),
+ 'flattrbtn': self.get_flattr_btn(),
'created': self.created.isoformat(' '),
'ciso': self.created.isoformat(),
@@ -1011,6 +1012,33 @@ class Article (object):
(blog_url, urllib.quote(t), sanitize(t) ))
return ', '.join(l)
+ def get_flattr_btn(self):
+ v = dict()
+ v['tags'] = ','.join([sanitize(tag) for tag in self.tags])
+ v['tags'] = v['tags'].replace('"', '-').replace(':', '-')
+ v['tags'] = v['tags'].replace(';', '-')
+ v['title'] = sanitize(self.title)
+ v['qtitle'] = title.replace('"', '')
+ v['url'] = full_url + '/post/' + self.uuid
+ v['furl'] = 'https://flattr.com/submit/auto?' + urllib.urlencode(
+ dict(user_id='llucax', url=v['url'],
+ title=self.title,
+ description="Blog article titled: " +
+ self.title,
+ language='en', tags=','.join(self.tags),
+ category='text'))
+ return '''
+Blog article titled: %(title)s
+
+''' % v
+
class ArticleDB (object):
def __init__(self, dbpath):