diff options
Diffstat (limited to 'markdown/extensions')
-rw-r--r-- | markdown/extensions/smarty.py | 20 | ||||
-rw-r--r-- | markdown/extensions/toc.py | 4 |
2 files changed, 12 insertions, 12 deletions
diff --git a/markdown/extensions/smarty.py b/markdown/extensions/smarty.py index 5031bc4..c2af7cd 100644 --- a/markdown/extensions/smarty.py +++ b/markdown/extensions/smarty.py @@ -91,16 +91,16 @@ from ..treeprocessors import InlineProcessor # Constants for quote education. punctClass = r"""[!"#\$\%'()*+,-.\/:;<=>?\@\[\\\]\^_`{|}~]""" endOfWordClass = r"[\s.,;:!?)]" -closeClass = "[^\ \t\r\n\[\{\(\-\u0002\u0003]" +closeClass = r"[^\ \t\r\n\[\{\(\-\u0002\u0003]" openingQuotesBase = ( - '(\s' # a whitespace char - '| ' # or a non-breaking space entity - '|--' # or dashes - '|–|—' # or unicode - '|&[mn]dash;' # or named dash entities - '|–|—' # or decimal entities - ')' + r'(\s' # a whitespace char + r'| ' # or a non-breaking space entity + r'|--' # or dashes + r'|–|—' # or unicode + r'|&[mn]dash;' # or named dash entities + r'|–|—' # or decimal entities + r')' ) substitutions = { @@ -144,8 +144,8 @@ closingSingleQuotesRegex = r"(?<=%s)'(?!\s|s\b|\d)" % closeClass closingSingleQuotesRegex2 = r"(?<=%s)'(\s|s\b)" % closeClass # All remaining quotes should be opening ones -remainingSingleQuotesRegex = "'" -remainingDoubleQuotesRegex = '"' +remainingSingleQuotesRegex = r"'" +remainingDoubleQuotesRegex = r'"' HTML_STRICT_RE = HTML_RE + r'(?!\>)' diff --git a/markdown/extensions/toc.py b/markdown/extensions/toc.py index 2c4a4b5..b222cb4 100644 --- a/markdown/extensions/toc.py +++ b/markdown/extensions/toc.py @@ -25,8 +25,8 @@ import unicodedata def slugify(value, separator): """ Slugify a string, to make it URL friendly. """ value = unicodedata.normalize('NFKD', value).encode('ascii', 'ignore') - value = re.sub('[^\w\s-]', '', value.decode('ascii')).strip().lower() - return re.sub('[%s\s]+' % separator, separator, value) + value = re.sub(r'[^\w\s-]', '', value.decode('ascii')).strip().lower() + return re.sub(r'[%s\s]+' % separator, separator, value) IDCOUNT_RE = re.compile(r'^(.*)_([0-9]+)$') |