Merge branch 'master' of ssh://git.nowoczesnapolska.org.pl:2223/~/repo/wolnelektury
authorMarcin Koziej <marcin@lolownia.org>
Mon, 10 Feb 2014 14:53:19 +0000 (15:53 +0100)
committerMarcin Koziej <marcin@lolownia.org>
Mon, 10 Feb 2014 14:53:19 +0000 (15:53 +0100)
apps/funding/templatetags/funding_tags.py
apps/funding/utils.py [new file with mode: 0644]
apps/wolnelektury_core/static/css/new.book.css
apps/wolnelektury_core/static/scss/main/cite.scss
wolnelektury/settings/contrib.py

index 5c6544a..f59a796 100755 (executable)
@@ -1,5 +1,6 @@
 from django import template
 from ..models import Offer
+from ..utils import sanitize_payment_title
 
 register = template.Library()
 
@@ -43,4 +44,4 @@ def offer_status_more(offer):
         'offer': offer,
     }
 
-
+register.filter(sanitize_payment_title)
diff --git a/apps/funding/utils.py b/apps/funding/utils.py
new file mode 100644 (file)
index 0000000..2b5f58f
--- /dev/null
@@ -0,0 +1,23 @@
+# -*- coding: utf-8
+import re
+import string
+from fnpdjango.utils.text.slughifi import char_map
+
+# PayU chokes on non-Polish diacritics.
+# Punctuation is handled correctly and escaped as needed,
+# with the notable exception of backslash.
+sane_in_payu_title = re.escape(
+    string.uppercase +
+    string.lowercase + 
+    u'ąćęłńóśźżĄĆĘŁŃÓŚŹŻ' + 
+    string.digits +
+    ' ' +
+    "".join(set(string.punctuation) - set('\\'))
+)
+
+def replace_char(m):
+    char = m.group()
+    return char_map.get(char, '')
+
+def sanitize_payment_title(value):
+    return re.sub('[^%s]{1}' % sane_in_payu_title, replace_char, unicode(value))
index 15973eb..45f8e5d 100644 (file)
@@ -182,7 +182,7 @@ div.kwestia {
 }
 
 div.stanza {
-    margin: 1.5em 0 0;
+    margin: 1.5em 0;
 }
 
 div.kwestia div.stanza {
@@ -195,7 +195,7 @@ p.paragraph {
     text-indent: 1.5em;
 }
 
-p.motto {
+.motto {
     text-align: justify;
     font-style: italic;
     margin: 1.5em 0 0;
@@ -204,6 +204,7 @@ p.motto {
 p.motto_podpis {
     font-size: 0.875em;
     text-align: right;
+    margin-bottom: 1.5em;
 }
 
 div.fragment {
index cd11ec1..eb3a511 100755 (executable)
     .cite-body {
         @include size(font-size, 18px);
         line-height: 1.3em;
+
+        h4 {
+            margin: 0;
+        }
+        .didaskalia {
+            font-style: italic;
+        }
+        .verse {
+            // Cancel any indentation.
+            padding-left: 0 !important;
+        }
+        .person {
+            font-style: inherit;
+        }
     }
 
     blockquote {
index 6e3e535..04b0bd9 100644 (file)
@@ -7,3 +7,5 @@ SOUTH_MIGRATION_MODULES = {
     'getpaid' : 'wolnelektury.migrations.getpaid',
     'payu': 'wolnelektury.migrations.getpaid_payu',
 }
+
+GETPAID_ORDER_DESCRIPTION = "{% load funding_tags %}{{ order|sanitize_payment_title }}"