mirror of https://github.com/zulip/zulip.git
bugdown: Rename rewrite_if_relative_link to more clear name.
The name was actually sorta the reverse of what that function did.
This commit is contained in:
parent
7d4234b167
commit
da27461491
|
@ -81,7 +81,7 @@ STREAM_LINK_REGEX = r"""
|
||||||
class BugdownRenderingException(Exception):
|
class BugdownRenderingException(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def rewrite_if_relative_link(link: str) -> str:
|
def rewrite_local_links_to_relative(link: str) -> str:
|
||||||
""" If the link points to a local destination we can just switch to that
|
""" If the link points to a local destination we can just switch to that
|
||||||
instead of opening a new tab. """
|
instead of opening a new tab. """
|
||||||
|
|
||||||
|
@ -1162,7 +1162,7 @@ def url_to_a(url: Text, text: Optional[Text]=None) -> Union[Element, Text]:
|
||||||
if text is None:
|
if text is None:
|
||||||
text = markdown.util.AtomicString(url)
|
text = markdown.util.AtomicString(url)
|
||||||
|
|
||||||
href = rewrite_if_relative_link(href)
|
href = rewrite_local_links_to_relative(href)
|
||||||
target_blank = not href.startswith("#narrow") and not href.startswith('mailto:')
|
target_blank = not href.startswith("#narrow") and not href.startswith('mailto:')
|
||||||
|
|
||||||
a.set('href', href)
|
a.set('href', href)
|
||||||
|
@ -1328,7 +1328,7 @@ class LinkPattern(markdown.inlinepatterns.Pattern):
|
||||||
if href is None:
|
if href is None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
href = rewrite_if_relative_link(href)
|
href = rewrite_local_links_to_relative(href)
|
||||||
|
|
||||||
el = markdown.util.etree.Element('a')
|
el = markdown.util.etree.Element('a')
|
||||||
el.text = m.group(2)
|
el.text = m.group(2)
|
||||||
|
|
Loading…
Reference in New Issue