mirror of
https://github.com/Xtao-Labs/QQ-GitHub-Bot.git
synced 2025-01-30 15:08:54 +00:00
🚧 add html template
This commit is contained in:
parent
4db8f9f8f1
commit
2b7574a558
6
.prettierrc
Normal file
6
.prettierrc
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"endOfLine": "lf",
|
||||
"singleQuote": false
|
||||
}
|
@ -4,7 +4,7 @@
|
||||
@Author : yanyongyu
|
||||
@Date : 2021-03-11 16:57:04
|
||||
@LastEditors : yanyongyu
|
||||
@LastEditTime : 2021-05-14 01:45:44
|
||||
@LastEditTime : 2021-05-14 18:13:34
|
||||
@Description : None
|
||||
@GitHub : https://github.com/yanyongyu
|
||||
"""
|
||||
@ -40,6 +40,7 @@ class Issue(BaseModel):
|
||||
labels_url: str
|
||||
comments_url: str
|
||||
events_url: str
|
||||
timeline_url: str
|
||||
html_url: str
|
||||
number: int
|
||||
state: str
|
||||
@ -93,5 +94,5 @@ class Issue(BaseModel):
|
||||
TimelineEventReviewed, TimelineEventRenamed],
|
||||
self.requester,
|
||||
"GET",
|
||||
f"{self.url}/timeline",
|
||||
self.timeline_url,
|
||||
headers=headers)
|
||||
|
@ -4,7 +4,7 @@
|
||||
@Author : yanyongyu
|
||||
@Date : 2021-05-14 00:57:33
|
||||
@LastEditors : yanyongyu
|
||||
@LastEditTime : 2021-05-14 02:18:47
|
||||
@LastEditTime : 2021-05-14 18:13:03
|
||||
@Description : None
|
||||
@GitHub : https://github.com/yanyongyu
|
||||
"""
|
||||
@ -73,7 +73,6 @@ class TimelineEventCommented(TimelineEvent):
|
||||
body: str
|
||||
body_text: Optional[str]
|
||||
body_html: Optional[str]
|
||||
performed_via_github_app: bool
|
||||
actor: User
|
||||
|
||||
|
||||
@ -117,4 +116,3 @@ class TimelineEventRenamed(TimelineEvent):
|
||||
commit_url: Optional[str]
|
||||
created_at: datetime
|
||||
rename: TimelineEventRenamedDetail
|
||||
performed_via_github_app: Optional[bool]
|
||||
|
128
src/plugins/github/libs/issue/issue.html
Normal file
128
src/plugins/github/libs/issue/issue.html
Normal file
@ -0,0 +1,128 @@
|
||||
<!--
|
||||
* @Author : yanyongyu
|
||||
* @Date : 2021-05-14 17:11:26
|
||||
* @LastEditors : yanyongyu
|
||||
* @LastEditTime : 2021-05-14 18:19:48
|
||||
* @Description : None
|
||||
* @GitHub : https://github.com/yanyongyu
|
||||
-->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="dns-prefetch" href="https://github.githubassets.com" />
|
||||
<link rel="dns-prefetch" href="https://avatars.githubusercontent.com" />
|
||||
<link rel="dns-prefetch" href="https://github-cloud.s3.amazonaws.com" />
|
||||
<link
|
||||
rel="dns-prefetch"
|
||||
href="https://user-images.githubusercontent.com/"
|
||||
/>
|
||||
<link
|
||||
href="https://cdn.jsdelivr.net/npm/@primer/css@^17.0.0/dist/primer.css"
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
/>
|
||||
</head>
|
||||
<body>
|
||||
<div class="application-main">
|
||||
<main>
|
||||
<div class="color-bg-secondary pt-3 mb-5">
|
||||
<h1
|
||||
class="
|
||||
d-flex
|
||||
px-3 px-md-4 px-lg-5
|
||||
flex-wrap flex-items-center
|
||||
break-word
|
||||
f3
|
||||
text-normal
|
||||
"
|
||||
>
|
||||
<svg
|
||||
class="octicon octicon-repo color-text-secondary mr-2"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 16 16"
|
||||
width="16"
|
||||
height="16"
|
||||
>
|
||||
<path
|
||||
fill-rule="evenodd"
|
||||
d="M2 2.5A2.5 2.5 0 014.5 0h8.75a.75.75 0 01.75.75v12.5a.75.75 0 01-.75.75h-2.5a.75.75 0 110-1.5h1.75v-2h-8a1 1 0 00-.714 1.7.75.75 0 01-1.072 1.05A2.495 2.495 0 012 11.5v-9zm10.5-1V9h-8c-.356 0-.694.074-1 .208V2.5a1 1 0 011-1h8zM5 12.25v3.25a.25.25 0 00.4.2l1.45-1.087a.25.25 0 01.3 0L8.6 15.7a.25.25 0 00.4-.2v-3.25a.25.25 0 00-.25-.25h-3.5a.25.25 0 00-.25.25z"
|
||||
></path>
|
||||
</svg>
|
||||
<span class="author flex-self-stretch">
|
||||
<a href="#" style="box-shadow: transparent 0px 0px"> {owner} </a>
|
||||
</span>
|
||||
<span class="mx-1 flex-self-stretch color-text-secondary">/</span>
|
||||
<strong class="flex-self-stretch">
|
||||
<a href="#" style="box-shadow: transparent 0px 0px">
|
||||
{repo_name}
|
||||
</a>
|
||||
</strong>
|
||||
</h1>
|
||||
</div>
|
||||
<div
|
||||
class="
|
||||
container-xl
|
||||
clearfix
|
||||
new-discussion-timeline
|
||||
px-3 px-md-4 px-lg-5
|
||||
"
|
||||
>
|
||||
<div class="repository-content">
|
||||
<div class="clearfix">
|
||||
<div class="color-bg-canvas mb-3" id="header">
|
||||
<div>
|
||||
<div class="d-flex flex-column flex-md-row">
|
||||
<h1
|
||||
class="
|
||||
text-normal
|
||||
mb-2
|
||||
lh-condensed
|
||||
f1
|
||||
mr-0
|
||||
flex-auto
|
||||
break-word
|
||||
"
|
||||
>
|
||||
<span class="markdown-title">{title}</span>
|
||||
<span class="f1-light color-text-tertiary"
|
||||
>#{number}</span
|
||||
>
|
||||
</h1>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="
|
||||
d-flex
|
||||
flex-items-center flex-wrap
|
||||
mt-0
|
||||
color-text-secondary
|
||||
pb-2
|
||||
border-bottom
|
||||
color-border-primary
|
||||
f5
|
||||
"
|
||||
>
|
||||
<div
|
||||
class="
|
||||
flex-shrink-0
|
||||
mb-2
|
||||
flex-self-start flex-md-self-center
|
||||
"
|
||||
>
|
||||
<span class="State State--{status}">{status}</span>
|
||||
</div>
|
||||
<div class="d-flex flex-items-baseline">
|
||||
<div class="flex-auto min-width-0 mb-2">
|
||||
{comments} comments
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
28
src/plugins/github/libs/issue/render.py
Normal file
28
src/plugins/github/libs/issue/render.py
Normal file
@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@Author : yanyongyu
|
||||
@Date : 2021-05-14 17:09:12
|
||||
@LastEditors : yanyongyu
|
||||
@LastEditTime : 2021-05-14 18:26:47
|
||||
@Description : None
|
||||
@GitHub : https://github.com/yanyongyu
|
||||
"""
|
||||
__author__ = "yanyongyu"
|
||||
|
||||
from html import escape
|
||||
from pathlib import Path
|
||||
|
||||
from src.libs.github.models import Issue
|
||||
|
||||
with (Path(__file__).parent / "issue.html").open("r") as f:
|
||||
HTML = f.read()
|
||||
|
||||
|
||||
def issue_to_html(owner: str, repo_name: str, issue: Issue):
|
||||
return HTML.format(owner=escape(owner),
|
||||
repo_name=escape(repo_name),
|
||||
title=escape(issue.title),
|
||||
number=issue.number,
|
||||
status=escape(issue.state),
|
||||
comments=issue.comments)
|
Loading…
Reference in New Issue
Block a user