mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 21:13:36 +00:00
bugdown: Rename VerbosePattern to CompiledPattern.
This class only requires a compiled regex--it's up to the callers how they compile it (verbose or otherwise).
This commit is contained in:
@@ -1272,7 +1272,7 @@ def url_to_a(db_data: Optional[DbData], url: str, text: Optional[str]=None) -> U
|
|||||||
fixup_link(a, target_blank)
|
fixup_link(a, target_blank)
|
||||||
return a
|
return a
|
||||||
|
|
||||||
class VerbosePattern(markdown.inlinepatterns.Pattern):
|
class CompiledPattern(markdown.inlinepatterns.Pattern):
|
||||||
def __init__(self, compiled_re: Pattern, md: markdown.Markdown) -> None:
|
def __init__(self, compiled_re: Pattern, md: markdown.Markdown) -> None:
|
||||||
markdown.inlinepatterns.Pattern.__init__(self, ' ', md)
|
markdown.inlinepatterns.Pattern.__init__(self, ' ', md)
|
||||||
|
|
||||||
@@ -1281,7 +1281,7 @@ class VerbosePattern(markdown.inlinepatterns.Pattern):
|
|||||||
|
|
||||||
self.compiled_re = compiled_re
|
self.compiled_re = compiled_re
|
||||||
|
|
||||||
class AutoLink(VerbosePattern):
|
class AutoLink(CompiledPattern):
|
||||||
def handleMatch(self, match: Match[str]) -> ElementStringNone:
|
def handleMatch(self, match: Match[str]) -> ElementStringNone:
|
||||||
url = match.group('url')
|
url = match.group('url')
|
||||||
db_data = self.markdown.zulip_db_data
|
db_data = self.markdown.zulip_db_data
|
||||||
@@ -1566,7 +1566,7 @@ class UserGroupMentionPattern(markdown.inlinepatterns.Pattern):
|
|||||||
return el
|
return el
|
||||||
return None
|
return None
|
||||||
|
|
||||||
class StreamPattern(VerbosePattern):
|
class StreamPattern(CompiledPattern):
|
||||||
def find_stream_by_name(self, name: Match[str]) -> Optional[Dict[str, Any]]:
|
def find_stream_by_name(self, name: Match[str]) -> Optional[Dict[str, Any]]:
|
||||||
db_data = self.markdown.zulip_db_data
|
db_data = self.markdown.zulip_db_data
|
||||||
if db_data is None:
|
if db_data is None:
|
||||||
|
|||||||
Reference in New Issue
Block a user