]> git.llucax.com Git - personal/website.git/commitdiff
Add Flattr buttons to blob and projects
authorLeandro Lucarella <luca@llucax.com.ar>
Wed, 13 Mar 2013 17:00:38 +0000 (18:00 +0100)
committerLeandro Lucarella <luca@llucax.com.ar>
Wed, 13 Mar 2013 17:10:04 +0000 (18:10 +0100)
14 files changed:
source/_templates/layout.html
source/blog/art_header.html [new file with mode: 0644]
source/blog/blog.cgi
source/blog/header.html [new file with mode: 0644]
source/proj/bacap
source/proj/dgc/index.rst
source/proj/etherled/index.rst
source/proj/etherled/photos.rst
source/proj/ev.d/index.rst
source/proj/eventxx
source/proj/index.rst
source/proj/mutt-nntp-debian/index.rst
source/proj/pymin/index.rst
source/proj/sadba/index.rst

index b72243ab14bb6820d4ba399b4433fb1a721bf287..4b4cfc47ec20bda4272016530738ed6f7f772ae4 100644 (file)
@@ -1,8 +1,28 @@
 {% extends "!layout.html" %}
 
+{% block extrahead %}
+<script type="text/javascript">
+/* <![CDATA[ */
+    (function() {
+        var s = document.createElement('script'), t = document.getElementsByTagName('script')[0];
+        s.type = 'text/javascript';
+        s.async = true;
+        s.src = 'http://api.flattr.com/js/0.6/load.js?mode=auto&uid=llucax&language=en&popout=0';
+        t.parentNode.insertBefore(s, t);
+    })();
+/* ]]> */</script>
+{% endblock %}
+
 {% block header %}
 <div style="background-color: white; text-align: left; font-size: xx-large; padding: 10px 10px 15px 15px">
        <a href="/">Leandro Lucarella's Home Page</a>
+       &nbsp;
+       <a class="FlattrButton" style="display:none;" rev="flattr;button:compact;" href="http://www.llucax.com.ar/"></a>
+       <noscript>
+               <a href="http://flattr.com/thing/1141602/Leandro-Lucarellas-Home-Page" target="_blank">
+                       <img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this" border="0" />
+               </a>
+       </noscript>
 </div>
 {% endblock %}
 
diff --git a/source/blog/art_header.html b/source/blog/art_header.html
new file mode 100644 (file)
index 0000000..01e71cc
--- /dev/null
@@ -0,0 +1,23 @@
+<div class="article">
+<h2><a href="%(url)s/post/%(uuid)s">%(arttitle)s</a>
+    &nbsp;
+    %(flattrbtn)s
+</h2>
+<span class="artinfo" style="vertical-align: middle">
+  by %(author)s on <span class="date">
+
+<a class="date" href="%(url)s/%(cyear)d/">%(cyear)04d</a>-
+<a class="date" href="%(url)s/%(cyear)d/%(cmonth)d/">%(cmonth)02d</a>-
+<a class="date" href="%(url)s/%(cyear)d/%(cmonth)d/%(cday)d/">%(cday)02d</a>
+    %(chour)02d:%(cminute)02d</span>
+  (updated on <span class="date">
+<a class="date" href="%(url)s/%(uyear)d/">%(uyear)04d</a>-
+<a class="date" href="%(url)s/%(uyear)d/%(umonth)d/">%(umonth)02d</a>-
+<a class="date" href="%(url)s/%(uyear)d/%(umonth)d/%(uday)d/">%(uday)02d</a>
+    %(uhour)02d:%(uminute)02d)</span><br/>
+  <span class="tags">tagged %(tags)s</span> -
+  <span class="comments">with %(comments)s
+    <a href="%(url)s/post/%(uuid)s#comments">comment(s)</a></span>
+</span>
+<p/>
+<div class="artbody">
index f59201af49d5c03d521e6871fe2472c689731729..ba9db9fc37a18d1db668f4ddb0b52de92f1264b9 100755 (executable)
@@ -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 '''
+<a class="FlattrButton" style="display:none;"
+   rel="flattr;uid:llucax;category:text;tags:%(tags)s;button:compact;"
+   title="%(qtitle)s" lang="en"
+   href="%(url)s">Blog article titled: %(title)s</a>
+<noscript><a href="%(furl)s" target="_blank">
+        <img src="http://api.flattr.com/button/flattr-badge-large.png"
+            alt="Flattr this" title="Flattr this" border="0" />
+       </a>
+</noscript>
+''' % v
+
 
 class ArticleDB (object):
        def __init__(self, dbpath):
