From 087b54aa45fe280320c1ccab3b4f8c24d2ce718a Mon Sep 17 00:00:00 2001 From: Rohitt Vashishtha Date: Tue, 14 Apr 2020 03:23:46 +0000 Subject: [PATCH] markdown: Keep only 'text' for a no-op pygments rendering. Previously, we added support for 'none', 'plain' and 'noop' and a function `lang = remap_language(lang)`. This also had the potential to encourage adding more remappings- something that we deliberatly want to keep to a minimum. For context, Anders K doesn't want us to keep any remapping (only keeping 'text' which is the default no-op lexer that pygments has) and Tim wants to keep 'plain' and 'text'. We should only document and advertise 'text'. --- tools/setup/lang.json | 4 +--- zerver/lib/bugdown/fenced_code.py | 6 ------ 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/tools/setup/lang.json b/tools/setup/lang.json index 7fbe8a80e7..c60d3fadd7 100644 --- a/tools/setup/lang.json +++ b/tools/setup/lang.json @@ -31,7 +31,6 @@ "matlab": 33, "mql": 9, "mql4": 9, - "none": 1, "objective-c": 35, "objectivec": 35, "objectpascal": 42, @@ -39,7 +38,6 @@ "perl": 40, "php": 44, "pl": 40, - "plain": 1, "prolog": 16, "python": 46, "quote": 50, @@ -47,13 +45,13 @@ "rb": 39, "ruby": 39, "rust": 8, - "text": 1, "sas": 30, "scala": 21, "scheme": 14, "sql": 32, "swift": 41, "tex": 40, + "text": 1, "vb.net": 45, "vbnet": 45, "xml": 1 diff --git a/zerver/lib/bugdown/fenced_code.py b/zerver/lib/bugdown/fenced_code.py index f9fcea18d4..867145a231 100644 --- a/zerver/lib/bugdown/fenced_code.py +++ b/zerver/lib/bugdown/fenced_code.py @@ -166,11 +166,6 @@ def generic_handler(processor: Any, output: MutableSequence[str], else: return CodeHandler(processor, output, fence, lang, run_content_validators) -def remap_language(lang: str) -> str: - if lang in ['none', 'noop', 'text', 'plain']: - return '' - return lang - def check_for_new_fence(processor: Any, output: MutableSequence[str], line: str, run_content_validators: Optional[bool]=False, default_language: Optional[str]=None) -> None: @@ -180,7 +175,6 @@ def check_for_new_fence(processor: Any, output: MutableSequence[str], line: str, lang = m.group('lang') if not lang and default_language: lang = default_language - lang = remap_language(lang) handler = generic_handler(processor, output, fence, lang, run_content_validators, default_language) processor.push(handler) else: