[Python-modules-commits] [python-markdown] 01/04: Import python-markdown_2.6.7.orig.tar.gz

Dmitry Shachnev mitya57 at moszumanska.debian.org
Sun Sep 25 11:15:01 UTC 2016


This is an automated email from the git hooks/post-receive script.

mitya57 pushed a commit to branch master
in repository python-markdown.

commit 07c11616d8b6c203e548c6a72c44de9f397bc5af
Author: Dmitry Shachnev <mitya57 at gmail.com>
Date:   Sun Sep 25 14:08:58 2016 +0300

    Import python-markdown_2.6.7.orig.tar.gz
---
 PKG-INFO                           |  4 +--
 README.md                          |  2 ++
 docs/change_log.txt                |  4 +++
 docs/extensions/code_hilite.txt    | 68 ++++++++++++++++++++++++++++----------
 docs/reference.txt                 |  4 +--
 docs/release-2.5.txt               |  2 +-
 docs/release-2.6.txt               |  4 +--
 markdown/__init__.py               |  2 +-
 markdown/__version__.py            |  2 +-
 markdown/extensions/attr_list.py   | 14 ++++----
 markdown/extensions/fenced_code.py |  1 +
 markdown/extensions/tables.py      |  7 ++--
 markdown/inlinepatterns.py         |  2 +-
 tests/extensions/attr_list.html    |  5 ++-
 tests/extensions/attr_list.txt     |  4 +++
 tests/extensions/extra/tables.html |  8 ++---
 tests/misc/image.html              |  4 ++-
 tests/misc/image.txt               |  6 +++-
 tests/test_extensions.py           | 12 +++++++
 19 files changed, 109 insertions(+), 46 deletions(-)

diff --git a/PKG-INFO b/PKG-INFO
index f2e829a..c5615b4 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,12 +1,12 @@
 Metadata-Version: 1.1
 Name: Markdown
-Version: 2.6.6
+Version: 2.6.7
 Summary: Python implementation of Markdown.
 Home-page: https://pythonhosted.org/Markdown/
 Author: Waylan Limberg
 Author-email: waylan.limberg [at] icloud.com
 License: BSD License
-Download-URL: http://pypi.python.org/packages/source/M/Markdown/Markdown-2.6.6.tar.gz
+Download-URL: http://pypi.python.org/packages/source/M/Markdown/Markdown-2.6.7.tar.gz
 Description: 
         This is a Python implementation of John Gruber's Markdown_.
         It is almost completely compliant with the reference implementation,
diff --git a/README.md b/README.md
index 51c5a14..779b300 100644
--- a/README.md
+++ b/README.md
@@ -27,6 +27,8 @@ Installation and usage documentation is available in the `docs/` directory
 of the distribution and on the project website at 
 <https://pythonhosted.org/Markdown/>.
 
+See the change log at <https://pythonhosted.org/Markdown/change_log.html>.
+
 Support
 -------
 
diff --git a/docs/change_log.txt b/docs/change_log.txt
index e4a991b..847046d 100644
--- a/docs/change_log.txt
+++ b/docs/change_log.txt
@@ -7,6 +7,10 @@ next_url:   release-2.6.html
 Python-Markdown Change Log
 =========================
 
+Sept 23, 2016: Released version 2.6.7 (a bug-fix release).
+
+Mar 20, 2016: Released version 2.6.6 (a bug-fix release).
+
 Nov 24, 2015: Released version 2.6.5 (a bug-fix release).
 
 Nov 6, 2015: Released version 2.6.4 (a bug-fix release).
diff --git a/docs/extensions/code_hilite.txt b/docs/extensions/code_hilite.txt
index 5e802b8..c17d688 100644
--- a/docs/extensions/code_hilite.txt
+++ b/docs/extensions/code_hilite.txt
@@ -20,20 +20,54 @@ This extension is included in the standard Markdown library.
 Setup
 -----
 
+### Step 1: Download and Install Pygments ###
+
 You will also need to [download][dl] and install the Pygments package on your