diff --git a/source/blog/header.html b/source/blog/header.html
new file mode 100644 (file)
index 0000000..3771a42
--- /dev/null
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<link rel="alternate" title="%(title)s" href="%(fullurl)s/atom"
+       type="application/atom+xml" />
+<link href="%(css_url)s" rel="stylesheet" type="text/css" />
+<title>%(title)s</title>
+<script type="text/javascript">
+/* <![CDATA[ */
+    (function() {
+        var s = document.createElement('script'), t = document.getElementsByTagName('script')[0];
+        s.type = 'text/javascript';
+        s.async = true;
+        s.src = 'http://api.flattr.com/js/0.6/load.js?mode=auto&uid=llucax&language=en&popout=0';
+        t.parentNode.insertBefore(s, t);
+    })();
+/* ]]> */</script>
+</head>
+
+<body>
+
+<h1>
+       <a href="%(url)s">%(title)s</a>
+       &nbsp;
+       <a class="FlattrButton" style="display:none;" rev="flattr;button:compact;" href="http://www.llucax.com.ar/blog/"></a>
+       <noscript>
+               <a href="http://flattr.com/thing/1141821/Lucas-meaningless-thoughts" target="_blank">
+                       <img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this" border="0" />
+               </a>
+       </noscript>
+</h1>
+
+<div class="content">
index c830ac2bd3344cf0b4dca1dcd381b1c0f32f3191..ce0d94d8448e25b18e3628265e612283c6932921 160000 (submodule)
@@ -1 +1 @@
-Subproject commit c830ac2bd3344cf0b4dca1dcd381b1c0f32f3191
+Subproject commit ce0d94d8448e25b18e3628265e612283c6932921
index ecf45b4cc4f7202b89572dc9c8beda0fa7e918b9..7025d00f324ceed9bd243c0b0c1c1b59349678dd 100644 (file)
@@ -1,4 +1,10 @@
 
+.. raw:: html
+
+   <div style="width: 220px; height: 330px; float: right; margin-left: 1em; margin-top: 1em">
+   <iframe width="220" height="330" style="border: none; outline: none" src="http://tools.flattr.net/widgets/thing.html?thing=1141780"></iframe>
+   </div>
+
 =====================================
 D Concurrent Garbage Collector (CDGC)
 =====================================
index 8e9d6dd500cd0e3615d4b144ccb3eb8be4e1a140..b66c8be1511eba2a54c17b47de2694de2367752b 100644 (file)
@@ -1,4 +1,11 @@
 
+.. raw:: html
+
+   <div style="width: 220px; height: 270px; float: right; margin-left: 1em; margin-top: 1em">
+   <iframe width="220" height="270" style="border: none; outline: none" src="http://tools.flattr.net/widgets/thing.html?thing=1141689"></iframe>
+   </div>
+
+
 ========
 Etherled
 ========
index bd4e5e80a26fc9b88a98954a4a589b0adb3da7a8..8099f2a274563642ec197c315b478cae3131e4c0 100644 (file)
@@ -1,4 +1,10 @@
 
+.. raw:: html
+
+   <div style="width: 220px; height: 270px; float: right; margin-left: 1em; margin-top: 1em">
+   <iframe width="220" height="270" style="border: none; outline: none" src="http://tools.flattr.net/widgets/thing.html?thing=1141689"></iframe>
+   </div>
+
 
 Photos
 ======
index 34502af7fe267cb18209f9942de6a20f48b16d98..c21c28815f310bde1b36b8c6ba81e63ca749cd50 100644 (file)
@@ -1,4 +1,11 @@
 
+.. raw:: html
+
+   <div style="width: 220px; height: 270px; float: right; margin-left: 1em; margin-top: 1em">
+   <iframe width="220" height="270" style="border: none; outline: none" src="http://tools.flattr.net/widgets/thing.html?thing=1141695"></iframe>
+   </div>
+
+
 ====
 ev.d
 ====
