1.8.3 修复一些bug
This commit is contained in:
parent
358269d6b6
commit
a018c9edd8
@ -13,18 +13,18 @@ import emoji
|
|||||||
|
|
||||||
Extensions = {
|
Extensions = {
|
||||||
"Extra": extra.ExtraExtension(fenced_code={'lang_prefix': ''}), # 基本扩展
|
"Extra": extra.ExtraExtension(fenced_code={'lang_prefix': ''}), # 基本扩展
|
||||||
"Admonition": admonition.AdmonitionExtension(),
|
"Admonition": admonition.AdmonitionExtension(), # 警告扩展
|
||||||
"Meta-Data": meta.MetaExtension(),
|
"Meta-Data": meta.MetaExtension(), # 元数据
|
||||||
"Sane Lists": sane_lists.SaneListExtension(),
|
"Sane Lists": sane_lists.SaneListExtension(), # 只能列表
|
||||||
"Table of Contents": toc.TocExtension(),
|
"Table of Contents": toc.TocExtension(), # 目录
|
||||||
"WikiLinks": wikilinks.WikiLinkExtension(),
|
"WikiLinks": wikilinks.WikiLinkExtension(), # 内部链接
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
try: # 检测当前平台是否支持扩展语法
|
try: # 检测当前平台是否支持扩展语法
|
||||||
from .Extra import *
|
from .Extra import *
|
||||||
EXTRA_ABLE = True
|
EXTRA_ABLE = True
|
||||||
except ModuleNotFoundError:
|
except ModuleNotFoundError: # 不支持扩展语法
|
||||||
EXTRA_ABLE = False
|
EXTRA_ABLE = False
|
||||||
|
|
||||||
|
|
||||||
@ -196,10 +196,10 @@ class CodeLine(Treeprocessor):
|
|||||||
if isinstance(elem.text, str): # 这个段落还有其它内容
|
if isinstance(elem.text, str): # 这个段落还有其它内容
|
||||||
elem.text += fr'\({code.text[1:-1]}\){code.tail}' # 插入latex
|
elem.text += fr'\({code.text[1:-1]}\){code.tail}' # 插入latex
|
||||||
else:
|
else:
|
||||||
elem.text = fr'\({code.text}\)' # latex是段落中唯一的内容
|
elem.text = fr'\({code.text[1:-1]}\)' # latex是段落中唯一的内容
|
||||||
elem.remove(code)
|
elem.remove(code)
|
||||||
elif re.match(r'¥[^$]*¥', code.text): # 是数学函数(单行)
|
elif re.match(r'¥[^$]*¥', code.text): # 是数学函数(单行)
|
||||||
if EXTRA_ABLE:
|
if EXTRA_ABLE: # 支持扩展语法
|
||||||
expression, range_ = re.findall(r'¥([^$]*)¥(€[^$]*€)?', code.text)[0] # 分离表达式与范围(如果有)
|
expression, range_ = re.findall(r'¥([^$]*)¥(€[^$]*€)?', code.text)[0] # 分离表达式与范围(如果有)
|
||||||
x_r = (-10, 10)
|
x_r = (-10, 10)
|
||||||
y_r = (-20, 20)
|
y_r = (-20, 20)
|
||||||
@ -214,6 +214,10 @@ class CodeLine(Treeprocessor):
|
|||||||
function=lambda x: eval(expression.split('=')[1]), x_range=x_r, y_range=y_r
|
function=lambda x: eval(expression.split('=')[1]), x_range=x_r, y_range=y_r
|
||||||
))}""") # 绘制函数图像
|
))}""") # 绘制函数图像
|
||||||
code.set('alt', 'Base64 函数图片')
|
code.set('alt', 'Base64 函数图片')
|
||||||
|
else: # 不支持扩展语法
|
||||||
|
code.tag = 'span'
|
||||||
|
code.set('class', 'block')
|
||||||
|
code.text = '该平台不支持扩展语法'
|
||||||
elif re.match(r'\{[^$]*}', code.text): # 是强调
|
elif re.match(r'\{[^$]*}', code.text): # 是强调
|
||||||
code.tag = 'span'
|
code.tag = 'span'
|
||||||
code.set('class', 'block')
|
code.set('class', 'block')
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user