forked from orbit-oss/flask
Merge branch '1.1.x'
This commit is contained in:
commit
0adbaf270a
2 changed files with 5 additions and 3 deletions
|
|
@ -1,3 +1,5 @@
|
||||||
|
import packaging
|
||||||
|
|
||||||
from pallets_sphinx_themes import get_version
|
from pallets_sphinx_themes import get_version
|
||||||
from pallets_sphinx_themes import ProjectLink
|
from pallets_sphinx_themes import ProjectLink
|
||||||
|
|
||||||
|
|
@ -74,7 +76,7 @@ def github_link(name, rawtext, text, lineno, inliner, options=None, content=None
|
||||||
else:
|
else:
|
||||||
words = None
|
words = None
|
||||||
|
|
||||||
if release.endswith("dev"):
|
if packaging.version.parse(release).is_devrelease:
|
||||||
url = "{0}master/{1}".format(base_url, text)
|
url = "{0}master/{1}".format(base_url, text)
|
||||||
else:
|
else:
|
||||||
url = "{0}{1}/{2}".format(base_url, release, text)
|
url = "{0}{1}/{2}".format(base_url, release, text)
|
||||||
|
|
|
||||||
|
|
@ -39,8 +39,8 @@ generate URLs from one function to another you would have to still provide
|
||||||
the language code explicitly which can be annoying.
|
the language code explicitly which can be annoying.
|
||||||
|
|
||||||
For the latter, this is where :func:`~flask.Flask.url_defaults` functions
|
For the latter, this is where :func:`~flask.Flask.url_defaults` functions
|
||||||
come in. They can automatically inject values into a call for
|
come in. They can automatically inject values into a call to
|
||||||
:func:`~flask.url_for` automatically. The code below checks if the
|
:func:`~flask.url_for`. The code below checks if the
|
||||||
language code is not yet in the dictionary of URL values and if the
|
language code is not yet in the dictionary of URL values and if the
|
||||||
endpoint wants a value named ``'lang_code'``::
|
endpoint wants a value named ``'lang_code'``::
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue