3.2.6 action
Some checks are pending
/ build-push (push) Waiting to run

This commit is contained in:
跨越晨昏 2024-11-01 19:18:29 +08:00
parent e1201293c7
commit d2e6c88b31
11 changed files with 115 additions and 23 deletions

View File

@ -0,0 +1,44 @@
on:
push:
branches:
- main
jobs:
build-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python 3.11
uses: actions/setup-python@v2
with:
python-version: '3.11'
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
- name: Build the package
run: |
python3.11 setup.py sdist bdist_wheel
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: python-dist
path: |
dist/*.tar.gz
dist/*.whl
- name: Set up twine
run: pip install twine
- name: Publish to PyPI
env:
TWINE_USERNAME: '__token__'
TWINE_PASSWORD: 'pypi-AgEIcHlwaS5vcmcCJDYxNjk2MzExLTg2NjMtNDUwNi1hMTQ0LTM2NDkxY2U1NjExYwACKlszLCIwNmJkMmFkZS1hYjkxLTQ0MWMtOWM1ZC02MmE0OTc3NTc5Y2EiXQAABiD_N8XZktPwthdp9dRpkpm7dIEh3eVbSr-X6H_OS8OzDw'
run: |
twine upload dist/*

View File

@ -5,8 +5,9 @@
<excludeFolder url="file://$MODULE_DIR$/CrossDown.egg-info" />
<excludeFolder url="file://$MODULE_DIR$/build" />
<excludeFolder url="file://$MODULE_DIR$/dist" />
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="jdk" jdkName="Python 3.11" jdkType="Python SDK" />
<orderEntry type="jdk" jdkName="Python 3.11 (CrossDown)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11" project-jdk-type="Python SDK" />
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11 (CrossDown)" project-jdk-type="Python SDK" />
</project>

View File

@ -1,3 +1,8 @@
"""
核心代码
"""
import re
import xml
from typing import *
@ -30,6 +35,7 @@ from pymdownx.superfences import fence_div_format
from pymdownx.tasklist import TasklistExtension
from pymdownx.tilde import DeleteSubExtension
from pymdownx.magiclink import MagiclinkExtension
from pymdownx.pathconverter import PathConverterExtension
from .Define import Variable
@ -263,6 +269,7 @@ Extensions = {
'高级列表': FancyListExtension(),
'高级标题': SaneHeadersExtension(),
'超级链接': MagiclinkExtension(),
'路径转换器': PathConverterExtension(),
# 自定义
'基本风格': BasicExtension(),

View File

@ -1,11 +1,12 @@
from typing import *
import pickle
from .Core import main
__all__ = [
'main', # 主函数
'indent', # 添加空格
'HEAD', #
'HEAD', # HTML头部引用
'Meta', # 元数据处理器
]
__version__ = '0.11.2'
__author__ = 'CrossDark'
@ -13,15 +14,17 @@ __email__ = 'liuhanbo333@icloud.com'
__source__ = 'https://crossdark.net/'
__license__ = """MIT"""
HEAD = {
('latex', 'js'): '<script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML"></script>',
# mathjax
('latex',
'js'): '<script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML"></script>',
# mermaid
('mermaid', 'js'): '<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>',
('mermaid', 'init'): '<script>mermaid.initialize({startOnLoad:true})</script>',
('code-highlight', 'css'): '<link rel="stylesheet" href="../Static/styles.css">', # 代码高亮css
# 代码高亮css
('code-highlight', 'css'): '<link rel="stylesheet" href="../Static/styles.css">',
}
@ -37,3 +40,32 @@ def indent(input_: Union[str, List, Tuple], indent_spaces: int = 4) -> str:
return "\n".join(
f"{' ' * indent_spaces}{line}" for line in (lambda x: x.splitlines() if isinstance(x, str) else x)(input_)
)
class Meta:
"""
这是用于处理本模块的元数据的类
"""
def __init__(self, major: int, minor: int = 0, micro: int = 0, requirements='requirements.txt',
long_description='README.md'):
# 设置版本
try:
with open('data.pkl', 'rb') as file: # 读取上次版本
latest_version = pickle.load(file)
except FileNotFoundError:
pass
else:
if latest_version[0] >= major: # 判断主版本号
if latest_version[1] >= minor: # 判断副版本号
if latest_version[2] >= micro: # 判断小版本号
raise ValueError('版本不对')
self.version = f'{major}.{minor}.{micro}' # 生成版本字符串
with open('data.pkl', 'wb') as file: # 记录版本
pickle.dump((major, minor, micro), file)
with open(requirements, 'r') as f: # 设置依赖
self.requirements = [line.strip() for line in f.readlines()]
with open(long_description, "r") as fh:
self.long_description = fh.read()

View File

@ -69,6 +69,7 @@
<li><a href="#4.1.1">4.1.1 LaTex</a></li>
<li><a href="#4.1.2">4.1.2 函数</a></li>
<li><a href="#4.1.3">4.1.3 按键风格</a></li>
<li><a href="#4.1.4">4.1.4 突出</a></li>
</ul>
</li>
<li><a href="#4.2">4.2 多行</a><ul>
@ -134,8 +135,9 @@
</ul>
</div>
<h1 id="crossdown">CrossDown</h1>
<p>自制的markdown,添加了一些自定义的语法
效果请见<README.html></p>
<p>自制的markdown,添加了一些自定义的语法</p>
<p>效果请见<README.html></p>
<p>安装:pip3 install --index-url <a href="https://crossdark.net/api/packages/CrossDark/pypi/simple/">https://crossdark.net/api/packages/CrossDark/pypi/simple/</a> CrossDown</p>
<h1 id="1">1 基本语法</h1>
<h2 id="1.1">1.1 标题</h2>
<h1 id="_1">一级标题</h1>
@ -187,7 +189,7 @@
<h3 id="4.1.1">4.1.1 LaTex</h3>
<p>这是<span class="arithmatex"><span class="MathJax_Preview">CO_2</span><script type="math/tex">CO_2</script></span>二氧化碳,或者可以写成这样CO<sub>2</sub></p>
<p>这是<span class="arithmatex"><span class="MathJax_Preview">H_2O</span><script type="math/tex">H_2O</script></span>水,或者写成H<sub>2</sub>O
H<sup>3</sup><sub>2</sub>O</p>
<sup>3</sup>H<sub>2</sub>O</p>
<p><span class="arithmatex"><span class="MathJax_Preview">\lg\left(\frac{目标生物的理智值}{稳定折磨型工具人的理智值}\right)</span><script type="math/tex">\lg\left(\frac{目标生物的理智值}{稳定折磨型工具人的理智值}\right)</script></span></p>
<h3 id="4.1.2">4.1.2 函数</h3>
<p><code>¥y=x*2+1¥</code> // 不定义范围</p>
@ -195,6 +197,8 @@
<p><code>¥y=x**3¥€-50,50|-100,100€</code> // 定义了y范围</p>
<h3 id="4.1.3">4.1.3 按键风格</h3>
<p><span class="keys"><kbd class="key-control">Ctrl</kbd><span>+</span><kbd class="key-alt">Alt</kbd><span>+</span><kbd class="key-delete">Del</kbd></span></p>
<h3 id="4.1.4">4.1.4 突出</h3>
<p><code>{突出内容}</code></p>
<h2 id="4.2">4.2 多行</h2>
<h3 id="4.2.1">4.2.1 YAML</h3>
<div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"> 2</span>

View File

@ -8,8 +8,11 @@ base_url: http://crossdark.net:3000/crossdark/CrossDown
# CrossDown
自制的markdown,添加了一些自定义的语法
效果请见<README.html>
安装:pip3 install --index-url https://crossdark.net/api/packages/CrossDark/pypi/simple/ CrossDown
1 基本语法
1.1 标题
@ -108,7 +111,7 @@ The mock shebang will be treated like text here: ` #!js var test = 0; `.
这是$CO_2$二氧化碳,或者可以写成这样CO~2~
这是$H_2O$水,或者写成H~2~O
H^3^~2~O
^3^H~2~O
$\lg\left(\frac{目标生物的理智值}{稳定折磨型工具人的理智值}\right)$
@ -124,6 +127,10 @@ $\lg\left(\frac{目标生物的理智值}{稳定折磨型工具人的理智值}\
++ctrl+alt+delete++
4.1.4 突出
`{突出内容}`
4.2 多行
4.2.1 YAML

BIN
data.pkl Normal file

Binary file not shown.

View File

@ -2,6 +2,7 @@ Markdown>=3.7
matplotlib~=3.8.2
numpy~=1.26.2
pygments>=2.18.0
CrossDown~=2.2.0
CrossDown>=2.2.0
setuptools~=70.1.1
emoji~=2.13.2
pymdown-extensions>=10.12

1
run.py
View File

@ -2,7 +2,6 @@ import time
from CrossDown import *
if __name__ == '__main__':
# 开始计时
start_time = time.perf_counter_ns()

View File

@ -1,23 +1,20 @@
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
from CrossDown import Meta
meta = Meta(3, 2, 6)
setuptools.setup(
name="CrossDown",
version="3.2.4",
version=meta.version,
author="CrossDark",
author_email="liuhanbo333@icloud.com",
description="CrossDark's MarkDown",
long_description=long_description,
long_description=meta.long_description,
long_description_content_type="text/markdown",
url="https://github.com/CrossDark/CrossDown",
packages=setuptools.find_packages(),
install_requires=[
'markdown',
'matplotlib',
'numpy',
],
install_requires=meta.requirements,
package_data={
'': ['Static/*'], # 这将包含static文件夹下的所有子文件夹和文件
},