index 37861e1d6e11093b628afe7c4fbc9271c26eff8e..6f8cd16a462861f35d97eb8ba6ee56f0333a5e21 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 37861e1d6e11093b628afe7c4fbc9271c26eff8e
+Subproject commit 6f8cd16a462861f35d97eb8ba6ee56f0333a5e21
index 82ed8a728face91eb4ba68cf871162189a46c255..b41aa1acfe9666774abfe4bea9952092abd330c7 100644 (file)
@@ -19,47 +19,134 @@ not very well maintained :)
 
 eventxx_
    A simple, direct, one-header inline C++ wrapper for libevent_.
+   |flattr-eventxx|
+
+   .. |flattr-eventxx| raw:: html
+
+      <br />
+      <a class="FlattrButton" style="display:none;" rev="flattr;button:compact;" href="http://www.llucax.com.ar/proj/eventxx/"></a>
+      <noscript><a href="http://flattr.com/thing/1141699/eventxx" target="_blank">
+      <img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this" border="0" /></a></noscript>
 
 mutest_
    A micro unit testing framework for C (with some C++ support).
+   |flattr-mutest|
+
+   .. |flattr-mutest| raw:: html
+
+      <br />
+      <a class="FlattrButton" style="display:none;" rev="flattr;button:compact;" href="http://www.llucax.com.ar/proj/mutest/"></a>
+      <noscript><a href="http://flattr.com/thing/1141711/mutest" target="_blank">
+      <img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this" border="0" /></a></noscript>
 
 
 :doc:`etherled/index`
    A remote controlled, programable stroboscopic image projector using an
    8051-family microcontroller.
+   |flattr-etherled|
+
+   .. |flattr-etherled| raw:: html
+
+      <br />
+      <a class="FlattrButton" style="display:none;" rev="flattr;button:compact;" href="http://www.llucax.com.ar/proj/etherled/"></a>
+      <noscript><a href="http://flattr.com/thing/1141689/Etherled" target="_blank">
+      <img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this" border="0" /></a></noscript>
 
 :doc:`ev.d/index`
    A low and high level libev_ bindings for the `D Programming Language`_.
+   |flattr-ev.d|
+
+   .. |flattr-ev.d| raw:: html
+
+      <br />
+      <a class="FlattrButton" style="display:none;" rev="flattr;button:compact;" href="http://www.llucax.com.ar/proj/ev.d/"></a>
+      <noscript><a href="http://flattr.com/thing/1141695/ev-d" target="_blank">
+      <img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this" border="0" /></a></noscript>
 
 :doc:`pymin/index`
    A router administration tool.
+   |flattr-pymin|
+
+   .. |flattr-pymin| raw:: html
+
+      <br />
+      <a class="FlattrButton" style="display:none;" rev="flattr;button:compact;" href="http://www.llucax.com.ar/proj/pymin/"></a>
+      <noscript><a href="http://flattr.com/thing/1141778/pymin" target="_blank">
+      <img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this" border="0" /></a></noscript>
 
 :doc:`dgc/index`
    Research on improvements to the `D Programming Language`_ `garbage
    collector`_ (my Informatics Engineer thesis).
+   |flattr-dgc|
+
+   .. |flattr-dgc| raw:: html
+
+      <br />
+      <a class="FlattrButton" style="display:none;" rev="flattr;button:compact;" href="http://www.llucax.com.ar/proj/dgc/"></a>
+      <noscript><a href="http://flattr.com/thing/1141780/dgc" target="_blank">
+      <img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this" border="0" /></a></noscript>
 
 sphinxcontrib-aafig_
    A Sphinx_ extension for embedding ASCII art that is rendered as nice
    looking images using aafigure_.
+   |flattr-sphinxcontrib-aafig|
+
+   .. |flattr-sphinxcontrib-aafig| raw:: html
+
+      <br />
+      <a class="FlattrButton" style="display:none;" rev="flattr;button:compact;" href="http://pythonhosted.org/sphinxcontrib-aafig/"></a>
+      <noscript><a href="http://flattr.com/thing/1141787/sphinxcontrib-aafig" target="_blank">
+      <img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this" border="0" /></a></noscript>
 
 sphinxcontrib-mscgen_
    A Sphinx_ extension for embedding text-formatted
    :abbr:`MSC (Message Sequence Chart)` diagrams that are rendered as nice
    looking images using Mscgen_.