-`PYTHONPATH`. You will need to determine the appropriate CSS classes and create
-appropriate rules for them, which are either defined in or linked from the
-header of your HTML templates. See the excellent [documentation][] for more
-details. If no language is defined, Pygments will attempt to guess the
-language. When that fails, the code block will not be highlighted.
+`PYTHONPATH`. The CodeHilite extension will produce HTML output without
+Pygments, but it won't highlight anything (same behavior as setting
+`use_pygments` to `False`).
 
 [dl]: http://pygments.org/download/
-[documentation]: http://pygments.org/docs
 
-!!! Note
-    The CSS and/or JavaScript is not included as part of this extension
-    but must be provided by the end user. The Pygments project provides
-    default CSS styles which you may find to be a useful starting point.
+### Step 2: Add CSS Classes ###
+
+You will need to define the appropriate CSS classes with appropriate rules.
+The CSS rules either need to be defined in or linked from the header of your
+HTML templates. Pygments can generate CSS rules for you. Just run the following
+command from the command line:
+
+    pygmentize -S default -f html -a codehilite > styles.css
+
+If you are using a different `css_class` (default: `codehilite`), then
+set the value of the `-a` option to that class name. The CSS rules will be
+written to the `styles.css` file which you can copy to your site and link from
+your HTML templates.
+
+If you would like to use a different theme, swap out `default` for the desired
+theme. For a list of themes installed on your system (additional themes can be
+installed via Pygments plugins), run the following command:
+
+    pygmetize -L style
+
+!!! see also
+
+    GitHub user [richeland] has provided a number of different [CSS style
+    sheets][rich] which work with Pygments along with a [preview] of each theme.
+    The `css_class` used is the same as the default value for that option
+    (`codehilite`). However, the Python-Markdown project makes no guarantee that
+    richeland's CSS styles will work with the version of Pygments you are using.
+    To ensure complete compatibility, you should generate the CSS rules from
+    your own installation of Pygments.
+
+See Pygments' excellent [documentation] for more details. If no language is
+defined, Pygments will attempt to guess the language. When that fails, the code
+block will not be highlighted.
+
+[richeland]: https://github.com/richleland
+[rich]: https://github.com/richleland/pygments-css
+[previews]: http://richleland.github.io/pygments-css/
+[documentation]: http://pygments.org/docs/
+
 
 Syntax
 ------
@@ -91,8 +125,8 @@ Will result in:
 
     # Code goes here ...
 
-Certain lines can be selected for emphasis with the colon syntax. When 
-using Pygments' default CSS styles, emphasized lines have a yellow background. 
+Certain lines can be selected for emphasis with the colon syntax. When
+using Pygments' default CSS styles, emphasized lines have a yellow background.
 This is useful to direct the reader's attention to specific lines.
 
     :::python hl_lines="1 3"
@@ -107,7 +141,7 @@ This is useful to direct the reader's attention to specific lines.
 
 CodeHilite is completely backwards compatible so that if a code block is
 encountered that does not define a language, the block is simply wrapped in
-`<pre>` tags and output. 
+`<pre>` tags and output.
 
         # Code goes here ...
 
@@ -121,15 +155,15 @@ Lets see the source for that:
     </code></pre></div>
 
 !!! Note
-    When no language is defined, the Pygments highlighting engine will try to guess 
-    the language (unless `guess_lang` is set to `False`). Upon failure, the same 
+    When no language is defined, the Pygments highlighting engine will try to guess
+    the language (unless `guess_lang` is set to `False`). Upon failure, the same
     behavior will happen as described above.
 
 Usage
 -----
 
