summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu-Jie Lin <livibetter@gmail.com>2013-08-18 15:26:12 +0800
committerYu-Jie Lin <livibetter@gmail.com>2013-08-18 15:26:12 +0800
commitd92b80377adb86b0e5dc688d5e2be4bb44ec7ee0 (patch)
tree10703337e882e99cb00d035f916074b3134c8d71
parent4d28166cae3eec1aec8e6f6f78aa25ee4f3d1cbd (diff)
downloadsmartypants-d92b80377adb86b0e5dc688d5e2be4bb44ec7ee0.tar.gz
add style element to skipped list, remove doctest on the list
-rw-r--r--CHANGES.rst2
-rw-r--r--README.rst4
-rwxr-xr-xsmartypants.py4
3 files changed, 4 insertions, 6 deletions
diff --git a/CHANGES.rst b/CHANGES.rst
index ea4a6de..363f1d0 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -18,7 +18,7 @@ development:
targets
- ``install_test`` target for checking package installation
- ``test`` target for all tests above
- - add ``samp`` and ``tt`` to be skipped HTML elements
+ - add ``style``, ``samp``, and ``tt`` to be skipped HTML elements
- remove ``tags_to_skip_regex`` and add ``tags_to_skip`` as a list of
skipped HTML with a helper function to compile a regular expreesion
- deprecate str-type ``attr`` with:
diff --git a/README.rst b/README.rst
index 2a46a32..9f0f859 100644
--- a/README.rst
+++ b/README.rst
@@ -194,7 +194,7 @@ be smart with them:
.. code:: python
- tags_to_skip = ['pre', 'samp', 'code', 'tt', 'kbd', 'script', 'math']
+ tags_to_skip = ['pre', 'samp', 'code', 'tt', 'kbd', 'script', 'style', 'math']
If you need to change, for example, adding additional tags and remove one of
them:
@@ -205,7 +205,7 @@ them:
>>> tags.append('a')
>>> tags.remove('code')
>>> tags
- ['pre', 'samp', 'tt', 'kbd', 'script', 'math', 'a']
+ ['pre', 'samp', 'tt', 'kbd', 'script', 'style', 'math', 'a']
The ``tags_to_skip`` is compiled into a regular expression for being used by
``smartypants()``. You could actually overwrite ``_tags_to_skip_regex()`` and
diff --git a/smartypants.py b/smartypants.py
index 9185e80..6cce92c 100755
--- a/smartypants.py
+++ b/smartypants.py
@@ -57,7 +57,7 @@ Attr = _Attr()
default_smartypants_attr = Attr.set1
-tags_to_skip = ['pre', 'samp', 'code', 'tt', 'kbd', 'script', 'math']
+tags_to_skip = ['pre', 'samp', 'code', 'tt', 'kbd', 'script', 'style', 'math']
def _tags_to_skip_regex(tags=None):
@@ -65,8 +65,6 @@ def _tags_to_skip_regex(tags=None):
Convert a list of skipped tags into regular expression
>>> f = _tags_to_skip_regex
- >>> print(f().pattern)
- <(/)?(pre|samp|code|tt|kbd|script|math)[^>]*>
>>> print(f(['foo', 'bar']).pattern)
<(/)?(foo|bar)[^>]*>
"""