2.1.2 完善
This commit is contained in:
parent
1178f28060
commit
2c04390756
@ -269,21 +269,33 @@ class BoxBlock(BlockProcessor):
|
|||||||
|
|
||||||
|
|
||||||
class _Anchor(InlineProcessor):
|
class _Anchor(InlineProcessor):
|
||||||
def handleMatch(self, match, match_line):
|
def handleMatch(self, m: Match[str], data: str) -> Tuple[xml.etree.ElementTree.Element, int, int] | Tuple[None, None, None]:
|
||||||
|
"""
|
||||||
|
处理匹配
|
||||||
|
:param m: re模块的匹配对象
|
||||||
|
:param data: 被匹配的原始文本
|
||||||
|
:return: 标签 匹配开始 匹配结束
|
||||||
|
"""
|
||||||
tag = xml.etree.ElementTree.Element('span') # 创建标签
|
tag = xml.etree.ElementTree.Element('span') # 创建标签
|
||||||
tag.text = match.group(1)
|
tag.text = m.group(1)
|
||||||
tag.set('id', match.group(1)) # 设置id
|
tag.set('id', m.group(1)) # 设置id
|
||||||
|
|
||||||
return tag, match.start(), match.end()
|
return tag, m.start(), m.end()
|
||||||
|
|
||||||
|
|
||||||
class LinkLine(InlineProcessor):
|
class LinkLine(InlineProcessor):
|
||||||
def handleMatch(self, match, match_line):
|
def handleMatch(self, m: Match[str], data: str) -> Tuple[xml.etree.ElementTree.Element, int, int] | Tuple[None, None, None]:
|
||||||
|
"""
|
||||||
|
处理匹配
|
||||||
|
:param m: re模块的匹配对象
|
||||||
|
:param data: 被匹配的原始文本
|
||||||
|
:return: 标签 匹配开始 匹配结束
|
||||||
|
"""
|
||||||
tag = xml.etree.ElementTree.Element('a') # 创建标签
|
tag = xml.etree.ElementTree.Element('a') # 创建标签
|
||||||
tag.set('href', '#' + match.group(1)) # 设置id
|
tag.set('href', '#' + m.group(1)) # 设置id
|
||||||
tag.text = match.group(1)
|
tag.text = m.group(1)
|
||||||
|
|
||||||
return tag, match.start(), match.end()
|
return tag, m.start(), m.end()
|
||||||
|
|
||||||
|
|
||||||
class CodeLine(Treeprocessor):
|
class CodeLine(Treeprocessor):
|
||||||
|
2
setup.py
2
setup.py
@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
|
|||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name="CrossDown",
|
name="CrossDown",
|
||||||
version="2.1.0",
|
version="2.1.2",
|
||||||
author="CrossDark",
|
author="CrossDark",
|
||||||
author_email="liuhanbo333@icloud.com",
|
author_email="liuhanbo333@icloud.com",
|
||||||
description="CrossDark's MarkDown",
|
description="CrossDark's MarkDown",
|
||||||
|
Loading…
Reference in New Issue
Block a user