-See [Extensions](index.html) for general extension usage, specify `markdown.extensions.codehilite`
-as the name of the extension.
+See [Extensions](index.html) for general extension usage, specify
+`markdown.extensions.codehilite` as the name of the extension.
 
 See the [Library Reference](../reference.html#extensions) for information about
 configuring extensions.
diff --git a/docs/reference.txt b/docs/reference.txt
index ac5c724..7268cc6 100644
--- a/docs/reference.txt
+++ b/docs/reference.txt
@@ -247,8 +247,8 @@ The following options are available on the `markdown.markdown` function:
     If `lazy_ol` is set to `False`, then markdown will output the following
     HTML:
 
-        <ol>
-          <li start="4">Apples</li>
+        <ol start="4">
+          <li>Apples</li>
           <li>Oranges</li>
           <li>Pears</li>
         </ol>
diff --git a/docs/release-2.5.txt b/docs/release-2.5.txt
index 0c399ed..6f38122 100644
--- a/docs/release-2.5.txt
+++ b/docs/release-2.5.txt
@@ -59,7 +59,7 @@ Backwards-incompatible Changes
 	As the HTML would not be parsed with the above Extension, then the serializer will
 	escape the raw HTML, which is exactly what happens now when `safe_mode="escape"`.
 
-[Bleach]: http://bleach.readthedocs.org/
+[Bleach]: https://bleach.readthedocs.io/
 
 * Positional arguments on the `markdown.Markdown()` are pending deprecation as are
   all except the `text` argument on the `markdown.markdown()` wrapper function.
diff --git a/docs/release-2.6.txt b/docs/release-2.6.txt
index 747c81c..9a235c8 100644
--- a/docs/release-2.6.txt
+++ b/docs/release-2.6.txt
@@ -49,7 +49,7 @@ raw HTML, then that can be accomplished through an extension which removes HTML
 As the HTML would not be parsed with the above Extension, then the serializer will
 escape the raw HTML, which is exactly what happens now when `safe_mode="escape"`.
 
-[Bleach]: http://bleach.readthedocs.org/
+[Bleach]: https://bleach.readthedocs.io/
 
 ### Positional Arguments Deprecated
 
@@ -256,7 +256,7 @@ Test coverage has been improved including running [flake8]. While those changes
 will not directly effect end users, the code is being better tested which will 
 benefit everyone.
 
-[flake8]: http://flake8.readthedocs.org/en/latest/
+[flake8]: https://flake8.readthedocs.io/en/latest/
 
 Various bug fixes have been made.  See the
 [commit log](https://github.com/waylan/Python-Markdown/commits/master)
diff --git a/markdown/__init__.py b/markdown/__init__.py
index 1b86553..78ea4cb 100644
--- a/markdown/__init__.py
+++ b/markdown/__init__.py
@@ -137,7 +137,7 @@ class Markdown(object):
         if 'safe_mode' in kwargs:
             warnings.warn('"safe_mode" is deprecated in Python-Markdown. '
                           'Use an HTML sanitizer (like '
-                          'Bleach http://bleach.readthedocs.org/) '
+                          'Bleach https://bleach.readthedocs.io/) '
                           'if you are parsing untrusted markdown text. '
                           'See the 2.6 release notes for more info',
                           DeprecationWarning)
diff --git a/markdown/__version__.py b/markdown/__version__.py
index d5bbed4..339f039 100644
--- a/markdown/__version__.py
+++ b/markdown/__version__.py
@@ -5,7 +5,7 @@
 # (major, minor, micro, alpha/beta/rc/final, #)
 # (1, 1, 2, 'alpha', 0) => "1.1.2.dev"
 # (1, 2, 0, 'beta', 2) => "1.2b2"
-version_info = (2, 6, 6, 'final', 0)
+version_info = (2, 6, 7, 'final', 0)
 
 
 def _get_version():
diff --git a/markdown/extensions/attr_list.py b/markdown/extensions/attr_list.py
index 683bdf8..c897a9c 100644
--- a/markdown/extensions/attr_list.py
+++ b/markdown/extensions/attr_list.py
@@ -32,17 +32,17 @@ except AttributeError:  # pragma: no cover
 
 
 def _handle_double_quote(s, t):
-    k, v = t.split('=')
+    k, v = t.split('=', 1)
     return k, v.strip('"')
 
 
 def _handle_single_quote(s, t):
-    k, v = t.split('=')
+    k, v = t.split('=', 1)
     return k, v.strip("'")
 
 
 def _handle_key_value(s, t):
-    return t.split('=')
+    return t.split('=', 1)
 
 
 def _handle_word(s, t):
@@ -53,9 +53,9 @@ def _handle_word(s, t):
     return t, t
 
 _scanner = Scanner([
-    (r'[^ ]+=".*?"', _handle_double_quote),
-    (r"[^ ]+='.*?'", _handle_single_quote),
-    (r'[^ ]+=[^ =]+', _handle_key_value),
+    (r'[^ =]+=".*?"', _handle_double_quote),
+    (r"[^ =]+='.*?'", _handle_single_quote),
+    (r'[^ =]+=[^ =]+', _handle_key_value),
     (r'[^ =]+', _handle_word),
     (r' ', None)
 ])
@@ -72,7 +72,7 @@ def isheader(elem):
 
 class AttrListTreeprocessor(Treeprocessor):
 
-    BASE_RE = r'\{\:?([^\}]*)\}'
+    BASE_RE = r'\{\:?([^\}\n]*)\}'
     HEADER_RE = re.compile(r'[ ]+%s[ ]*$' % BASE_RE)
     BLOCK_RE = re.compile(r'\n[ ]*%s[ ]*$' % BASE_RE)
     INLINE_RE = re.compile(r'^%s' % BASE_RE)
diff --git a/markdown/extensions/fenced_code.py b/markdown/extensions/fenced_code.py
index 4af8891..8c9935e 100644
--- a/markdown/extensions/fenced_code.py
+++ b/markdown/extensions/fenced_code.py
@@ -81,6 +81,7 @@ class FencedBlockPreprocessor(Preprocessor):
                         guess_lang=self.codehilite_conf['guess_lang'][0],
                         css_class=self.codehilite_conf['css_class'][0],
                         style=self.codehilite_conf['pygments_style'][0],
+                        use_pygments=self.codehilite_conf['use_pygments'][0],
                         lang=(m.group('lang') or None),
                         noclasses=self.codehilite_conf['noclasses'][0],
                         hl_lines=parse_hl_lines(m.group('hl_lines'))
diff --git a/markdown/extensions/tables.py b/markdown/extensions/tables.py
index 39c09a4..8c11739 100644
--- a/markdown/extensions/tables.py
+++ b/markdown/extensions/tables.py
@@ -45,6 +45,7 @@ class TableProcessor(BlockProcessor):
         # Get alignment of columns
         align = []
         for c in self._split_row(seperator, border):
+            c = c.strip()
             if c.startswith(':') and c.endswith(':'):
                 align.append('center')
             elif c.startswith(':'):
@@ -73,11 +74,7 @@ class TableProcessor(BlockProcessor):
         for i, a in enumerate(align):
             c = etree.SubElement(tr, tag)
             try:
-                if isinstance(cells[i], str) or isinstance(cells[i], unicode):
-                    c.text = cells[i].strip()
-                else:
-                    # we've already inserted a code element
-                    c.append(cells[i])
+                c.text = cells[i].strip()
             except IndexError:  # pragma: no cover
                 c.text = ""
             if a:
diff --git a/markdown/inlinepatterns.py b/markdown/inlinepatterns.py
index dcf4ad4..6d4c969 100644
--- a/markdown/inlinepatterns.py
+++ b/markdown/inlinepatterns.py
@@ -130,7 +130,7 @@ LINK_RE = NOIMG + BRK + \
     r'''\(\s*(<.*?>|((?:(?:\(.*?\))|[^\(\)]))*?)\s*((['"])(.*?)\12\s*)?\)'''
 
 # ![alttxt](http://x.com/) or ![alttxt](<http://x.com/>)
-IMAGE_LINK_RE = r'\!' + BRK + r'\s*\((<.*?>|([^")]+"[^"]*"|[^\)]*))\)'
+IMAGE_LINK_RE = r'\!' + BRK + r'\s*\(\s*(<.*?>|([^"\)\s]+\s*"[^"]*"|[^\)\s]*))\s*\)'
 
 # [Google][3]
 REFERENCE_RE = NOIMG + BRK + r'\s?\[([^\]]*)\]'
diff --git a/tests/extensions/attr_list.html b/tests/extensions/attr_list.html
index 2a36dbc..4f21d86 100644
--- a/tests/extensions/attr_list.html
+++ b/tests/extensions/attr_list.html
@@ -63,4 +63,7 @@ And a <strong class="nest">nested <a class="linky2" href="http://example.com" ti
 <p>Value without <em>key</em></p>
 <p>No <em>key or value</em></p>
 <p><em>Weirdness</em></p>
-<p><em>More weirdness</em></p>
\ No newline at end of file
+<p><em>More weirdness</em></p>
+<p>This should not cause a <em foo="a">crash</em></p>
+<p>Attr_lists do not contain <em>newlines</em>{ foo=bar
+key=value }</p>
\ No newline at end of file
diff --git a/tests/extensions/attr_list.txt b/tests/extensions/attr_list.txt
index c2adbf4..98f1cc7 100644
--- a/tests/extensions/attr_list.txt
+++ b/tests/extensions/attr_list.txt
@@ -88,3 +88,7 @@ No *key or value*{ = }
 
 *More weirdness*{ === }
 
+This should not cause a *crash*{ foo=a=b }
+
+Attr_lists do not contain *newlines*{ foo=bar
+key=value }
diff --git a/tests/extensions/extra/tables.html b/tests/extensions/extra/tables.html
index 783c205..b5c08be 100644
--- a/tests/extensions/extra/tables.html
+++ b/tests/extensions/extra/tables.html
@@ -38,21 +38,21 @@
 <table>
 <thead>
 <tr>
-<th>Item</th>
+<th align="left">Item</th>
 <th align="right">Value</th>
 </tr>
 </thead>
 <tbody>
 <tr>
-<td>Computer</td>
+<td align="left">Computer</td>
 <td align="right">$1600</td>
 </tr>
 <tr>
-<td>Phone</td>
+<td align="left">Phone</td>
 <td align="right">$12</td>
 </tr>
 <tr>
-<td>Pipe</td>
+<td align="left">Pipe</td>
 <td align="right">$1</td>
 </tr>
 </tbody>
diff --git a/tests/misc/image.html b/tests/misc/image.html
index aa24cef..1171e4e 100644
--- a/tests/misc/image.html
+++ b/tests/misc/image.html
@@ -1,3 +1,5 @@
 <p><img alt="Poster" src="http://humane_man.jpg" title="The most humane man." /></p>
 <p><img alt="Poster" src="http://humane_man.jpg" title="The most humane man." /></p>
-<p><img alt="Blank" src="" /></p>
\ No newline at end of file
+<p><img alt="Blank" src="" /></p>
+<p>![Fail](http://humane man.jpg "The most humane man.")</p>
+<p>![Fail](http://humane man.jpg)</p>
\ No newline at end of file
diff --git a/tests/misc/image.txt b/tests/misc/image.txt
index 41a8cf7..3fae16a 100644
--- a/tests/misc/image.txt
+++ b/tests/misc/image.txt
@@ -5,4 +5,8 @@
 
 [Poster]:http://humane_man.jpg "The most humane man."
 
-![Blank]()
\ No newline at end of file
+![Blank]()
+
+![Fail](http://humane man.jpg "The most humane man.")
+
+![Fail](http://humane man.jpg)
diff --git a/tests/test_extensions.py b/tests/test_extensions.py
index 19a1389..a43de79 100644
--- a/tests/test_extensions.py
+++ b/tests/test_extensions.py
@@ -375,6 +375,18 @@ line 3
                     '#line 3</code></pre>'
                 )
 
+    def testFencedLanguageAndPygmentsDisabled(self):
+        """ Test if fenced_code honors CodeHilite option use_pygments=False. """
+
+        text = '```python\nfrom __future__ import braces\n```'
+        md = markdown.Markdown(
+            extensions=[
+                markdown.extensions.codehilite.CodeHiliteExtension(use_pygments=False),
+                'markdown.extensions.fenced_code'
+            ]
+        )
+        self.assertTrue('<code class="language-python">' in md.convert(text))
+
 
 class TestHeaderId(unittest.TestCase):
     """ Test HeaderId Extension. """

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-markdown.git



More information about the Python-modules-commits mailing list