mirror of https://github.com/zulip/zulip.git
Move langclass var into FencedBlockPreprocessor.format_code().
(imported from commit e468a8b6a12494facb0dfa97eff90e02cd14f169)
This commit is contained in:
parent
46838ec6d0
commit
b3344c2f49
|
@ -101,7 +101,11 @@ class FencedBlockPreprocessor(markdown.preprocessors.Preprocessor):
|
||||||
self.checked_for_codehilite = False
|
self.checked_for_codehilite = False
|
||||||
self.codehilite_conf = {}
|
self.codehilite_conf = {}
|
||||||
|
|
||||||
def format_code(self, langclass, lang, text):
|
def format_code(self, lang, text):
|
||||||
|
langclass = ''
|
||||||
|
if lang:
|
||||||
|
langclass = LANG_TAG % (lang,)
|
||||||
|
|
||||||
# Check for code hilite extension
|
# Check for code hilite extension
|
||||||
if not self.checked_for_codehilite:
|
if not self.checked_for_codehilite:
|
||||||
for ext in self.markdown.registeredExtensions:
|
for ext in self.markdown.registeredExtensions:
|
||||||
|
@ -137,15 +141,11 @@ class FencedBlockPreprocessor(markdown.preprocessors.Preprocessor):
|
||||||
return "\n\n".join(quoted_paragraphs)
|
return "\n\n".join(quoted_paragraphs)
|
||||||
|
|
||||||
def format_fence(self, lang, text):
|
def format_fence(self, lang, text):
|
||||||
langclass = ''
|
|
||||||
if lang:
|
|
||||||
langclass = LANG_TAG % (lang,)
|
|
||||||
|
|
||||||
if lang in ('quote', 'quoted'):
|
if lang in ('quote', 'quoted'):
|
||||||
replacement = self.format_quote(text)
|
replacement = self.format_quote(text)
|
||||||
return replacement
|
return replacement
|
||||||
else:
|
else:
|
||||||
code = self.format_code(langclass, lang, text)
|
code = self.format_code(lang, text)
|
||||||
placeholder = self.markdown.htmlStash.store(code, safe=True)
|
placeholder = self.markdown.htmlStash.store(code, safe=True)
|
||||||
return placeholder
|
return placeholder
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue