From dad0f46522e020e8f74f34241c007ec1427a1ae0 Mon Sep 17 00:00:00 2001 From: Taneli Hukkinen Date: Wed, 4 Nov 2020 08:09:53 +0200 Subject: [PATCH] Fix punctuation char comparison in smartquotes.py --- markdown_it/common/utils.py | 2 +- markdown_it/rules_core/smartquotes.py | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/markdown_it/common/utils.py b/markdown_it/common/utils.py index ac99dbc8..17337c35 100644 --- a/markdown_it/common/utils.py +++ b/markdown_it/common/utils.py @@ -272,7 +272,7 @@ def isPunctChar(ch): } -def isMdAsciiPunct(ch: str): +def isMdAsciiPunct(ch: int): """Markdown ASCII punctuation characters. :: diff --git a/markdown_it/rules_core/smartquotes.py b/markdown_it/rules_core/smartquotes.py index cceb1778..65e39487 100644 --- a/markdown_it/rules_core/smartquotes.py +++ b/markdown_it/rules_core/smartquotes.py @@ -94,12 +94,8 @@ def process_inlines(tokens: List[Token], state: StateCore): nextChar = charCodeAt(tokens[j].content, 0) break - isLastPunctChar = isMdAsciiPunct(chr(lastChar)) or isPunctChar( - chr(lastChar) - ) - isNextPunctChar = isMdAsciiPunct(chr(nextChar)) or isPunctChar( - chr(nextChar) - ) + isLastPunctChar = isMdAsciiPunct(lastChar) or isPunctChar(chr(lastChar)) + isNextPunctChar = isMdAsciiPunct(nextChar) or isPunctChar(chr(nextChar)) isLastWhiteSpace = isWhiteSpace(lastChar) isNextWhiteSpace = isWhiteSpace(nextChar)