X-Git-Url: https://git.llucax.com/personal/website.git/blobdiff_plain/82c67a166ee0d3d8893c3ae1e84f91f067045fd0..cddf1e6a31cc396ac3bf6b5daa83a2958a6a9838:/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):