mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 15:03:34 +00:00
bugdown: Replace deprecated markdown.util.etree with ElementTree.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
01ccb75259
commit
f65af9cdb7
@@ -1,7 +1,7 @@
|
||||
from markdown.extensions import Extension
|
||||
from typing import Any, Dict, Optional, List, Tuple
|
||||
import markdown
|
||||
from xml.etree.ElementTree import Element
|
||||
from xml.etree.ElementTree import Element, SubElement
|
||||
|
||||
from zerver.lib.bugdown import walk_tree_with_family, ResultWithFamily
|
||||
|
||||
@@ -50,15 +50,15 @@ class NestedCodeBlocksRendererTreeProcessor(markdown.treeprocessors.Treeprocesso
|
||||
return nested_code_blocks
|
||||
|
||||
def get_codehilite_block(self, code_block_text: Optional[str]) -> Element:
|
||||
div = markdown.util.etree.Element("div")
|
||||
div = Element("div")
|
||||
div.set("class", "codehilite")
|
||||
pre = markdown.util.etree.SubElement(div, "pre")
|
||||
pre = SubElement(div, "pre")
|
||||
pre.text = code_block_text
|
||||
return div
|
||||
|
||||
def replace_element(
|
||||
self, parent: Optional[Element],
|
||||
replacement: markdown.util.etree.Element,
|
||||
replacement: Element,
|
||||
element_to_replace: Element
|
||||
) -> None:
|
||||
if parent is None:
|
||||
|
||||
Reference in New Issue
Block a user