0.8.6提纲号可算整好了
This commit is contained in:
parent
133ce5f8c9
commit
90b50d1440
@ -232,6 +232,8 @@ class CodeBlock:
|
||||
self.codes[index] = f'<div class="{head}">{re.sub(f"({head})", "", code)}</div>'
|
||||
elif re.match(r'\$[^$]*\$', code): # 是LaTex代码(单行)
|
||||
self.codes[index] = re.sub(fr'\$([^$]*)\$', r'<p>\(\1\)</p>', code)
|
||||
elif re.match(r'¥[^$]*¥', code): # 是数学函数(单行)
|
||||
self.codes[index] = re.sub(fr'¥([^$]*)¥', r'<p>\(\1\)</p>', code)
|
||||
else: # 是突出块
|
||||
self.codes[index] = f'<span class="block">{code}</span>'
|
||||
|
||||
@ -326,7 +328,9 @@ class Syllabus:
|
||||
re.sub(f'^({match.groups()[0]})',
|
||||
fr'{"#" * len(match.groups()[0].split("."))} \1{{#' + match.groups()[0] + '}', origen)
|
||||
if match is not None else origen) # 对于不是提纲的行,直接返回原始字符
|
||||
(re.match(r'^([\d.]+) ', line), line) # 匹配提纲号
|
||||
((lambda x: re.match(r'^([\d.]+) ', x) # 判断是否是提纲
|
||||
if not any((x.startswith('.'), re.search('\. ', x) is not None))
|
||||
else None)(line), line) # 排除.在提纲号开头或结尾的情况
|
||||
for line in self.text.splitlines() # 分割并遍历文本的每一行
|
||||
])
|
||||
|
||||
|
16
README.html
16
README.html
@ -117,6 +117,12 @@
|
||||
<p>引文内添加<em>斜体</em><strong>粗体</strong><u>下划线</u><s>删除线</s><mark>高亮</mark></p>
|
||||
</blockquote>
|
||||
<h1>6<span id="6"></span> 提纲</h1>
|
||||
<h2>6.1<span id="6.1"></span> 提纲号</h2>
|
||||
<p>以数字和点组成,通过空格与提纲名分隔,例如:</p>
|
||||
<h3>6.1.1<span id="6.1.1"></span> 提纲号示例</h3>
|
||||
<p>点不能出现在开头或结尾,例如
|
||||
.6.1.2 错误示范
|
||||
6.1.3. 错误示范</p>
|
||||
<h1>7<span id="7"></span> 注释</h1>
|
||||
<h2>7.1<span id="7.1"></span> 强注释</h2>
|
||||
<h2>7.2<span id="7.2"></span> 弱注释</h2>
|
||||
@ -124,10 +130,12 @@
|
||||
<span class="block">// 代码中的注释弱不会被移除</span></p>
|
||||
<h1>8<span id="8"></span> 列表</h1>
|
||||
<h2>8.1<span id="8.1"></span> 有序列表</h2>
|
||||
<h2>1.<span id="1."></span> a</h2>
|
||||
<h2>2.<span id="2."></span> b</h2>
|
||||
<h2>3.<span id="3."></span> c</h2>
|
||||
<h2>4.<span id="4."></span> d</h2>
|
||||
<ol>
|
||||
<li>a</li>
|
||||
<li>b</li>
|
||||
<li>c</li>
|
||||
<li>d</li>
|
||||
</ol>
|
||||
<h2>8.2<span id="8.2"></span> 无序列表</h2>
|
||||
<ul>
|
||||
<li>A</li>
|
||||
|
Loading…
Reference in New Issue
Block a user