From 814bc8307953f364085253573e368d3e56d81b3b Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jul 01 2015 07:29:18 +0000 Subject: Move injecting our custom markdown to the backend library, allowing to make it optional This is needed if we want to share code with the docs server while not activating our own markdown syntax in the documentations. --- diff --git a/pagure/__init__.py b/pagure/__init__.py index 0ddb990..3153926 100644 --- a/pagure/__init__.py +++ b/pagure/__init__.py @@ -394,10 +394,6 @@ def get_repo_path(repo): return repopath -# Install our markdown modifications -import pagure.pfmarkdown -pagure.pfmarkdown.inject() - # Import the application import pagure.ui.app import pagure.ui.admin diff --git a/pagure/lib/__init__.py b/pagure/lib/__init__.py index 749bdee..57b238a 100644 --- a/pagure/lib/__init__.py +++ b/pagure/lib/__init__.py @@ -38,6 +38,7 @@ import pagure.exceptions import pagure.lib.git import pagure.lib.login import pagure.lib.notify +import pagure.pfmarkdown from pagure.lib import model # pylint: disable=R0913 @@ -2272,9 +2273,13 @@ def add_token_to_user(session, project, acls, username): return 'Token created' -def text2markdown(text): +def text2markdown(text, extended=True): """ Simple text to html converter using the markdown library. """ + if extended: + # Install our markdown modifications + pagure.pfmarkdown.inject() + if text: # Hack to allow blockquotes to be marked by ~~~ ntext = []