This repository was archived by the owner on Mar 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProcessText.py
More file actions
52 lines (47 loc) · 1.96 KB
/
Copy pathProcessText.py
File metadata and controls
52 lines (47 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
class ProcessText:
__cache = {}
__result = {}
def __init__(self, text):
self.__cache = text
def getSimpleText(self):
self.__result['title'] = self.__cache['top'] + " " + self.__cache['title']
self.__result['content'] = self.__cache['title'] + "\n" + str(self.__cache['content'])[0:20]
return self.__result
def getNormalText(self):
self.__result['title'] = self.__cache['top'] + " " + self.__cache['title']
self.__result['content'] = str(self.__cache['content'])
return self.__result
def getFullTextMD(self):
self.__result['title'] = self.__cache['title']
tmp = "## " + self.__cache['top'] + " " + self.__result['title'] + "\n \n"
tmp += "### 日期: **" + self.__cache['time']
tmp += "** 作者: **" + self.__cache['author'] + "**\n \n --- \n \n"
tmp += self.__cache['content']
tmp += "\n --- \n "
if self.__cache['attach']:
for i in self.__cache['attach']:
tmp += "### 附件:" + "[%s]" % i
tmp += "(%s)\n \n" % self.__cache['attach'].get(i)
else:
tmp += "### 该通知没有附件。"
self.__result['content'] = tmp
return self.__result
def getFullText(self):
self.__result['title'] = self.__cache['title']
tmp = self.__cache['top'] + " " + self.__result['title'] + "\n"
tmp += "日期:" + self.__cache['time']
tmp += "作者:" + self.__cache['author'] + "\n"
tmp += 50 * '-'
tmp += "\n"
tmp += self.__cache['content']
tmp += "\n"
tmp += 50 * '-'
tmp += "\n"
if self.__cache['attach']:
for i in self.__cache['attach']:
tmp += "附件:" + "%s:" % i
tmp += "%s\n" % self.__cache['attach'].get(i)
else:
tmp += "该通知没有附件!"
self.__result['content'] = tmp
return self.__result