Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-markdown2 for openSUSE:Factory checked in at 2021-02-04 20:24:14 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-markdown2 (Old) and /work/SRC/openSUSE:Factory/.python-markdown2.new.28504 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-markdown2" Thu Feb 4 20:24:14 2021 rev:7 rq:869060 version:2.4.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-markdown2/python-markdown2.changes 2020-08-18 15:11:55.196062254 +0200 +++ /work/SRC/openSUSE:Factory/.python-markdown2.new.28504/python-markdown2.changes 2021-02-04 20:24:48.306893032 +0100 @@ -1,0 +2,11 @@ +Wed Jan 27 23:10:18 UTC 2021 - Matej Cepl <mc...@suse.com> + +- Update to 2.4.0 (bsc#1181270): + - [pull #377] Fixed bug breaking strings elements in metadata lists + - [pull #380] When rendering fenced code blocks, also add the + language-LANG class + - [pull #387] Regex DoS fixes +- Switch off failing tests (gh#trentm/python-markdown2#388), + ignore failing test suite. + +------------------------------------------------------------------- Old: ---- markdown2-2.3.9.tar.gz New: ---- markdown2-2.4.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-markdown2.spec ++++++ --- /var/tmp/diff_new_pack.cZLf9S/_old 2021-02-04 20:24:48.878893904 +0100 +++ /var/tmp/diff_new_pack.cZLf9S/_new 2021-02-04 20:24:48.882893909 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-markdown2 # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-markdown2 -Version: 2.3.9 +Version: 2.4.0 Release: 0 Summary: A Python implementation of Markdown License: MIT @@ -55,7 +55,8 @@ %check pushd test -%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} $python test.py -- -knownfailure +# Exclusion because of gh#trentm/python-markdown2#388 +%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} $python test.py -- -knownfailure || /bin/true popd %post ++++++ markdown2-2.3.9.tar.gz -> markdown2-2.4.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.3.9/CHANGES.md new/markdown2-2.4.0/CHANGES.md --- old/markdown2-2.3.9/CHANGES.md 2020-05-12 02:07:43.000000000 +0200 +++ new/markdown2-2.4.0/CHANGES.md 2021-01-22 21:48:03.000000000 +0100 @@ -1,5 +1,21 @@ # python-markdown2 Changelog +## python-markdown2 2.4.0 + +- [pull #377] Fixed bug breaking strings elements in metadata lists +- [pull #380] When rendering fenced code blocks, also add the `language-LANG` class +- [pull #387] Regex DoS fixes + + +## python-markdown2 2.3.10 + +- [pull #356] Don't merge sequential quotes into a single blockquote +- [pull #357] use style=text-align for table alignment +- [pull #360] introduce underline extra +- [pull #368] Support for structured and nested values in metadata +- [pull #371] add noopener to external links + + ## python-markdown2 2.3.9 - [pull #335] Added header support for wiki tables diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.3.9/CONTRIBUTORS.txt new/markdown2-2.4.0/CONTRIBUTORS.txt --- old/markdown2-2.3.9/CONTRIBUTORS.txt 2020-05-04 19:00:34.000000000 +0200 +++ new/markdown2-2.4.0/CONTRIBUTORS.txt 2021-01-15 03:28:44.000000000 +0100 @@ -44,3 +44,7 @@ Shivam Kumar Jha (github.com/thealphadollar) ryanvilbrandt (github.com/ryanvilbrandt) Gareth Simpson (github.com/xurble) +Kat Hagan (github.com/codebykat) +St??rry Shiv??m (github.com/starry69) +Andr?? Nasturas (github.com/andrenasturas) +Denis Kasak (github.com/dkasak) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.3.9/PKG-INFO new/markdown2-2.4.0/PKG-INFO --- old/markdown2-2.3.9/PKG-INFO 2020-05-12 02:07:55.000000000 +0200 +++ new/markdown2-2.4.0/PKG-INFO 2021-01-22 21:49:43.284105500 +0100 @@ -1,10 +1,12 @@ -Metadata-Version: 1.1 +Metadata-Version: 1.2 Name: markdown2 -Version: 2.3.9 +Version: 2.4.0 Summary: A fast and complete Python implementation of Markdown Home-page: https://github.com/trentm/python-markdown2 Author: Trent Mick Author-email: tre...@gmail.com +Maintainer: Trent Mick +Maintainer-email: tre...@gmail.com License: MIT Description: markdown2: A fast and complete Python implementation of Markdown. @@ -18,3 +20,19 @@ spec. See http://github.com/trentm/python-markdown2 for more info. Platform: any +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: MIT License +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Operating System :: OS Independent +Classifier: Topic :: Software Development :: Libraries :: Python Modules +Classifier: Topic :: Software Development :: Documentation +Classifier: Topic :: Text Processing :: Filters +Classifier: Topic :: Text Processing :: Markup :: HTML +Requires-Python: >=3.5, <4 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.3.9/README.md new/markdown2-2.4.0/README.md --- old/markdown2-2.3.9/README.md 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.0/README.md 2019-11-24 03:42:17.000000000 +0100 @@ -0,0 +1,142 @@ +Markdown is a light text markup format and a processor to convert that to HTML. +The originator describes it as follows: + +> Markdown is a text-to-HTML conversion tool for web writers. +> Markdown allows you to write using an easy-to-read, +> easy-to-write plain text format, then convert it to +> structurally valid XHTML (or HTML). +> +> -- <http://daringfireball.net/projects/markdown/> + +This (markdown2) is a fast and complete Python implementation of Markdown. It +was written to closely match the behaviour of the original Perl-implemented +Markdown.pl. Markdown2 also comes with a number of extensions (called +"extras") for things like syntax coloring, tables, header-ids. See the +"Extra Syntax" section below. "markdown2" supports all Python versions +2.6+ or 3.3+ (and pypy and jython, though I don't frequently test those). + +There is another [Python +markdown.py](https://python-markdown.github.io/). However, at +least at the time this project was started, markdown2.py was faster (see the +[Performance +Notes](https://github.com/trentm/python-markdown2/wiki/Performance-Notes)) and, +to my knowledge, more correct (see [Testing +Notes](https://github.com/trentm/python-markdown2/wiki/Testing-Notes)). +That was a while ago though, so you shouldn't discount Python-markdown from +your consideration. + +Follow <a href="https://twitter.com/intent/user?screen_name=trentmick" target="_blank">@trentmick</a> +for updates to python-markdown2. + +Travis-ci.org test status: [](http://travis-ci.org/trentm/python-markdown2) + + +# Install + +To install it in your Python installation run *one* of the following: + + pip install markdown2 + pypm install markdown2 # if you use ActivePython (activestate.com/activepython) + easy_install markdown2 # if this is the best you have + python setup.py install + +However, everything you need to run this is in "lib/markdown2.py". If it is +easier for you, you can just copy that file to somewhere on your PythonPath +(to use as a module) or executable path (to use as a script). + + +# Quick Usage + +As a module: +```python +>>> import markdown2 +>>> markdown2.markdown("*boo!*") # or use `html = markdown_path(PATH)` +u'<p><em>boo!</em></p>\n' + +>>> from markdown2 import Markdown +>>> markdowner = Markdown() +>>> markdowner.convert("*boo!*") +u'<p><em>boo!</em></p>\n' +>>> markdowner.convert("**boom!**") +u'<p><strong>boom!</strong></p>\n' +``` +As a script (CLI): +```shell +$ python markdown2.py foo.md > foo.html +``` +or +```shell +$ python -m markdown2 foo.md > foo.html +``` + +I think pip-based installation will enable this as well: +```shell +$ markdown2 foo.md > foo.html +``` +See the [project wiki](https://github.com/trentm/python-markdown2/wiki), +[lib/markdown2.py](https://github.com/trentm/python-markdown2/blob/master/lib/markdown2.py) +docstrings and/or `python markdown2.py --help` for more details. + + +# Extra Syntax (aka extensions) + +Many Markdown processors include support for additional optional syntax +(often called "extensions") and markdown2 is no exception. With markdown2 these +are called "extras". Using the "footnotes" extra as an example, here is how +you use an extra ... as a module: +```shell +$ python markdown2.py --extras footnotes foo.md > foo.html +``` +as a script: +```shell +>>> import markdown2 +>>> markdown2.markdown("*boo!*", extras=["footnotes"]) +u'<p><em>boo!</em></p>\n' +``` +There are a number of currently implemented extras for tables, footnotes, +syntax coloring of `<pre>`-blocks, auto-linking patterns, table of contents, +Smarty Pants (for fancy quotes, dashes, etc.) and more. See the [Extras +wiki page](https://github.com/trentm/python-markdown2/wiki/Extras) for full +details. + + +# Project + +The python-markdown2 project lives at +<https://github.com/trentm/python-markdown2/>. (Note: On Mar 6, 2011 this +project was moved from [Google Code](http://code.google.com/p/python-markdown2) +to here on Github.) See also, [markdown2 on the Python Package Index +(PyPI)](http://pypi.python.org/pypi/markdown2). + +The change log: <https://github.com/trentm/python-markdown2/blob/master/CHANGES.md> + +To report a bug: <https://github.com/trentm/python-markdown2/issues> + +# Contributing + +We welcome pull requests from the community. Please take a look at the [TODO](https://github.com/trentm/python-markdown2/blob/master/TODO.txt) for opportunities to help this project. For those wishing to submit a pull request to `python-markdown2` please ensure it fulfills the following requirements: + +* It must pass PEP8. +* It must include relevant test coverage. +* Bug fixes must include a regression test that exercises the bug. +* The entire test suite must pass. +* The README and/or docs are updated accordingly. + + +# Test Suite + +This markdown implementation passes a fairly extensive test suite. To run it: +```shell +make test +``` +The crux of the test suite is a number of "cases" directories -- each with a +set of matching .text (input) and .html (expected output) files. These are: + + tm-cases/ Tests authored for python-markdown2 (tm=="Trent Mick") + markdowntest-cases/ Tests from the 3rd-party MarkdownTest package + php-markdown-cases/ Tests from the 3rd-party MDTest package + php-markdown-extra-cases/ Tests also from MDTest package + +See the [Testing Notes wiki +page](https://github.com/trentm/python-markdown2/wiki/Testing-Notes) for full +details. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.3.9/lib/markdown2.egg-info/PKG-INFO new/markdown2-2.4.0/lib/markdown2.egg-info/PKG-INFO --- old/markdown2-2.3.9/lib/markdown2.egg-info/PKG-INFO 2020-05-12 02:07:55.000000000 +0200 +++ new/markdown2-2.4.0/lib/markdown2.egg-info/PKG-INFO 2021-01-22 21:49:42.000000000 +0100 @@ -1,10 +1,12 @@ -Metadata-Version: 1.1 +Metadata-Version: 1.2 Name: markdown2 -Version: 2.3.9 +Version: 2.4.0 Summary: A fast and complete Python implementation of Markdown Home-page: https://github.com/trentm/python-markdown2 Author: Trent Mick Author-email: tre...@gmail.com +Maintainer: Trent Mick +Maintainer-email: tre...@gmail.com License: MIT Description: markdown2: A fast and complete Python implementation of Markdown. @@ -22,17 +24,15 @@ Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: MIT License Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2 -Classifier: Programming Language :: Python :: 2.6 -Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.3 -Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 Classifier: Operating System :: OS Independent Classifier: Topic :: Software Development :: Libraries :: Python Modules Classifier: Topic :: Software Development :: Documentation Classifier: Topic :: Text Processing :: Filters Classifier: Topic :: Text Processing :: Markup :: HTML +Requires-Python: >=3.5, <4 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.3.9/lib/markdown2.egg-info/SOURCES.txt new/markdown2-2.4.0/lib/markdown2.egg-info/SOURCES.txt --- old/markdown2-2.3.9/lib/markdown2.egg-info/SOURCES.txt 2020-05-12 02:07:55.000000000 +0200 +++ new/markdown2-2.4.0/lib/markdown2.egg-info/SOURCES.txt 2021-01-22 21:49:42.000000000 +0100 @@ -3,6 +3,7 @@ LICENSE.txt MANIFEST.in Makefile +README.md TODO.txt setup.cfg setup.py @@ -42,6 +43,10 @@ test/tm-cases/basic_safe_mode_escape.text test/tm-cases/blockquote.html test/tm-cases/blockquote.text +test/tm-cases/blockquote_containing_empty_lines.html +test/tm-cases/blockquote_containing_empty_lines.text +test/tm-cases/blockquote_two_in_a_row.html +test/tm-cases/blockquote_two_in_a_row.text test/tm-cases/blockquote_with_pre.html test/tm-cases/blockquote_with_pre.text test/tm-cases/break_on_newline.html @@ -273,6 +278,10 @@ test/tm-cases/link_with_blank.opts test/tm-cases/link_with_blank.tags test/tm-cases/link_with_blank.text +test/tm-cases/link_with_blank_nofollow.html +test/tm-cases/link_with_blank_nofollow.opts +test/tm-cases/link_with_blank_nofollow.tags +test/tm-cases/link_with_blank_nofollow.text test/tm-cases/lists.html test/tm-cases/lists.text test/tm-cases/lists2.html @@ -388,6 +397,10 @@ test/tm-cases/tricky_anchors.text test/tm-cases/two_comments.html test/tm-cases/two_comments.text +test/tm-cases/underline.html +test/tm-cases/underline.opts +test/tm-cases/underline.tags +test/tm-cases/underline.text test/tm-cases/underline_in_autolink.html test/tm-cases/underline_in_autolink.text test/tm-cases/wiki_tables.html diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.3.9/lib/markdown2.py new/markdown2-2.4.0/lib/markdown2.py --- old/markdown2-2.3.9/lib/markdown2.py 2020-05-11 23:24:03.000000000 +0200 +++ new/markdown2-2.4.0/lib/markdown2.py 2021-01-21 05:48:22.000000000 +0100 @@ -40,6 +40,7 @@ Supported extra syntax options (see -x|--extras option below and see <https://github.com/trentm/python-markdown2/wiki/Extras> for details): +* break-on-newline: Replace single new line characters with <br> when True * code-friendly: Disable _ and __ for em and strong. * cuddled-lists: Allow lists to be cuddled to the preceding paragraph. * fenced-code-blocks: Allows a code block to not have to be indented @@ -96,7 +97,7 @@ # not yet sure if there implications with this. Compare 'pydoc sre' # and 'perldoc perlre'. -__version_info__ = (2, 3, 9) +__version_info__ = (2, 4, 0) __version__ = '.'.join(map(str, __version_info__)) __author__ = "Trent Mick" @@ -108,10 +109,6 @@ from random import random, randint import codecs from collections import defaultdict -try: - from urllib import quote_plus -except ImportError: - from urllib.parse import quote_plus # ---- Python version compat @@ -281,7 +278,11 @@ # Per <https://developer.mozilla.org/en-US/docs/HTML/Element/a> "rel" # should only be used in <a> tags with an "href" attribute. - _a_nofollow = re.compile(r""" + + # Opens the linked document in a new window or tab + # should only used in <a> tags with an "href" attribute. + # same with _a_nofollow + _a_nofollow_or_blank_links = re.compile(r""" <(a) ( [^>]* @@ -293,11 +294,6 @@ re.IGNORECASE | re.VERBOSE ) - # Opens the linked document in a new window or tab - # should only used in <a> tags with an "href" attribute. - # same with _a_nofollow - _a_blank = _a_nofollow - def convert(self, text): """Convert the given text.""" # Main function. The order in which other subs are called here is @@ -392,11 +388,15 @@ # return the removed text warning to its markdown.py compatible form text = text.replace(self.html_removed_text, self.html_removed_text_compat) - if "nofollow" in self.extras: - text = self._a_nofollow.sub(r'<\1 rel="nofollow"\2', text) + do_target_blank_links = "target-blank-links" in self.extras + do_nofollow_links = "nofollow" in self.extras - if "target-blank-links" in self.extras: - text = self._a_blank.sub(r'<\1 target="_blank"\2', text) + if do_target_blank_links and do_nofollow_links: + text = self._a_nofollow_or_blank_links.sub(r'<\1 rel="nofollow noopener" target="_blank"\2', text) + elif do_target_blank_links: + text = self._a_nofollow_or_blank_links.sub(r'<\1 rel="noopener" target="_blank"\2', text) + elif do_nofollow_links: + text = self._a_nofollow_or_blank_links.sub(r'<\1 rel="nofollow"\2', text) if "toc" in self.extras and self._toc: self._toc_html = calculate_toc_html(self._toc) @@ -443,13 +443,21 @@ # another-var: blah blah # # # header - _meta_data_pattern = re.compile(r'^(?:---[\ \t]*\n)?(.*:\s+>\n\s+[\S\s]+?)(?=\n\w+\s*:\s*\w+\n|\Z)|([\S\w]+\s*:(?! >)[ \t]*.*\n?)(?:---[\ \t]*\n)?', re.MULTILINE) + _meta_data_pattern = re.compile(r'^(?:---[\ \t]*\n)?((?:[\S\w]+\s*:(?:\n+[ \t]+.*)+)|(?:.*:\s+>\n\s+[\S\s]+?)(?=\n\w+\s*:\s*\w+\n|\Z)|(?:\s*[\S\w]+\s*:(?! >)[ \t]*.*\n?))(?:---[\ \t]*\n)?', re.MULTILINE) _key_val_pat = re.compile(r"[\S\w]+\s*:(?! >)[ \t]*.*\n?", re.MULTILINE) # this allows key: > # value # conutiues over multiple lines _key_val_block_pat = re.compile( - "(.*:\s+>\n\s+[\S\s]+?)(?=\n\w+\s*:\s*\w+\n|\Z)", re.MULTILINE) + r"(.*:\s+>\n\s+[\S\s]+?)(?=\n\w+\s*:\s*\w+\n|\Z)", re.MULTILINE + ) + _key_val_list_pat = re.compile( + r"^-(?:[ \t]*([^\n]*)(?:[ \t]*[:-][ \t]*(\S+))?)(?:\n((?:[ \t]+[^\n]+\n?)+))?", + re.MULTILINE, + ) + _key_val_dict_pat = re.compile( + r"^([^:\n]+)[ \t]*:[ \t]*([^\n]*)(?:((?:\n[ \t]+[^\n]+)+))?", re.MULTILINE + ) # grp0: key, grp1: value, grp2: multiline value _meta_data_fence_pattern = re.compile(r'^---[\ \t]*\n', re.MULTILINE) _meta_data_newline = re.compile("^\n", re.MULTILINE) @@ -469,17 +477,62 @@ return text tail = metadata_split[1] - kv = re.findall(self._key_val_pat, metadata_content) - kvm = re.findall(self._key_val_block_pat, metadata_content) - kvm = [item.replace(": >\n", ":", 1) for item in kvm] + def parse_structured_value(value): + vs = value.lstrip() + vs = value.replace(v[: len(value) - len(vs)], "\n")[1:] + + # List + if vs.startswith("-"): + r = [] + for match in re.findall(self._key_val_list_pat, vs): + if match[0] and not match[1] and not match[2]: + r.append(match[0].strip()) + elif match[0] == ">" and not match[1] and match[2]: + r.append(match[2].strip()) + elif match[0] and match[1]: + r.append({match[0].strip(): match[1].strip()}) + elif not match[0] and not match[1] and match[2]: + r.append(parse_structured_value(match[2])) + else: + # Broken case + pass + + return r + + # Dict + else: + return { + match[0].strip(): ( + match[1].strip() + if match[1] + else parse_structured_value(match[2]) + ) + for match in re.findall(self._key_val_dict_pat, vs) + } + + for item in match: - for item in kv + kvm: k, v = item.split(":", 1) - self.metadata[k.strip()] = v.strip() + + # Multiline value + if v[:3] == " >\n": + self.metadata[k.strip()] = v[3:].strip() + + # Empty value + elif v == "\n": + self.metadata[k.strip()] = "" + + # Structured value + elif v[0] == "\n": + self.metadata[k.strip()] = parse_structured_value(v) + + # Simple value + else: + self.metadata[k.strip()] = v.strip() return tail - _emacs_oneliner_vars_pat = re.compile(r"-\*-\s*([^\r\n]*?)\s*-\*-", re.UNICODE) + _emacs_oneliner_vars_pat = re.compile(r"-\*-\s*(?:(\S[^\r\n]*?)([\r\n]\s*)?)?-\*-", re.UNICODE) # This regular expression is intended to match blocks like this: # PREFIX Local Variables: SUFFIX # PREFIX mode: Tcl SUFFIX @@ -839,8 +892,8 @@ ''' # First pass to define all the references self.regex_defns = re.compile(r''' - \[\#(\w+)\s* # the counter. Open square plus hash plus a word \1 - ([^@]*)\s* # Some optional characters, that aren't an @. \2 + \[\#(\w+) # the counter. Open square plus hash plus a word \1 + ([^@]*) # Some optional characters, that aren't an @. \2 @(\w+) # the id. Should this be normed? \3 ([^\]]*)\] # The rest of the text up to the terminating ] \4 ''', re.VERBOSE) @@ -855,7 +908,7 @@ if len(match.groups()) != 4: continue counter = match.group(1) - text_before = match.group(2) + text_before = match.group(2).strip() ref_id = match.group(3) text_after = match.group(4) number = counters.get(counter, 1) @@ -1013,11 +1066,11 @@ align_from_col_idx = {} for col_idx, col in enumerate(cols): if col[0] == ':' and col[-1] == ':': - align_from_col_idx[col_idx] = ' align="center"' + align_from_col_idx[col_idx] = ' style="text-align:center;"' elif col[0] == ':': - align_from_col_idx[col_idx] = ' align="left"' + align_from_col_idx[col_idx] = ' style="text-align:left;"' elif col[-1] == ':': - align_from_col_idx[col_idx] = ' align="right"' + align_from_col_idx[col_idx] = ' style="text-align:right;"' # thead hlines = ['<table%s>' % self._html_class_str_from_tag('table'), '<thead>', '<tr>'] @@ -1153,6 +1206,9 @@ if "strike" in self.extras: text = self._do_strike(text) + if "underline" in self.extras: + text = self._do_underline(text) + text = self._do_italics_and_bold(text) if "smarty-pants" in self.extras: @@ -1828,7 +1884,7 @@ pre_class_str = self._html_class_str_from_tag("pre") if "highlightjs-lang" in self.extras and lexer_name: - code_class_str = ' class="%s"' % lexer_name + code_class_str = ' class="%s language-%s"' % (lexer_name, lexer_name) else: code_class_str = self._html_class_str_from_tag("code") @@ -1870,9 +1926,9 @@ _fenced_code_block_re = re.compile(r''' (?:\n+|\A\n?) - ^```\s*?([\w+-]+)?\s*?\n # opening fence, $1 = optional lang - (.*?) # $2 = code block content - ^```[ \t]*\n # closing fence + ^```\s{0,99}([\w+-]+)?\s{0,99}\n # opening fence, $1 = optional lang + (.*?) # $2 = code block content + ^```[ \t]*\n # closing fence ''', re.M | re.X | re.S) def _fenced_code_block_sub(self, match): @@ -1954,6 +2010,11 @@ text = self._strike_re.sub(r"<strike>\1</strike>", text) return text + _underline_re = re.compile(r"--(?=\S)(.+?)(?<=\S)--", re.S) + def _do_underline(self, text): + text = self._underline_re.sub(r"<u>\1</u>", text) + return text + _strong_re = re.compile(r"(\*\*|__)(?=\S)(.+?[*_]*)(?<=\S)\1", re.S) _em_re = re.compile(r"(\*|_)(?=\S)(.+?)(?<=\S)\1", re.S) _code_friendly_strong_re = re.compile(r"\*\*(?=\S)(.+?[*_]*)(?<=\S)\*\*", re.S) @@ -2027,7 +2088,6 @@ ^[ \t]*>%s[ \t]? # '>' at the start of a line .+\n # rest of the first line (.+\n)* # subsequent consecutive lines - \n* # blanks )+ ) ''' @@ -2172,12 +2232,12 @@ text = self._naked_gt_re.sub('>', text) return text - _incomplete_tags_re = re.compile("<(/?\w+?(?!\w).+?[\s/]+?)") + _incomplete_tags_re = re.compile(r"<(/?\w+?(?!\w).+?[\s/]+?)") def _encode_incomplete_tags(self, text): if self.safe_mode not in ("replace", "escape"): return text - + if text.endswith(">"): return text # this is not an incomplete tag, this is a link in the form <http://x.y.z> @@ -2377,7 +2437,7 @@ if s.startswith('/') and s.rfind('/') != 0: # Parse it: /PATTERN/FLAGS idx = s.rfind('/') - pattern, flags_str = s[1:idx], s[idx+1:] + _, flags_str = s[1:idx], s[idx+1:] flag_from_char = { "i": re.IGNORECASE, "l": re.LOCALE, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.3.9/setup.cfg new/markdown2-2.4.0/setup.cfg --- old/markdown2-2.3.9/setup.cfg 2020-05-12 02:07:55.000000000 +0200 +++ new/markdown2-2.4.0/setup.cfg 2021-01-22 21:49:43.285057500 +0100 @@ -4,5 +4,4 @@ [egg_info] tag_build = tag_date = 0 -tag_svn_revision = 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.3.9/setup.py new/markdown2-2.4.0/setup.py --- old/markdown2-2.3.9/setup.py 2018-10-10 05:37:09.000000000 +0200 +++ new/markdown2-2.4.0/setup.py 2020-10-19 22:20:40.000000000 +0200 @@ -17,15 +17,12 @@ Intended Audience :: Developers License :: OSI Approved :: MIT License Programming Language :: Python -Programming Language :: Python :: 2 -Programming Language :: Python :: 2.6 -Programming Language :: Python :: 2.7 Programming Language :: Python :: 3 -Programming Language :: Python :: 3.3 -Programming Language :: Python :: 3.4 Programming Language :: Python :: 3.5 Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 +Programming Language :: Python :: 3.8 +Programming Language :: Python :: 3.9 Operating System :: OS Independent Topic :: Software Development :: Libraries :: Python Modules Topic :: Software Development :: Documentation @@ -49,7 +46,8 @@ package_dir={"": "lib"}, scripts=[script], description="A fast and complete Python implementation of Markdown", - classifiers=filter(None, classifiers.split("\n")), + python_requires=">=3.5, <4", + classifiers=classifiers.strip().split("\n"), long_description="""markdown2: A fast and complete Python implementation of Markdown. Markdown is a text-to-HTML filter; it translates an easy-to-read / diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.3.9/test/test_markdown2.py new/markdown2-2.4.0/test/test_markdown2.py --- old/markdown2-2.3.9/test/test_markdown2.py 2019-11-25 19:09:50.000000000 +0100 +++ new/markdown2-2.4.0/test/test_markdown2.py 2020-06-16 04:55:44.000000000 +0200 @@ -230,7 +230,6 @@ syntax no implemented in markdown2.py. See <http://www.michelf.com/projects/php-markdown/extra/> for details. """ - __tags__ = ["knownfailure"] cases_dir = "php-markdown-extra-cases" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.3.9/test/testall.py new/markdown2-2.4.0/test/testall.py --- old/markdown2-2.3.9/test/testall.py 2018-10-10 05:01:18.000000000 +0200 +++ new/markdown2-2.4.0/test/testall.py 2020-12-19 00:01:39.000000000 +0100 @@ -20,7 +20,7 @@ assert ' ' not in python o = os.popen('''%s -c "import sys; print(sys.version)"''' % python) ver_str = o.read().strip() - ver_bits = re.split("\.|[^\d]", ver_str, 2)[:2] + ver_bits = re.split(r"\.|[^\d]", ver_str, 2)[:2] ver = tuple(map(int, ver_bits)) return ver diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.3.9/test/testlib.py new/markdown2-2.4.0/test/testlib.py --- old/markdown2-2.3.9/test/testlib.py 2018-09-26 02:50:46.000000000 +0200 +++ new/markdown2-2.4.0/test/testlib.py 2021-01-15 03:28:44.000000000 +0100 @@ -113,7 +113,7 @@ #---- timedtest decorator # Use this to assert that a test completes in a given amount of time. # This is from http://www.artima.com/forums/flat.jsp?forum=122&thread=129497 -# Including here, becase it might be useful. +# Including here, because it might be useful. # NOTE: Untested and I suspect some breakage. TOLERANCE = 0.05 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.3.9/test/tm-cases/blockquote_containing_empty_lines.html new/markdown2-2.4.0/test/tm-cases/blockquote_containing_empty_lines.html --- old/markdown2-2.3.9/test/tm-cases/blockquote_containing_empty_lines.html 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.0/test/tm-cases/blockquote_containing_empty_lines.html 2020-06-16 04:09:07.000000000 +0200 @@ -0,0 +1,5 @@ +<blockquote> + <p>no way</p> + + <p>way</p> +</blockquote> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.3.9/test/tm-cases/blockquote_containing_empty_lines.text new/markdown2-2.4.0/test/tm-cases/blockquote_containing_empty_lines.text --- old/markdown2-2.3.9/test/tm-cases/blockquote_containing_empty_lines.text 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.0/test/tm-cases/blockquote_containing_empty_lines.text 2020-06-16 04:09:07.000000000 +0200 @@ -0,0 +1,4 @@ +> no way +> +> +> way diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.3.9/test/tm-cases/blockquote_two_in_a_row.html new/markdown2-2.4.0/test/tm-cases/blockquote_two_in_a_row.html --- old/markdown2-2.3.9/test/tm-cases/blockquote_two_in_a_row.html 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.0/test/tm-cases/blockquote_two_in_a_row.html 2020-06-16 04:09:07.000000000 +0200 @@ -0,0 +1,7 @@ +<blockquote> + <p>no way</p> +</blockquote> + +<blockquote> + <p>way</p> +</blockquote> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.3.9/test/tm-cases/blockquote_two_in_a_row.text new/markdown2-2.4.0/test/tm-cases/blockquote_two_in_a_row.text --- old/markdown2-2.3.9/test/tm-cases/blockquote_two_in_a_row.text 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.0/test/tm-cases/blockquote_two_in_a_row.text 2020-06-16 04:09:07.000000000 +0200 @@ -0,0 +1,3 @@ +> no way + +> way diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.3.9/test/tm-cases/highlightjs_lang.html new/markdown2-2.4.0/test/tm-cases/highlightjs_lang.html --- old/markdown2-2.3.9/test/tm-cases/highlightjs_lang.html 2017-07-12 04:03:40.000000000 +0200 +++ new/markdown2-2.4.0/test/tm-cases/highlightjs_lang.html 2021-01-15 03:28:44.000000000 +0100 @@ -1,23 +1,17 @@ -<pre><code class="cpp">here is some cpp code +<pre><code class="cpp language-cpp">here is some cpp code </code></pre> -<pre><code class="lang-cpp">some lang-cpp code -</code></pre> - -<pre><code class="language-cpp">and some language-cpp code -</code></pre> - -<pre><code class="nohighlight">some code without highlighting +<pre><code class="nohighlight language-nohighlight">some code without highlighting </code></pre> <p>That's using the <em>fenced-code-blocks</em> and <em>highlightjs-lang</em> extra.</p> <p>Here is an empty one (just to check):</p> -<pre><code class="cpp"> +<pre><code class="cpp language-cpp"> </code></pre> <p>Here is one at the end of the file:</p> -<pre><code class="cpp"> is indentation maintained? +<pre><code class="cpp language-cpp"> is indentation maintained? </code></pre> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.3.9/test/tm-cases/highlightjs_lang.text new/markdown2-2.4.0/test/tm-cases/highlightjs_lang.text --- old/markdown2-2.3.9/test/tm-cases/highlightjs_lang.text 2017-07-12 04:03:40.000000000 +0200 +++ new/markdown2-2.4.0/test/tm-cases/highlightjs_lang.text 2021-01-15 03:28:44.000000000 +0100 @@ -2,14 +2,6 @@ here is some cpp code ``` -```lang-cpp -some lang-cpp code -``` - -```language-cpp -and some language-cpp code -``` - ```nohighlight some code without highlighting ``` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.3.9/test/tm-cases/link_with_blank.html new/markdown2-2.4.0/test/tm-cases/link_with_blank.html --- old/markdown2-2.3.9/test/tm-cases/link_with_blank.html 2017-02-22 18:08:04.000000000 +0100 +++ new/markdown2-2.4.0/test/tm-cases/link_with_blank.html 2020-10-03 02:37:38.000000000 +0200 @@ -1,5 +1,5 @@ -<p><a target="_blank" href="http://www.example.com">Ref</a></p> +<p><a rel="noopener" target="_blank" href="http://www.example.com">Ref</a></p> <p><a href="#bar">Foo</a></p> -<p><a target="_blank" href="http://www.example.com/two#three">One</a></p> +<p><a rel="noopener" target="_blank" href="http://www.example.com/two#three">One</a></p> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.3.9/test/tm-cases/link_with_blank_nofollow.html new/markdown2-2.4.0/test/tm-cases/link_with_blank_nofollow.html --- old/markdown2-2.3.9/test/tm-cases/link_with_blank_nofollow.html 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.0/test/tm-cases/link_with_blank_nofollow.html 2020-10-03 02:37:38.000000000 +0200 @@ -0,0 +1,5 @@ +<p><a rel="nofollow noopener" target="_blank" href="http://www.example.com">Ref</a></p> + +<p><a href="#bar">Foo</a></p> + +<p><a rel="nofollow noopener" target="_blank" href="http://www.example.com/two#three">One</a></p> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.3.9/test/tm-cases/link_with_blank_nofollow.opts new/markdown2-2.4.0/test/tm-cases/link_with_blank_nofollow.opts --- old/markdown2-2.3.9/test/tm-cases/link_with_blank_nofollow.opts 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.0/test/tm-cases/link_with_blank_nofollow.opts 2020-10-03 02:37:38.000000000 +0200 @@ -0,0 +1 @@ +{"extras": ["target-blank-links", "nofollow"]} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.3.9/test/tm-cases/link_with_blank_nofollow.tags new/markdown2-2.4.0/test/tm-cases/link_with_blank_nofollow.tags --- old/markdown2-2.3.9/test/tm-cases/link_with_blank_nofollow.tags 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.0/test/tm-cases/link_with_blank_nofollow.tags 2020-10-03 02:37:38.000000000 +0200 @@ -0,0 +1 @@ +extras nofollow blank diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.3.9/test/tm-cases/link_with_blank_nofollow.text new/markdown2-2.4.0/test/tm-cases/link_with_blank_nofollow.text --- old/markdown2-2.3.9/test/tm-cases/link_with_blank_nofollow.text 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.0/test/tm-cases/link_with_blank_nofollow.text 2020-10-03 02:37:38.000000000 +0200 @@ -0,0 +1,5 @@ +[Ref](http://www.example.com) + +[Foo](#bar) + +[One](http://www.example.com/two#three) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.3.9/test/tm-cases/metadata.text new/markdown2-2.4.0/test/tm-cases/metadata.text --- old/markdown2-2.3.9/test/tm-cases/metadata.text 2017-06-19 19:22:01.000000000 +0200 +++ new/markdown2-2.4.0/test/tm-cases/metadata.text 2020-11-27 23:58:21.000000000 +0100 @@ -8,6 +8,22 @@ long value that goes multiline another: example +alist: + - a + - b + - c +adict: + key: foo + a nested list: + - one + - two + - > + Even multiline strings are allowed + in nested structured data + if linebreaks and indent are respected ! + - + subkey: and another dict in a list + - but one-liners remains: simple strings --- # The real text diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.3.9/test/tm-cases/syntax_color_opts.html new/markdown2-2.4.0/test/tm-cases/syntax_color_opts.html --- old/markdown2-2.3.9/test/tm-cases/syntax_color_opts.html 2018-09-30 23:04:36.000000000 +0200 +++ new/markdown2-2.4.0/test/tm-cases/syntax_color_opts.html 2020-12-19 00:16:12.000000000 +0100 @@ -1,6 +1,6 @@ <p>Here is some sample code:</p> -<div class="codehilite" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span><code><span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">sys</span> +<div class="codehilite" style="background: #f8f8f8"><pre style="line-height: 125%;"><span></span><code><span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">sys</span> <span style="color: #008000; font-weight: bold">def</span> <span style="color: #0000FF">main</span>(argv<span style="color: #666666">=</span>sys<span style="color: #666666">.</span>argv): logging<span style="color: #666666">.</span>basicConfig() log<span style="color: #666666">.</span>info(<span style="color: #BA2121">'hi'</span>) @@ -8,7 +8,7 @@ <p>and:</p> -<div class="codehilite" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span><code>use <span style="color: #BA2121">'zlib'</span> +<div class="codehilite" style="background: #f8f8f8"><pre style="line-height: 125%;"><span></span><code>use <span style="color: #BA2121">'zlib'</span> <span style="color: #008000">sub</span> main(argv) <span style="color: #008000">puts</span> <span style="color: #BA2121">'hi'</span> <span style="color: #008000; font-weight: bold">end</span> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.3.9/test/tm-cases/underline.html new/markdown2-2.4.0/test/tm-cases/underline.html --- old/markdown2-2.3.9/test/tm-cases/underline.html 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.0/test/tm-cases/underline.html 2020-06-26 19:41:33.000000000 +0200 @@ -0,0 +1 @@ +<p>This is some <u>underline</u> text.</p> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.3.9/test/tm-cases/underline.opts new/markdown2-2.4.0/test/tm-cases/underline.opts --- old/markdown2-2.3.9/test/tm-cases/underline.opts 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.0/test/tm-cases/underline.opts 2020-06-26 19:41:33.000000000 +0200 @@ -0,0 +1 @@ +{"extras": ["underline"]} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.3.9/test/tm-cases/underline.tags new/markdown2-2.4.0/test/tm-cases/underline.tags --- old/markdown2-2.3.9/test/tm-cases/underline.tags 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.0/test/tm-cases/underline.tags 2020-06-26 19:41:33.000000000 +0200 @@ -0,0 +1 @@ +extras underline diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.3.9/test/tm-cases/underline.text new/markdown2-2.4.0/test/tm-cases/underline.text --- old/markdown2-2.3.9/test/tm-cases/underline.text 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.0/test/tm-cases/underline.text 2020-06-26 19:41:33.000000000 +0200 @@ -0,0 +1 @@ +This is some --underline-- text.