Skip to content

Commit

Permalink
Do not change smartypants.educateDashes* with a custom implementation.
Browse files Browse the repository at this point in the history
When using the new_dashes function, smartypants does not replace two
dashes (--) with an en dash and three dashes (---) with an em
dash. Without these modifications, smartypants DOES replace the dashes
as expected.

Using smartypants 1.6.0.3 from PyPI.
  • Loading branch information
markvl committed Jun 1, 2012
1 parent bc520b3 commit 2fea12c
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions acrylamid/filters/typography.py
Expand Up @@ -30,9 +30,6 @@ class Typography(Filter):

def init(self, conf, env):

smartypants.educateDashes = new_dashes
smartypants.educateDashesOldSchool = new_dashes

self.ignore = env.options.ignore
self.filters = {'amp': amp, 'widont': widont, 'caps': caps,
'initial_quotes': initial_quotes, 'number_suffix': number_suffix,
Expand All @@ -54,13 +51,6 @@ def transform(self, content, entry, *args):
return content


def new_dashes(str):
# patching something-- to return something-- not something&#8212.
str = re.sub(r"""(\s)--""", r"""\1–""", str) # en (yes, backwards)
str = re.sub(r"""(\s)---""", r"""\1—""", str) # em (yes, backwards)
return str


def amp(text, autoescape=None):
"""Wraps apersands in HTML with ``<span class="amp">`` so they can be
styled with CSS. Apersands are also normalized to ``&amp;``. Requires
Expand Down

0 comments on commit 2fea12c

Please sign in to comment.