nonebot-plugin-latex 0.0.2__tar.gz → 0.0.2.2__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {nonebot_plugin_latex-0.0.2 → nonebot_plugin_latex-0.0.2.2}/PKG-INFO +8 -5
- {nonebot_plugin_latex-0.0.2 → nonebot_plugin_latex-0.0.2.2}/README.md +7 -4
- {nonebot_plugin_latex-0.0.2 → nonebot_plugin_latex-0.0.2.2}/nonebot_plugin_latex/__init__.py +2 -2
- {nonebot_plugin_latex-0.0.2 → nonebot_plugin_latex-0.0.2.2}/nonebot_plugin_latex/config.py +1 -1
- {nonebot_plugin_latex-0.0.2 → nonebot_plugin_latex-0.0.2.2}/nonebot_plugin_latex/data.py +7 -7
- {nonebot_plugin_latex-0.0.2 → nonebot_plugin_latex-0.0.2.2}/nonebot_plugin_latex/main.py +5 -5
- {nonebot_plugin_latex-0.0.2 → nonebot_plugin_latex-0.0.2.2}/nonebot_plugin_latex.egg-info/PKG-INFO +8 -5
- {nonebot_plugin_latex-0.0.2 → nonebot_plugin_latex-0.0.2.2}/pyproject.toml +1 -1
- {nonebot_plugin_latex-0.0.2 → nonebot_plugin_latex-0.0.2.2}/LICENSE +0 -0
- {nonebot_plugin_latex-0.0.2 → nonebot_plugin_latex-0.0.2.2}/nonebot_plugin_latex/converter.py +0 -0
- {nonebot_plugin_latex-0.0.2 → nonebot_plugin_latex-0.0.2.2}/nonebot_plugin_latex.egg-info/SOURCES.txt +0 -0
- {nonebot_plugin_latex-0.0.2 → nonebot_plugin_latex-0.0.2.2}/nonebot_plugin_latex.egg-info/dependency_links.txt +0 -0
- {nonebot_plugin_latex-0.0.2 → nonebot_plugin_latex-0.0.2.2}/nonebot_plugin_latex.egg-info/requires.txt +0 -0
- {nonebot_plugin_latex-0.0.2 → nonebot_plugin_latex-0.0.2.2}/nonebot_plugin_latex.egg-info/top_level.txt +0 -0
- {nonebot_plugin_latex-0.0.2 → nonebot_plugin_latex-0.0.2.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: nonebot-plugin-latex
|
3
|
-
Version: 0.0.2
|
3
|
+
Version: 0.0.2.2
|
4
4
|
Summary: 通过互联网公共服务渲染LaTeX公式
|
5
5
|
Author-email: Eilles <EillesWan@outlook.com>
|
6
6
|
License: 木兰宽松许可证, 第2版
|
@@ -146,22 +146,25 @@ Requires-Dist: pymdown-extensions>=9.1
|
|
146
146
|
Requires-Dist: aiofiles>=0.8.0
|
147
147
|
|
148
148
|
# nonebot-plugin-latex
|
149
|
-
NoneBot2 LaTeX图形渲染插件
|
150
149
|
|
151
|
-
|
150
|
+
NoneBot2 LaTeX 图形渲染插件
|
151
|
+
|
152
|
+
通过互联网公共服务渲染 LaTeX 公式
|
152
153
|
|
153
154
|
利用 www.latex2png.com 和 latex.codecogs.com 在线渲染 LaTeX 公式
|
154
155
|
|
155
156
|
## 安装
|
156
157
|
|
158
|
+
```bash
|
157
159
|
pip install nonebot-plugin-latex
|
160
|
+
```
|
158
161
|
|
159
162
|
## 使用
|
160
163
|
|
161
164
|
如果希望直接作为 LaTeX 渲染插件使用的话,请在 NoneBot 配置文件中添加以下内容:
|
162
165
|
|
163
166
|
```env
|
164
|
-
|
167
|
+
latex_enable_as_application = true
|
165
168
|
```
|
166
169
|
|
167
|
-
这样就可以使用 `latex` 命令进行渲染了,例如 `latex E=mc^2
|
170
|
+
这样就可以使用 `latex` 命令进行渲染了,例如 `latex $E=mc^2$` 就会返回这个方程式的渲染图片。
|
@@ -1,20 +1,23 @@
|
|
1
1
|
# nonebot-plugin-latex
|
2
|
-
NoneBot2 LaTeX图形渲染插件
|
3
2
|
|
4
|
-
|
3
|
+
NoneBot2 LaTeX 图形渲染插件
|
4
|
+
|
5
|
+
通过互联网公共服务渲染 LaTeX 公式
|
5
6
|
|
6
7
|
利用 www.latex2png.com 和 latex.codecogs.com 在线渲染 LaTeX 公式
|
7
8
|
|
8
9
|
## 安装
|
9
10
|
|
11
|
+
```bash
|
10
12
|
pip install nonebot-plugin-latex
|
13
|
+
```
|
11
14
|
|
12
15
|
## 使用
|
13
16
|
|
14
17
|
如果希望直接作为 LaTeX 渲染插件使用的话,请在 NoneBot 配置文件中添加以下内容:
|
15
18
|
|
16
19
|
```env
|
17
|
-
|
20
|
+
latex_enable_as_application = true
|
18
21
|
```
|
19
22
|
|
20
|
-
这样就可以使用 `latex` 命令进行渲染了,例如 `latex E=mc^2
|
23
|
+
这样就可以使用 `latex` 命令进行渲染了,例如 `latex $E=mc^2$` 就会返回这个方程式的渲染图片。
|
{nonebot_plugin_latex-0.0.2 → nonebot_plugin_latex-0.0.2.2}/nonebot_plugin_latex/__init__.py
RENAMED
@@ -19,7 +19,7 @@ from nonebot.plugin import PluginMetadata
|
|
19
19
|
from .config import Config
|
20
20
|
from .converter import converter
|
21
21
|
|
22
|
-
__version__ = "0.0.2"
|
22
|
+
__version__ = "0.0.2.2"
|
23
23
|
|
24
24
|
__author__ = "Eilles"
|
25
25
|
|
@@ -36,5 +36,5 @@ __plugin_meta__ = PluginMetadata(
|
|
36
36
|
config = get_plugin_config(Config)
|
37
37
|
|
38
38
|
|
39
|
-
if config.
|
39
|
+
if config.latex_enable_as_application:
|
40
40
|
from .main import *
|
@@ -39,7 +39,7 @@ class ConvertChannel:
|
|
39
39
|
|
40
40
|
class L2PChannel(ConvertChannel):
|
41
41
|
|
42
|
-
URL = "
|
42
|
+
URL = "http://www.latex2png.com"
|
43
43
|
|
44
44
|
async def get_to_convert(
|
45
45
|
self,
|
@@ -93,9 +93,9 @@ class L2PChannel(ConvertChannel):
|
|
93
93
|
start_time = time.time_ns()
|
94
94
|
latex2png = (
|
95
95
|
client.get(
|
96
|
-
"
|
96
|
+
"http://www.latex2png.com{}"
|
97
97
|
+ client.post(
|
98
|
-
"
|
98
|
+
"http://www.latex2png.com/api/convert",
|
99
99
|
json={
|
100
100
|
"auth": {"user": "guest", "password": "guest"},
|
101
101
|
"latex": "\\\\int_{a}^{b} x^2 \\\\, dx = \\\\frac{b^3}{3} - \\\\frac{a^3}{5}\n",
|
@@ -116,7 +116,7 @@ class L2PChannel(ConvertChannel):
|
|
116
116
|
|
117
117
|
class CDCChannel(ConvertChannel):
|
118
118
|
|
119
|
-
URL = "
|
119
|
+
URL = "http://latex.codecogs.com"
|
120
120
|
|
121
121
|
async def get_to_convert(
|
122
122
|
self,
|
@@ -158,7 +158,7 @@ class CDCChannel(ConvertChannel):
|
|
158
158
|
start_time = time.time_ns()
|
159
159
|
codecogs = (
|
160
160
|
client.get(
|
161
|
-
r"
|
161
|
+
r"http://latex.codecogs.com/png.image?\huge%20\dpi{600}\\int_{a}^{b}x^2\\,dx=\\frac{b^3}{3}-\\frac{a^3}{5}"
|
162
162
|
),
|
163
163
|
time.time_ns() - start_time,
|
164
164
|
)
|
@@ -172,7 +172,7 @@ class CDCChannel(ConvertChannel):
|
|
172
172
|
|
173
173
|
class JRTChannel(ConvertChannel):
|
174
174
|
|
175
|
-
URL = "
|
175
|
+
URL = "http://latex2image.joeraut.com"
|
176
176
|
|
177
177
|
async def get_to_convert(
|
178
178
|
self,
|
@@ -225,7 +225,7 @@ class JRTChannel(ConvertChannel):
|
|
225
225
|
joeraut = (
|
226
226
|
client.get(
|
227
227
|
client.post(
|
228
|
-
"
|
228
|
+
"http://www.latex2png.com/api/convert",
|
229
229
|
json={
|
230
230
|
"latexInput": "\\\\int_{a}^{b} x^2 \\\\, dx = \\\\frac{b^3}{3} - \\\\frac{a^3}{5}",
|
231
231
|
"outputFormat": "PNG",
|
@@ -51,10 +51,10 @@ async def check_for_scan(
|
|
51
51
|
# state: T_State,
|
52
52
|
) -> bool:
|
53
53
|
"""
|
54
|
-
|
54
|
+
检查是否为 LaTeX 指令
|
55
55
|
"""
|
56
56
|
|
57
|
-
# print("
|
57
|
+
# print("检查消息满足渲染要求:", event)
|
58
58
|
if isinstance(event, MessageEvent):
|
59
59
|
# print("此为原始信息:", event.raw_message)
|
60
60
|
# event.message
|
@@ -71,14 +71,14 @@ async def check_for_scan(
|
|
71
71
|
return False
|
72
72
|
|
73
73
|
|
74
|
-
|
74
|
+
latexg = nonebot.on_message(
|
75
75
|
rule=check_for_scan,
|
76
76
|
block=False,
|
77
77
|
priority=90,
|
78
78
|
)
|
79
79
|
|
80
80
|
|
81
|
-
@
|
81
|
+
@latexg.handle()
|
82
82
|
async def handle_pic(
|
83
83
|
event: MessageEvent,
|
84
84
|
# state: T_State,
|
@@ -94,7 +94,7 @@ async def handle_pic(
|
|
94
94
|
latexes.extend(LATEX_PATTERN.finditer(event.message.extract_plain_text()))
|
95
95
|
|
96
96
|
if not latexes:
|
97
|
-
await
|
97
|
+
await latexg.finish(
|
98
98
|
"同志!以我们目前的实力,暂时无法读取你大脑中的公式,你还是把它通过你的输入设备打出来吧。"
|
99
99
|
)
|
100
100
|
return
|
{nonebot_plugin_latex-0.0.2 → nonebot_plugin_latex-0.0.2.2}/nonebot_plugin_latex.egg-info/PKG-INFO
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: nonebot-plugin-latex
|
3
|
-
Version: 0.0.2
|
3
|
+
Version: 0.0.2.2
|
4
4
|
Summary: 通过互联网公共服务渲染LaTeX公式
|
5
5
|
Author-email: Eilles <EillesWan@outlook.com>
|
6
6
|
License: 木兰宽松许可证, 第2版
|
@@ -146,22 +146,25 @@ Requires-Dist: pymdown-extensions>=9.1
|
|
146
146
|
Requires-Dist: aiofiles>=0.8.0
|
147
147
|
|
148
148
|
# nonebot-plugin-latex
|
149
|
-
NoneBot2 LaTeX图形渲染插件
|
150
149
|
|
151
|
-
|
150
|
+
NoneBot2 LaTeX 图形渲染插件
|
151
|
+
|
152
|
+
通过互联网公共服务渲染 LaTeX 公式
|
152
153
|
|
153
154
|
利用 www.latex2png.com 和 latex.codecogs.com 在线渲染 LaTeX 公式
|
154
155
|
|
155
156
|
## 安装
|
156
157
|
|
158
|
+
```bash
|
157
159
|
pip install nonebot-plugin-latex
|
160
|
+
```
|
158
161
|
|
159
162
|
## 使用
|
160
163
|
|
161
164
|
如果希望直接作为 LaTeX 渲染插件使用的话,请在 NoneBot 配置文件中添加以下内容:
|
162
165
|
|
163
166
|
```env
|
164
|
-
|
167
|
+
latex_enable_as_application = true
|
165
168
|
```
|
166
169
|
|
167
|
-
这样就可以使用 `latex` 命令进行渲染了,例如 `latex E=mc^2
|
170
|
+
这样就可以使用 `latex` 命令进行渲染了,例如 `latex $E=mc^2$` 就会返回这个方程式的渲染图片。
|
File without changes
|
{nonebot_plugin_latex-0.0.2 → nonebot_plugin_latex-0.0.2.2}/nonebot_plugin_latex/converter.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|