+   |flattr-sphinxcontrib-mscgen|
+
+   .. |flattr-sphinxcontrib-mscgen| raw:: html
+
+      <br />
+      <a class="FlattrButton" style="display:none;" rev="flattr;button:compact;" href="http://pythonhosted.org/sphinxcontrib-mscgen/"></a>
+      <noscript><a href="http://flattr.com/thing/1141792/sphinxcontrib-mscgen" target="_blank">
+      <img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this" border="0" /></a></noscript>
 
 :doc:`mutt-nntp-debian/index`
    Debian_ package for Mutt_ with the `NNTP support patch`__ applied.
+   |flattr-mutt-nntp-debian|
+
+   .. |flattr-mutt-nntp-debian| raw:: html
+
+      <br />
+      <a class="FlattrButton" style="display:none;" rev="flattr;button:compact;" href="http://www.llucax.com.ar/proj/mutt-nntp-debian/"></a>
+      <noscript><a href="http://flattr.com/thing/1141799/mutt-nntp-debian" target="_blank">
+      <img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this" border="0" /></a></noscript>
 
 __ http://mutt.org.ua/download/mutt-1.5.20/
 
 :doc:`bacap/index`
    A very simple script (~100 SLOC_ of Bash_) to do an incremental backup
    that saves space using rsync_ and hard-links.
+   |flattr-bacap|
+
+   .. |flattr-bacap| raw:: html
+
+      <br />
+      <a class="FlattrButton" style="display:none;" rev="flattr;button:compact;" href="http://www.llucax.com.ar/proj/bacap/"></a>
+      <noscript><a href="http://flattr.com/thing/1141801/bacap" target="_blank">
+      <img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this" border="0" /></a></noscript>
 
 :doc:`sadba/index`
    A simple plugin for Maemo_\ 's Hildon_ status area to control display
    blanking.
+   |flattr-sadba|
+
+   .. |flattr-sadba| raw:: html
 
+      <br />
+      <a class="FlattrButton" style="display:none;" rev="flattr;button:compact;" href="http://www.llucax.com.ar/proj/sadba/"></a>
+      <noscript><a href="http://flattr.com/thing/1141801/sadba" target="_blank">
+      <img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this" border="0" /></a></noscript>
 
 .. _eventxx: eventxx/
 .. _libevent: http://monkey.org/~provos/libevent/
index baabe08f8a079a9dfb9d3928d8a99cb36f0d9ac6..f77f3aeadb819dad0d30df357a07cff798303e86 100644 (file)
@@ -1,4 +1,11 @@
 
+.. raw:: html
+
+   <div style="width: 220px; height: 330px; float: right; margin-left: 1em; margin-top: 1em">
+   <iframe width="220" height="330" style="border: none; outline: none" src="http://tools.flattr.net/widgets/thing.html?thing=1141799"></iframe>
+   </div>
+
+
 =======================================
 Debian package for Mutt with NNTP patch
 =======================================
index 4a92b44bcb79f818ab0640feaa68c9472b24efb7..7a9b02d7a4d1a67765c6fe33751cb326b361e1c5 100644 (file)
@@ -1,4 +1,10 @@
 
+.. raw:: html
+
+   <div style="width: 220px; height: 270px; float: right; margin-left: 1em; margin-top: 1em">
+   <iframe width="220" height="270" style="border: none; outline: none" src="http://tools.flattr.net/widgets/thing.html?thing=1141778"></iframe>
+   </div>
+
 =====
 Pymin
 =====
index e5a64ccc8cac830de065b9499a33af10f8c2f08a..cf57c5485ce33c7fd37b34a726c768f38c9c13aa 100644 (file)
@@ -1,4 +1,10 @@
 
+.. raw:: html
+
+   <div style="width: 280px; height: 310px; float: right; margin-left: 1em; margin-top: 1em">
+   <iframe width="280" height="310" style="border: none; outline: none" src="http://tools.flattr.net/widgets/thing.html?thing=1141802"></iframe>
+   </div>
+
 =============================================
 Status Area Display Blanking Applet for Maemo
 =============================================