forked from nonebot/noneflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ab1a467
commit 4872ca2
Showing
10 changed files
with
119 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
{% macro render_data(key, value, skip_plugin_test) %} | ||
{% if key == "homepage" %} | ||
项目 <a href="{{ value }}">主页</a> 返回状态码 200。 | ||
项目 <a href="{{ value }}">主页</a> 返回状态码 200。 | ||
{%- elif key == "tags" and value %} | ||
标签: {{ value|tags_to_str }}。 | ||
标签: {{ value|tags_to_str }}。 | ||
{%- elif key == "project_link" %} | ||
项目 <a href="https://pypi.org/project/{{ value }}/">{{ value }}</a> 已发布至 PyPI。 | ||
项目 <a href="https://pypi.org/project/{{ value }}/">{{ value }}</a> 已发布至 PyPI。 | ||
{%- elif key == "type" %} | ||
插件类型: {{ value }}。 | ||
插件类型: {{ value }}。 | ||
{%- elif key == "load" %} | ||
插件加载测试: {{ value }}。 | ||
插件加载测试: {{ value }}。 | ||
{%- elif key == "supported_adapters" %} | ||
插件支持的适配器: {{ value|supported_adapters_to_str }}。 | ||
插件支持的适配器: {{ value|supported_adapters_to_str }}。 | ||
{%- elif key == "action_url" %} | ||
{% if skip_plugin_test %} | ||
插件 <a href="{{ value }}">加载测试</a> 已跳过。 | ||
{%- else %} | ||
插件 <a href="{{ value }}">加载测试</a> 通过。 | ||
{%- endif %} | ||
{% if skip_plugin_test %} | ||
插件 <a href="{{ value }}">加载测试</a> 已跳过。 | ||
{%- else %} | ||
插件 <a href="{{ value }}">加载测试</a> 通过。 | ||
{%- endif %} | ||
{% else %} | ||
{{ key }}: {{ value }}。 | ||
{{ key }}: {{ value }}。 | ||
{%- endif %} | ||
{% endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,64 @@ | ||
{% macro render_error(error) %} | ||
|
||
{% set loc = error.loc %} | ||
{% set type = error.type %} | ||
{%- if loc|length == 3 and loc[0] == "tags" and type == "missing" %} | ||
第 {{ loc[1] + 1 }} 个标签缺少 {{ loc[2] }} 字段。<dt>请确保标签字段完整。</dt> | ||
{% elif loc|length == 3 and loc[0] == "tags" and type == "string_too_long" %} | ||
第 {{ loc[1] + 1 }} 个标签名称过长<dt>请确保标签名称不超过 10 个字符。</dt> | ||
{%- elif loc|length == 3 and loc[0] == "tags" and type == "color_error" %} | ||
第 {{ loc[1] + 1 }} 个标签颜色错误<dt>请确保标签颜色符合十六进制颜色码规则。</dt> | ||
{%- elif loc|length == 2 and loc[0] == "tags" and type == "model_type" %} | ||
第 {{ loc[1] + 1 }} 个标签格式错误。<dt>请确保标签为字典。</dt> | ||
{%- elif type == "homepage" and error.ctx.status_code != -1 %} | ||
项目 <a href="{{ error.input }}">主页</a> 返回状态码 {{ error.ctx.status_code }}。<dt>请确保你的项目主页可访问。</dt> | ||
{%- elif type == "homepage" and error.ctx.status_code == -1 %} | ||
项目 <a href="{{ error.input }}">主页</a> 访问出错。<details><summary>错误信息</summary>{{ error.ctx.msg }}</details> | ||
{%- elif type == "project_link.not_found" %} | ||
项目 <a href="https://pypi.org/project/{{ error.input }}/">{{ error.input }}</a> 未发布至 PyPI。<dt>请将你的项目发布至 PyPI。</dt> | ||
{%- elif type == "project_link.name" %} | ||
PyPI 项目名 {{ error.input }} 不符合规范。<dt>请确保项目名正确。</dt> | ||
{%- elif type == "module_name" %} | ||
包名 {{ error.input }} 不符合规范。<dt>请确保包名正确。</dt> | ||
{%- elif type == "duplication" %} | ||
{{ error.msg }}<dt>请确保没有重复发布。</dt> | ||
{%- elif type == "plugin_test" %} | ||
插件加载测试未通过。<details><summary>测试输出</summary>{{ error.ctx.output }}</details> | ||
{%- elif type == "metadata" %} | ||
无法获取到插件元数据。<dt>{{ "请填写插件元数据" if error.ctx.plugin_test_result else "请确保插件正常加载" }}。</dt> | ||
{%- elif type == "plugin.type" %} | ||
插件类型 {{ error.input }} 不符合规范。<dt>请确保插件类型正确,当前仅支持 application 与 library。</dt> | ||
{%- elif type == "supported_adapters.missing" %} | ||
适配器 {{ ', '.join(error.ctx.missing_adapters) }} 不存在。<dt>请确保适配器模块名称正确。</dt> | ||
{%- elif type == "missing" %} | ||
{{ loc|loc_to_name }}: 无法匹配到数据。<dt>请确保填写该项目。</dt> | ||
{%- elif type == "model_type" %} | ||
{{ loc|loc_to_name }}: 格式错误。<dt>请确保其为字典。</dt> | ||
{%- elif type == "list_type" %} | ||
{{ loc|loc_to_name }}: 格式错误。<dt>请确保其为列表。</dt> | ||
{%- elif type == "set_type" %} | ||
{{ loc|loc_to_name }}: 格式错误。<dt>请确保其为集合。</dt> | ||
{%- elif type == "json_type" %} | ||
{{ loc|loc_to_name }}: 解码失败。<dt>请确保其为 JSON 格式。</dt> | ||
{%- elif type == "string_too_long" %} | ||
{{ loc|loc_to_name }}: 字符过多。<dt>请确保其不超过 {{ error.ctx.max_length }} 个字符。</dt> | ||
{%- else %} | ||
{{ error.loc|loc_to_name }}: {{ error.msg }} | ||
{%- endif %} | ||
{% set ctx = error.ctx %} | ||
{% set name = loc|loc_to_name %} | ||
{% set input = error.input %} | ||
|
||
{% macro render_tag_error(index, message, dt_message) %} | ||
第 {{ index + 1 }} 个标签{{ message }}。<dt>请确保标签{{ dt_message }}。</dt> | ||
{% endmacro %} | ||
|
||
{% macro detail_message(summary, detail) %} | ||
<details><summary>{{ summary }}</summary>{{ detail }}</details> | ||
{% endmacro %} | ||
|
||
{% if loc|length == 3 and loc[0] == "tags" %} | ||
{% if type == "missing" %} | ||
{{ render_tag_error(loc[1], "缺少第" ~ loc[2] ~ " 字段", "请确保标签字段完整。") }} | ||
{% elif type == "string_too_long" %} | ||
{{ render_tag_error(loc[1], "名称过长", "请确保标签名称不超过 10 个字符。") }} | ||
{% elif type == "color_error" %} | ||
{{ render_tag_error(loc[1], "颜色错误", "请确保标签颜色符合十六进制颜色码规则。") }} | ||
{% endif %} | ||
{% elif loc|length == 2 and loc[0] == "tags" and type == "model_type" %} | ||
{{ render_tag_error(loc[1], "格式错误", "请确保标签为字典。") }} | ||
{% elif type == "homepage" %} | ||
{% if ctx.status_code != -1 %} | ||
项目 <a href="{{ input }}">主页</a> 返回状态码 {{ ctx.status_code }}。<dt>请确保你的项目主页可访问。</dt> | ||
{% else %} | ||
项目 <a href="{{ input }}">主页</a> 访问出错。{{ detail_message("错误信息", ctx.error) }} | ||
{% endif %} | ||
{% elif type == "project_link.not_found" %} | ||
项目 <a href="https://pypi.org/project/{{ input }}/">{{ input }}</a> 未发布至 PyPI。<dt>请将你的项目发布至 PyPI。</dt> | ||
{% elif type == "project_link.name" %} | ||
PyPI 项目名 {{ input }} 不符合规范。<dt>请确保项目名正确。</dt> | ||
{% elif type == "module_name" %} | ||
包名 {{ input }} 不符合规范。<dt>请确保包名正确。</dt> | ||
{% elif type == "duplication" %} | ||
{{ error.msg }}<dt>请确保没有重复发布。</dt> | ||
{% elif type == "plugin.test" %} | ||
插件加载测试未通过。{{ detail_message("测试输出", ctx.output) }} | ||
{% elif type == "metadata" %} | ||
无法获取到插件元数据。<dt>{{ "请填写插件元数据" if ctx.plugin_test_result else "请确保插件正常加载" }}。</dt> | ||
{% elif type == "plugin.type" %} | ||
插件类型 {{ input }} 不符合规范。<dt>请确保插件类型正确,当前仅支持 application 与 library。</dt> | ||
{% elif type == "supported_adapters.missing" %} | ||
适配器 {{ ', '.join(ctx.missing_adapters) }} 不存在。<dt>请确保适配器模块名称正确。</dt> | ||
{% elif type == "missing" %} | ||
{{ name }}: 无法匹配到数据。<dt>请确保填写该项目。</dt> | ||
{% elif type == "model_type" %} | ||
{{ name }}: 格式错误。<dt>请确保其为字典。</dt> | ||
{% elif type == "list_type" %} | ||
{{ name }}: 格式错误。<dt>请确保其为列表。</dt> | ||
{% elif type == "set_type" %} | ||
{{ name }}: 格式错误。<dt>请确保其为集合。</dt> | ||
{% elif type == "json_type" %} | ||
{{ name }}: 解码失败。<dt>请确保其为 JSON 格式。</dt> | ||
{% elif type == "string_too_long" %} | ||
{{ name }}: 字符过多。<dt>请确保其不超过 {{ ctx.max_length }} 个字符。</dt> | ||
{% else %} | ||
{{ error.name }}: {{ error.msg }} | ||
{% endif %} | ||
{% endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters