fenced_code: Avoid sloppy AttributeError handler.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2022-10-06 13:56:33 -07:00 committed by Tim Abbott
parent 3cf91e9e45
commit 2bd81dd5c9
1 changed files with 3 additions and 3 deletions

View File

@ -415,16 +415,16 @@ class FencedBlockPreprocessor(Preprocessor):
def run(self, lines: Iterable[str]) -> List[str]:
"""Match and store Fenced Code Blocks in the HtmlStash."""
from zerver.lib.markdown import ZulipMarkdown
output: List[str] = []
processor = self
self.handlers: List[ZulipBaseHandler] = []
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
except AttributeError:
pass
handler = OuterHandler(processor, output, self.run_content_validators, default_language)
self.push(handler)