aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/extensions/extra.txt8
-rw-r--r--docs/release-2.4.txt35
-rw-r--r--docs/siteindex.txt1
-rw-r--r--markdown/extensions/smarty.py67
-rw-r--r--tests/extensions/smarty.html3
-rw-r--r--tests/extensions/smarty.txt1
6 files changed, 58 insertions, 57 deletions
diff --git a/docs/extensions/extra.txt b/docs/extensions/extra.txt
index 0507e8f..ace7a57 100644
--- a/docs/extensions/extra.txt
+++ b/docs/extensions/extra.txt
@@ -45,7 +45,7 @@ your own clone of Extra under a different name
Markdown Inside HTML Blocks
---------------------------
-Unlike the other Extra features, this feature is build into the markdown core and is turned on when `extra` is enabled.
+Unlike the other Extra features, this feature is built into the markdown core and is turned on when `extra` is enabled.
The content of any raw html block element can be Markdown-formatted simply by adding a `markdown` attribute to the opening tag. The markdown attribute will be stripped from the output, but all other attributes will be preserved.
@@ -61,9 +61,9 @@ This is *true* markdown text.
```
#### Result:
```
-<p>This is <em>true</em> markdown text.</p>
-<div>
-<p>This is <em>true</em> markdown text.</p>
+<p>This is <em>true</em> markdown text.</p>
+<div>
+<p>This is <em>true</em> markdown text.</p>
</div>
```
diff --git a/docs/release-2.4.txt b/docs/release-2.4.txt
index 78b78be..437864a 100644
--- a/docs/release-2.4.txt
+++ b/docs/release-2.4.txt
@@ -23,7 +23,11 @@ documentation for the [CodeHilite Extension] for an explanation of the new
is set, but "force_linenos" will raise a DeprecationWarning and will likely
be removed in a future version of Python-Markdown.
-[CodeHilite Extension]: extensions/codehilite.html
+[CodeHilite Extension]: extensions/code_hilite.html
+
+* URLs are no longer percent-encoded. This improves compatibility with the
+original (written in Perl) Markdown implementation. Please percent-encode
+your URLs manually when needed.
What's New in Python-Markdown 2.4
---------------------------------
@@ -39,6 +43,35 @@ it out and report bugs and/or improvements.
[Smarty Extension]: extensions/smarty.html
[SmartyPants]: http://daringfireball.net/projects/smartypants/
+* The [Table of Contents Extension] now supports new `permalink` option
+for creating [Sphinx]-style anchor links.
+
+[Table of Contents Extension]: extensions/toc.html
+[Sphinx]: http://sphinx-doc.org/
+
+* It is now possible to enable Markdown formatting inside HTML blocks by
+appending `markdown=1` to opening tag attributes. See [Markdown Inside HTML
+Blocks] section for details. Thanks to [ryneeverett] for implementing this
+feature.
+
+[Markdown Inside HTML Blocks]: extensions/extra.html#nested-markdown-inside-html-blocks
+[ryneeverett]: https://github.com/ryneeverett
+
+* The code blocks now support emphasizing some of the code lines. To use this
+feature, specify `hl_lines` option after language name, for example (using
+the [Fenced Code Extension]):
+
+ ```.python hl_lines="1 3"
+ # This line will be emphasized.
+ # This one won't.
+ # This one will be also emphasized.
+ ```
+
+ Thanks to [A. Jesse Jiryu Davis] for implementing this feature.
+
+[Fenced Code Extension]: extensions/fenced_code_blocks.html
+[A. Jesse Jiryu Davis]: https://github.com/ajdavis
+
* Various bug fixes have been made. See the
[commit log](https://github.com/waylan/Python-Markdown/commits/master)
for a complete history of the changes.
diff --git a/docs/siteindex.txt b/docs/siteindex.txt
index 6846015..806af1e 100644
--- a/docs/siteindex.txt
+++ b/docs/siteindex.txt
@@ -67,6 +67,7 @@ Table of Contents
* [Unit Tests](test_suite.html#unit-tests)
* [Doc Tests](test_suite.html#doc-tests)
* [Change Log](change_log.html)
+ * [Release Notes for v.2.4](release-2.4.html)
* [Release Notes for v.2.3](release-2.3.html)
* [Release Notes for v.2.2.1](release-2.1.1.html)
* [Release Notes for v.2.2.0](release-2.1.0.html)
diff --git a/markdown/extensions/smarty.py b/markdown/extensions/smarty.py
index a0737b7..f452afc 100644
--- a/markdown/extensions/smarty.py
+++ b/markdown/extensions/smarty.py
@@ -70,32 +70,20 @@ from . import Extension
from ..inlinepatterns import HtmlPattern
from ..util import parseBoolValue
-def canonicalize(regex):
- """
- Converts the regexp from the re.VERBOSE form to the canonical form,
- i.e. remove all whitespace and ignore comments.
- """
- lines = regex.split('\n')
- for i in range(len(lines)):
- if ' #' in lines[i]:
- lines[i] = lines[i][:lines[i].find(' #')]
- return ''.join(lines).replace(' ', '')
-
# Constants for quote education.
punctClass = r"""[!"#\$\%'()*+,-.\/:;<=>?\@\[\\\]\^_`{|}~]"""
endOfWordClass = r"[\s.,;:!?)]"
closeClass = r"[^\ \t\r\n\[\{\(\-\u0002\u0003]"
-openingQuotesBase = r"""
-(
- \s | # a whitespace char, or
- &nbsp; | # a non-breaking space entity, or
- -- | # dashes, or
- –|— | # unicode, or
- &[mn]dash; | # named dash entities, or
- &#8211;|&#8212; # decimal entities
+openingQuotesBase = (
+ '(\s' # a whitespace char
+ '|&nbsp;' # or a non-breaking space entity
+ '|--' # or dashes
+ '|–|—' # or unicode
+ '|&[mn]dash;' # or named dash entities
+ '|&#8211;|&#8212;' # or decimal entities
+ ')'
)
-"""
# Special case if the very first character is a quote
# followed by punctuation at a non-word-break. Close the quotes by brute force:
@@ -108,41 +96,18 @@ doubleQuoteSetsRe = r""""'(?=\w)"""
singleQuoteSetsRe = r"""'"(?=\w)"""
# Get most opening double quotes:
-openingDoubleQuotesRegex = canonicalize("""
-%s # symbols before the quote
-" # the quote
-(?=\w) # followed by a word character
-""" % openingQuotesBase)
+openingDoubleQuotesRegex = r'%s"(?=\w)' % openingQuotesBase
# Double closing quotes:
-closingDoubleQuotesRegex = canonicalize(r"""
-"
-(?=\s)
-""")
-
-closingDoubleQuotesRegex2 = canonicalize(r"""
-(?<=%s) # character that indicates the quote should be closing
-"
-""" % closeClass)
+closingDoubleQuotesRegex = r'"(?=\s)'
+closingDoubleQuotesRegex2 = '(?<=%s)"' % closeClass
# Get most opening single quotes:
-openingSingleQuotesRegex = canonicalize(r"""
-%s # symbols before the quote
-' # the quote
-(?=\w) # followed by a word character
-""" % openingQuotesBase)
-
-closingSingleQuotesRegex = canonicalize(r"""
-(?<=%s)
-'
-(?!\s | s\b | \d)
-""" % closeClass)
-
-closingSingleQuotesRegex2 = canonicalize(r"""
-(?<=%s)
-'
-(\s | s\b)
-""" % closeClass)
+openingSingleQuotesRegex = r"%s'(?=\w)" % openingQuotesBase
+
+# Single closing quotes:
+closingSingleQuotesRegex = r"(?<=%s)'(?!\s|s\b|\d)" % closeClass
+closingSingleQuotesRegex2 = r"(?<=%s)'(\s|s\b)" % closeClass
# All remaining quotes should be opening ones
remainingSingleQuotesRegex = "'"
diff --git a/tests/extensions/smarty.html b/tests/extensions/smarty.html
index fbd15af..6b5e698 100644
--- a/tests/extensions/smarty.html
+++ b/tests/extensions/smarty.html
@@ -5,7 +5,8 @@
1960&rsquo;s<br />
one two &lsquo;60s<br />
&lsquo;60s</p>
-<p>&ldquo;Isn&rsquo;t this fun&rdquo;? &mdash; she said&hellip;<br />
+<p>It&rsquo;s fun. What&rsquo;s fun?<br />
+&ldquo;Isn&rsquo;t this fun&rdquo;? &mdash; she said&hellip;<br />
&ldquo;&lsquo;Quoted&rsquo; words in a larger quote.&rdquo;<br />
&lsquo;Quoted &ldquo;words&rdquo; in a larger quote.&rsquo;<br />
&ldquo;quoted&rdquo; text and <strong>bold &ldquo;quoted&rdquo; text</strong><br />
diff --git a/tests/extensions/smarty.txt b/tests/extensions/smarty.txt
index 5b5ece7..fbf4d03 100644
--- a/tests/extensions/smarty.txt
+++ b/tests/extensions/smarty.txt
@@ -6,6 +6,7 @@
one two '60s
'60s
+It's fun. What's fun?
"Isn't this fun"? --- she said...
"'Quoted' words in a larger quote."
'Quoted "words" in a larger quote.'