From: Radek Czajka Date: Wed, 2 Oct 2019 09:56:14 +0000 (+0200) Subject: More textile optional. X-Git-Tag: 0.4.3 X-Git-Url: https://git.mdrn.pl/fnpdjango.git/commitdiff_plain/ebb1eac83c7336e43049b3c7eeec4e6fc43ef076?ds=inline More textile optional. --- diff --git a/CHANGELOG.md b/CHANGELOG.md index 7164adc..8802439 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ This document records all notable changes to fnpdjango. -## 0.4.2 (2019-10-02) +## 0.4.3 (2019-10-02) - Make textile import optional when loading template tags. diff --git a/fnpdjango/utils/text/textilepl.py b/fnpdjango/utils/text/textilepl.py index 434816b..bbad72a 100644 --- a/fnpdjango/utils/text/textilepl.py +++ b/fnpdjango/utils/text/textilepl.py @@ -1,20 +1,23 @@ -from textile import Textile +try: + from textile import Textile +except ImportError: + pass +else: + class TextilePL(Textile): + """Polish version of Textile. -class TextilePL(Textile): - """Polish version of Textile. + Changes opening quote to Polish lower-double. + """ + glyph_definitions = dict(Textile.glyph_definitions, + quote_double_open = '„' + ) - Changes opening quote to Polish lower-double. - """ - glyph_definitions = dict(Textile.glyph_definitions, - quote_double_open = '„' - ) + def textile_pl(text): + return TextilePL().parse(text) -def textile_pl(text): - return TextilePL().parse(text) - -def textile_restricted_pl(text): - return TextilePL(restricted=True, lite=True, noimage=True).parse( - text, rel='nofollow') + def textile_restricted_pl(text): + return TextilePL(restricted=True, lite=True, noimage=True).parse( + text, rel='nofollow') diff --git a/setup.py b/setup.py index c5113fe..d2d3389 100755 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ def whole_trees(package_dir, paths): setup( name='fnpdjango', - version='0.4.2', + version='0.4.3', author='Radek Czajka', author_email='radekczajka@nowoczesnapolska.org.pl', url='',