add remove Empty Line
This commit is contained in:
@@ -27,7 +27,7 @@ from hashl import md5WithBase64
|
||||
from enum import Enum
|
||||
from rsstempdict import rssMetaInfo, rssMetaList
|
||||
from random import randrange
|
||||
from textc import textc
|
||||
from textc import textc, removeEmptyLine
|
||||
from re import search, I
|
||||
from rsschecker import RSSCheckerThread
|
||||
from rsslist import getInlineKeyBoardForRSSList, InlineKeyBoardForRSSList, getInlineKeyBoardForRSSInList, getTextContentForRSSInList
|
||||
@@ -167,7 +167,7 @@ class main:
|
||||
text.addtotext(
|
||||
f"""<a href="{content['link']}">{escape(content['link'])}</a>""")
|
||||
if config.show_content and 'description' in content and content['description'] is not None and content['description'] != '':
|
||||
text.addtotext(content['description'])
|
||||
text.addtotext(removeEmptyLine(content['description']))
|
||||
|
||||
def getListCount(content: dict, key: str):
|
||||
if key not in content or content[key] is None:
|
||||
|
||||
17
textc.py
17
textc.py
@@ -36,3 +36,20 @@ def timeToStr(t: int) -> str:
|
||||
te = te + op + \
|
||||
f'{int(abs(timezone)/3600):02}:{int(abs(timezone)%3600/60):02}'
|
||||
return te
|
||||
|
||||
|
||||
def removeEmptyLine(s: str) -> str:
|
||||
l = s.splitlines(False)
|
||||
r = []
|
||||
for v in l:
|
||||
if v != '':
|
||||
r.append(v)
|
||||
f = True
|
||||
z = ''
|
||||
for v in r:
|
||||
if f:
|
||||
f = False
|
||||
z = v
|
||||
else:
|
||||
z = z + '\n' + v
|
||||
return z
|
||||
|
||||
Reference in New Issue
Block a user