mirror of https://github.com/zulip/zulip.git
fenced_code: Avoid sloppy AttributeError handler.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
3cf91e9e45
commit
2bd81dd5c9
|
@ -415,16 +415,16 @@ class FencedBlockPreprocessor(Preprocessor):
|
||||||
def run(self, lines: Iterable[str]) -> List[str]:
|
def run(self, lines: Iterable[str]) -> List[str]:
|
||||||
"""Match and store Fenced Code Blocks in the HtmlStash."""
|
"""Match and store Fenced Code Blocks in the HtmlStash."""
|
||||||
|
|
||||||
|
from zerver.lib.markdown import ZulipMarkdown
|
||||||
|
|
||||||
output: List[str] = []
|
output: List[str] = []
|
||||||
|
|
||||||
processor = self
|
processor = self
|
||||||
self.handlers: List[ZulipBaseHandler] = []
|
self.handlers: List[ZulipBaseHandler] = []
|
||||||
|
|
||||||
default_language = None
|
default_language = None
|
||||||
try:
|
if isinstance(self.md, ZulipMarkdown) and self.md.zulip_realm is not None:
|
||||||
default_language = self.md.zulip_realm.default_code_block_language
|
default_language = self.md.zulip_realm.default_code_block_language
|
||||||
except AttributeError:
|
|
||||||
pass
|
|
||||||
handler = OuterHandler(processor, output, self.run_content_validators, default_language)
|
handler = OuterHandler(processor, output, self.run_content_validators, default_language)
|
||||||
self.push(handler)
|
self.push(handler)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue