summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsmartypants.py35
1 files changed, 20 insertions, 15 deletions
diff --git a/smartypants.py b/smartypants.py
index d4ff685..aec885b 100755
--- a/smartypants.py
+++ b/smartypants.py
@@ -662,21 +662,26 @@ def process_escapes(text):
Processe the following backslash escape sequences in *text*. This is useful
if you want to force a "dumb" quote or other character to appear.
- +--------+----------+-------------+
- | Escape | Value | Character |
- +========+==========+=============+
- | ``\\`` | ``#92;`` | ``\`` |
- +--------+----------+-------------+
- | ``\"`` | ``#34;`` | ``"`` |
- +--------+----------+-------------+
- | ``\'`` | ``#39;`` | ``'`` |
- +--------+----------+-------------+
- | ``\.`` | ``#46;`` | ``.`` |
- +--------+----------+-------------+
- | ``\-`` | ``#45;`` | ``-`` |
- +--------+----------+-------------+
- | ``\``` | ``#96;`` | ``\``` |
- +--------+----------+-------------+
+ +--------+-----------+-----------+
+ | Escape | Value | Character |
+ +========+===========+===========+
+ | ``\\`` | ``\`` | ``\`` |
+ +--------+-----------+-----------+
+ | ``\"`` | ``"`` | ``"`` |
+ +--------+-----------+-----------+
+ | ``\'`` | ``'`` | ``'`` |
+ +--------+-----------+-----------+
+ | ``\.`` | ``.`` | ``.`` |
+ +--------+-----------+-----------+
+ | ``\-`` | ``-`` | ``-`` |
+ +--------+-----------+-----------+
+ | ``\``` | ````` | ``\``` |
+ +--------+-----------+-----------+
+
+ >>> print(process_escapes(r'\\'))
+ \
+ >>> print(smartypants(r'"smarty" \"pants\"'))
+ “smarty” "pants"
"""
text = re.sub(r'\\\\', '\', text)