Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

refactor: Rename BugdownListPreprocessor to MarkdownListPreprocessor.

Mohit Gupta5a79c48603bc
diff --git a/zerver/lib/markdown/__init__.py b/zerver/lib/markdown/__init__.py
index 8951e759c90..36868587fce 100644
--- a/zerver/lib/markdown/__init__.py
+++ b/zerver/lib/markdown/__init__.py
@@ -1540,7 +1540,7 @@ class Fence:
fence_str: str
is_code: bool
-class BugdownListPreprocessor(markdown.preprocessors.Preprocessor):
+class MarkdownListPreprocessor(markdown.preprocessors.Preprocessor):
""" Allows list blocks that come directly after another block
to be rendered as a list.
@@ -1867,7 +1867,7 @@ class Bugdown(markdown.Markdown):
# html_block - insecure
# reference - references don't make sense in a chat context.
preprocessors = markdown.util.Registry()
- preprocessors.register(BugdownListPreprocessor(self), 'hanging_lists', 35)
+ preprocessors.register(MarkdownListPreprocessor(self), 'hanging_lists', 35)
preprocessors.register(markdown.preprocessors.NormalizeWhitespace(self), 'normalize_whitespace', 30)
preprocessors.register(fenced_code.FencedBlockPreprocessor(self), 'fenced_code_block', 25)
preprocessors.register(AlertWordNotificationProcessor(self), 'custom_text_notifications', 20)
diff --git a/zerver/tests/test_markdown.py b/zerver/tests/test_markdown.py
index db88aaefe15..4bb30dfa2f9 100644
--- a/zerver/tests/test_markdown.py
+++ b/zerver/tests/test_markdown.py
@@ -253,7 +253,7 @@ class BugdownMiscTest(ZulipTestCase):
render_tex("random text")
mock_logger.assert_called_with("Cannot find KaTeX for latex rendering!")
-class BugdownListPreprocessorTest(ZulipTestCase):
+class MarkdownListPreprocessorTest(ZulipTestCase):
# We test that the preprocessor inserts blank lines at correct places.
# We use <> to indicate that we need to insert a blank line here.
def split_message(self, msg: str) -> Tuple[List[str], List[str]]:
@@ -262,22 +262,22 @@ class BugdownListPreprocessorTest(ZulipTestCase):
return original, expected
def test_basic_list(self) -> None:
- preprocessor = bugdown.BugdownListPreprocessor()
+ preprocessor = bugdown.MarkdownListPreprocessor()
original, expected = self.split_message('List without a gap\n<>* One\n* Two')
self.assertEqual(preprocessor.run(original), expected)
def test_list_after_quotes(self) -> None:
- preprocessor = bugdown.BugdownListPreprocessor()
+ preprocessor = bugdown.MarkdownListPreprocessor()
original, expected = self.split_message('```quote\nSomething\n```\n\nList without a gap\n<>* One\n* Two')
self.assertEqual(preprocessor.run(original), expected)
def test_list_in_code(self) -> None:
- preprocessor = bugdown.BugdownListPreprocessor()
+ preprocessor = bugdown.MarkdownListPreprocessor()
original, expected = self.split_message('```\nList without a gap\n* One\n* Two\n```')
self.assertEqual(preprocessor.run(original), expected)
def test_complex_nesting_with_different_fences(self) -> None:
- preprocessor = bugdown.BugdownListPreprocessor()
+ preprocessor = bugdown.MarkdownListPreprocessor()
msg = """```quote
In quote. We should convert a list here:<>
* one
@@ -309,7 +309,7 @@ Outside. Should convert:<>
self.assertEqual(preprocessor.run(original), expected)
def test_complex_nesting_with_same_fence(self) -> None:
- preprocessor = bugdown.BugdownListPreprocessor()
+ preprocessor = bugdown.MarkdownListPreprocessor()
msg = """```quote
In quote. We should convert a list here:<>
* one