From e1201293c7d8fd636db147951996999b80a7893d Mon Sep 17 00:00:00 2001 From: crossdark Date: Tue, 29 Oct 2024 18:49:52 +0800 Subject: [PATCH] =?UTF-8?q?3.2.4=20=E6=B7=BB=E5=8A=A0=E9=94=9A=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CrossDown/Core.py | 39 --------------------------------------- README.html | 1 + README.md | 1 + setup.py | 2 +- 4 files changed, 3 insertions(+), 40 deletions(-) diff --git a/CrossDown/Core.py b/CrossDown/Core.py index e59d7d3..c35ad9f 100644 --- a/CrossDown/Core.py +++ b/CrossDown/Core.py @@ -34,25 +34,6 @@ from pymdownx.magiclink import MagiclinkExtension from .Define import Variable -class PreProcess(Preprocessor): - """预处理""" - - def __init__(self, variable: Variable): - super().__init__() - self.variable = variable - - def run(self, lines: List[str]) -> List[str]: - new_lines = [] - for line in lines: # 逐行遍历 - for value in re.findall(r'\{\[(.+?)]}', line): # 找到变量 - if value in self.variable: # 变量已定义 - line = re.sub(fr'\{{\[{value}]}}', self.variable[value], line) # 替换变量为值 - else: - line = re.sub(fr'\{{\[{value}]}}', value, line) # 不替换变量 - new_lines.append(line) - return new_lines - - class Simple(InlineProcessor): """ 可通过简单的正则表达式和HTML标签实现的样式 @@ -212,26 +193,6 @@ class LinkLine(InlineProcessor): return tag, m.start(), m.end() -class Pre(Extension): - """预处理""" - - def __init__(self, variable: Variable): - """ - 初始化 - :param variable: 变量字典 - """ - super().__init__() - self.variable = variable - - def extendMarkdown(self, md: Markdown): - """ - 添加扩展 - :param md: 转换器 - """ - md.registerExtension(self) # 注册扩展 - md.preprocessors.register(PreProcess(self.variable), 'pre_process', 1000) - - class BasicExtension(Extension): """ 渲染基本样式 diff --git a/README.html b/README.html index 3e432af..3ceabde 100644 --- a/README.html +++ b/README.html @@ -272,6 +272,7 @@
#! usr/bin/python3.11
     def main():
         print('CrossDown')
+    `#!py3 print('cd')`
     

5 转义

\

diff --git a/README.md b/README.md index 55b41a9..f4029b5 100644 --- a/README.md +++ b/README.md @@ -199,6 +199,7 @@ $$ #! usr/bin/python3.11 def main(): print('CrossDown') +`#!py3 print('cd')` ``` 5 转义 diff --git a/setup.py b/setup.py index a1ec4c3..0fbdcb3 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ with open("README.md", "r") as fh: setuptools.setup( name="CrossDown", - version="2.2.0", + version="3.2.4", author="CrossDark", author_email="liuhanbo333@icloud.com", description="CrossDark's MarkDown",