pagure/0002-Fix-Markdown-usage-to-work-with-Markdown-3.0.patch
Neal Gompa c36f891d8a - Update to 5.2
+ Add support for the MQTT protocol
  + Add support for mirroring in git repositories from outside sources
  + Add support to merge a PR when the fork was deleted
  + Add the ability to generate archive from a commit or tag
  + Allow searching the content of the comments on an issue tracker
  + Allow filtering the issue list by the close status
  + Show related PRs on the issue list if there are any
  + Add build status to pull requests page
  + Add new API endpoints for get and set project options
  + Add WIP/experimental/unstable support for third-party extensions to pagure
  + Add support for rebasing pull-requests
  + Implement a button to rerun CI tests on a pull request
  + Support disallowing remote pull requests
  + Add an about page in the themes
  + Update the chameleon theme
- Backport fix from master to allow using python-redis >= 3.0.0
  + Patch: 0001-Allow-using-Pagure-with-python-redis-3.0.0.patch
- Backport fix from master to fix compatibility with Markdown 3.0+
  + Patch: 0002-Fix-Markdown-usage-to-work-with-Markdown-3.0.patch
- Drop patches that are part of this release
  + 0001-Port-pagure-to-markdown-3.0-while-remaining-backward.patch
  + 0002-Bypass-old-hooks-rather-than-using-non-existing-syml.patch

OBS-URL: https://build.opensuse.org/package/show/devel:tools:scm/pagure?expand=0&rev=12
2019-01-10 13:14:31 +00:00

68 lines
2.5 KiB
Diff

From f5f4b297b2cee938e7e13064c7e55ef7c6426bfd Mon Sep 17 00:00:00 2001
From: Neal Gompa <ngompa13@gmail.com>
Date: Wed, 9 Jan 2019 08:39:41 -0500
Subject: [PATCH 2/2] Fix Markdown usage to work with Markdown 3.0+
Markdown 3.0 and later no longer considers the emphasis modifiers
to be an extension, and has them always enabled. We still enable
the 'smart_strong' extension when we detect older versions of
Markdown to retain backward compatibility.
Signed-off-by: Neal Gompa <ngompa13@gmail.com>
---
pagure/lib/query.py | 11 ++++++++++-
tests/test_pagure_lib.py | 7 +++++--
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/pagure/lib/query.py b/pagure/lib/query.py
index 86bda508..ae561196 100644
--- a/pagure/lib/query.py
+++ b/pagure/lib/query.py
@@ -4237,7 +4237,6 @@ def text2markdown(text, extended=True, readme=False):
"markdown.extensions.def_list",
"markdown.extensions.fenced_code",
"markdown.extensions.tables",
- "markdown.extensions.smart_strong",
# All of the above are the .extra extensions
# w/o the "attribute lists" one
"markdown.extensions.admonition",
@@ -4245,6 +4244,16 @@ def text2markdown(text, extended=True, readme=False):
"markdown.extensions.sane_lists",
"markdown.extensions.toc",
]
+
+ # smart_strong is not an extension anymore in markdown 3.0+
+ try:
+ md_version = markdown.__version__.version_info
+ except AttributeError: # pragma: no cover
+ md_version = markdown.__version_info__
+
+ if md_version < (3, 0, 0):
+ extensions.append("markdown.extensions.smart_strong")
+
# Some extensions are enabled for READMEs and disabled otherwise
if readme:
extensions.extend(
diff --git a/tests/test_pagure_lib.py b/tests/test_pagure_lib.py
index 50ddab1a..cbb81adc 100644
--- a/tests/test_pagure_lib.py
+++ b/tests/test_pagure_lib.py
@@ -5018,9 +5018,12 @@ class PagureLibtests(tests.Modeltests):
def test_text2markdown_table(self):
""" Test the text2markdown function with a markdown table. """
- v = tuple([int(c) for c in markdown.version.split('.')])
+ try:
+ md_version = markdown.__version__.version_info
+ except AttributeError:
+ md_version = markdown.__version_info__
- if v < (2, 6, 7):
+ if md_version < (2, 6, 7):
raise unittest.case.SkipTest(
'Skipping on old markdown that do not strip the orientation row'
)
--
2.20.1