简 介: 本文给出了使用CSDN编写微信公众号的推文的过程。为了方便,编写了一些辅助程序以弥补CSDN中的补足,并对从CSDN到MDNICE进行文章格式的转换。通过长期使用,验证了这个过程非常有效。
关键词 : 推文,CSDN,MDNICE
?
§01 提??问
??卓大,想问一下您平时微信的推文是怎么编辑的。我自己的推文是先用markdown写的,再粘贴进秀米编辑,就很麻烦,想了解下您的解决方案。
▲ 图1.1 TSINGHUAZHUOQING公众号推文
?
§02 解决方案
??的确,我在公众号中的推文都是利用Markdown编辑器书写的,具体的过程如下。
一、写公众号推文过程
??在TSINGHUAJOKING的推文编辑过程如下图所示。经过三个步骤:首先在CSDN进行编辑,然后在MDNICE上穿个马甲,最后粘贴到公众号形成推文。
CSDN
编辑
MDNICE
穿马甲
WECHAT
发表
二、为什么选择CSDN编辑?
??之所以选择CSDN进行编辑,主要看中它的MARKDOWN编辑器使用起来非常方便,功能也挺多的,此外:
- 编辑过程中自然就存储在网络上,在任何联网计算机上就可以进行修改;
- 它可以帮助存储图片,动图;粘贴起来十分方便;
▲ 图2.2.1 CSDN上的Markdown编辑器
??当然,它现在还有一些缺陷, 比如:
- 无法直接播放微信平台中的视频,只能播放有限的视频源;
- 对于GIF的支持还仅限于5M字节;
- 缺少对于文本自动纠错的功能;
??它现在还有待进一步完善。
??当然,CSDN上的Markdown编辑器的功能缺陷,可以通过外挂Python小程序来进行弥补,比如通过:
- cdf: 对标题、字体进行美化;
- cdpt: 自动导入表格;
- cdpp、cdpg:自动完成图片,动图的导入、排序、增加标题;
- cdm: 一键生成摘要、思维导图目录、参考文献、图片表格引用等;
??实际上,基于Markdown编辑器,你可以通过python小程序随心所欲增加自己想要的功能。
三、使用墨滴给文档穿马甲
??墨滴网站 提供对Markdown编辑文章进行格式美化的功能。提供了非常丰富的格式模板共选择。
▲ 图2.3.1 墨滴网站上丰富的推文马甲
??可以根据自己推文的风格,选择合适的模板进行套用。也可以在其中自定义属于自己风格的模板。
▲ 图2.3.2 更换推文马甲过程
??将CSDN上的Markdown文本,拷贝到墨滴进行穿马甲的过程中,也存在一些格式不兼容的问题。比如在对图片格式和注释方面的显示,对于引用文本格式,标注格式等。这里也是通过一个小的Python程序进行自动过滤和修正,无需手工进行修改。
??这个程序cd2md的程序在本文最后给出。
四、发布推文
??墨滴网页提供微信推文和知乎发文的拷贝按钮,点按之后,在微信推文中直接粘贴便可以得到美化后的推文了。同样,在头条,知乎上也都可以进行粘贴。
▲ 图2.4.1 墨滴网页上提供微信推文、知乎发文拷贝按钮
??如果想把文章拷贝到WORD中,发现直接通过墨滴所得到的文档并不美观。实际上直接从CSDN上的MARKDOWN预览栏全部选择-拷贝-粘贴到WORD中,可以得到格式比较美观的WORD文档。只是需要后期对所有的插图重新进行尺寸调整,居中处理。
?
※ 附??件 ※
??本文给出了使用CSDN编写微信公众号的推文的过程。为了方便,编写了一些辅助程序以弥补CSDN中的补足,并对从CSDN到MDNICE进行文章格式的转换。通过长期使用,验证了这个过程非常有效。
■ cd2md
from head import *
import webbrowser
import requests
from bs4 import BeautifulSoup
csdn_title = '写文章-CSDN博客'
mdnice_title = '让排版变'
gitee_title = '· 编辑文件 ·'
typora_title = 'Typora'
rect = tspgetwindowrect(gitee_title)
giteeflag = abs(sum(rect))
rect = tspgetwindowrect(mdnice_title)
mdniceflag = abs(sum(rect))
rect = tspgetwindowrect(typora_title)
typoraflag = abs(sum(rect))
if typoraflag > 0:
giteeflag = 1
csdnurl = ''
csdnpaper = ''
if giteeflag > 0:
csdnurl = clipboard.paste()
if csdnurl.find('https:') < 0:
csdnurl = tspread()[-1]
if csdnurl.find('?articleId=') < 0:
if csdnurl.find('https:') < 0:
csdnurl = ''
else:
findid = csdnurl.find('Id=')
ss = csdnurl[findid+3:]
csdnurl = 'https://zhuoqing.blog.csdn.net/article/details/%s'%ss
if len(csdnurl) > 0:
if csdnurl.find('http') == 0:
xmltext = requests.get(csdnurl)
soup = BeautifulSoup(xmltext.text, 'lxml')
try:
csdnpaper = soup.head.title.string.split('_')[0]
except:
pass
keepnbspflag = 0
linknotestr = ''
linknoteflag = 0
linedeleteflag = 1
def char2color(argv1):
color = ''
if argv1.count('a') == 1: color = 'gray'
if argv1.count('a') == 2: color = '#b19e26'
if argv1.count('A') == 1: color = 'olive'
if argv1.count('A') == 2: color = '#2693ba'
if argv1.count('b') == 1: color = 'blue'
if argv1.count('b') == 2: color = 'darkslateblue'
if argv1.count('B') == 1: color = 'slateblue'
if argv1.count('d') == 1: color = 'seagreen'
if argv1.count('D') == 1: color = '#%06x'%int.from_bytes(tspgetcolor().to_bytes(3, 'little'), 'big')
if argv1.count('g') == 1: color = 'darkgreen'
if argv1.count('g') == 2: color = 'green'
if argv1.count('K') == 1: color = 'black'
if argv1.count('m') == 1: color = 'brown'
if argv1.count('M') == 1: color = '#944276'
if argv1.count('p') == 1: color = '#7a37ab'
if argv1.count('P') == 1: color = '#7f00ff'
if argv1.count('q') == 1: color = 'cyan'
if argv1.count('Q') == 1: color = 'darkcyan'
if argv1.count('q') == 2: color = '#b9a0a6'
if argv1.count('r') == 1: color = 'red'
if argv1.count('R') == 1: color = 'darkred'
if argv1.count('r') == 2: color = 'c000'
if argv1.count('t') == 1: color = 'teal'
if argv1.count('T') == 1: color = '#008090'
if argv1.count('v') == 2: color = 'silver'
if argv1.count('v') == 1: color = 'blueviolet'
if argv1.count('w') == 1: color = 'white'
if argv1.count('W') == 1: color = '#c02060'
if argv1.count('y') == 1: color = 'yellow'
if argv1.count('y') == 2: color = '#b01019'
if argv1.count('Y') == 1: color = '#e06030'
if argv1.count('z') == 1: color = 'purple'
if argv1.count('Z') == 1: color = '#600090'
return color
def char2face(argv1):
face = ''
if argv1.count('s') == 1: face= '宋体'
if argv1.count('k') == 1: face= '楷体'
if argv1.count('f') == 1: face= '仿宋'
if argv1.count('l') == 1: face= '隶属'
if argv1.count('h') == 1: face= '黑体'
if argv1.count('F') == 2: face=''
return face
changecolordict = {}
changesizedict = {}
changefacedict = {}
changetitledict = {}
tablesect = []
deletecode = 1
indentflag = 0
bolddeleteflag = 0
mergepicflag = 0
linkpicflag = 0
deletechapterflag = 1
if giteeflag > 0:
deletecode = 0
if len(sys.argv) > 1:
for v in sys.argv[1:]:
if v.count('&') > 0:
keepnbspflag = 1
v = v.replace('&', '')
if v.count('\\') > 0:
mergepicflag = v.count('\\')
v = v.replace('\\', '')
if v.count('/') > 0:
linkpicflag = v.count('/')
v = v.replace('/', '')
if v.count('-') > 0:
linknoteflag = v.count('-')*2
v = v.replace('-', '')
if v.count('_') > 0:
linedeleteflag = 0
v = v.replace('_', '')
if v.count('$') > 0:
v = v.replace('$', '')
deletechapterflag = 0
if len(v) > 1:
if v[0] >= '1' and v[0] <= '9' and v[1] >= '0' and v[1] <= '9':
changesizedict.update([(v[0], v[1])])
elif v[0] == '#' and len(v) >=3:
if v[1] >= '0' and v[1] <= '9' and v[2] >= '0' and v[2] <= '9':
changetitledict.update([(v[1], v[2])])
if len(v) >= 5:
if v[3] >= '0' and v[3] <= '9' and v[4] >= '0' and v[4] <= '9':
changetitledict.update([(v[3], v[4])])
if len(v) >= 7:
if v[5] >= '0' and v[5] <= '9' and v[6] >= '0' and v[6] <= '9':
changetitledict.update([(v[5], v[6])])
if len(v) >= 9:
if v[7] >= '0' and v[7] <= '9' and v[8] >= '0' and v[8] <= '9':
changetitledict.update([(v[7], v[8])])
if len(v) >= 11:
if v[9] >= '0' and v[9] <= '9' and v[10] >= '0' and v[10] <= '9':
changetitledict.update([(v[9], v[10])])
if len(v) >= 13:
if v[11] >= '0' and v[11] <= '9' and v[12] >= '0' and v[12] <= '9':
changetitledict.update([(v[11], v[12])])
if len(v) >= 15:
if v[13] >= '0' and v[13] <= '9' and v[14] >= '0' and v[14] <= '9':
changetitledict.update([(v[13], v[14])])
elif v[0] == '|':
tablesect = [int(s)-1 for s in v[1:]]
else:
fromcolor = char2color(v[0:-1])
tocolor = char2color(v[-1:])
if len(fromcolor) > 0 and len(tocolor) > 0:
changecolordict.update([(fromcolor, tocolor)])
continue
fromface = char2face(v[0:-1])
toface = char2face(v[-1:])
if len(fromface) > 0 and len(toface) > 0:
changefacedict.updata([(fromface, toface)])
else:
if v == 'c':
deletecode = 0
elif v == 'i':
indentflag = 1
elif v == 'C':
indentflag = 1
elif v == '*':
bolddeleteflag = 1
if len(tablesect) > 0:
printf(tablesect)
tspsendwindowkey(mdnice_title, 'c', control=1)
mdstr = clipboard.paste()
if len(mdstr) > 0:
mdline = mdstr.split('\n')
mdstr = ''
maxts = max(tablesect)
for s in mdline:
if s.count('|') > maxts:
ss = s.split('|')
sss = []
for id,a in enumerate(ss):
if id in tablesect:
sss.append(a)
s = '|'.join(sss)
mdstr = mdstr + s + '\n'
clipboard.copy(mdstr)
tspsendwindowkey(mdnice_title, "v", control=1)
exit()
for c in changecolordict.keys():
fromstr = 'color=%s'%c
tostr = 'color=%s'%changecolordict[c]
printff(fromstr, tostr)
def checkmdnice(waittime=0):
begintime = time.time()
while True:
windowstr = tspgetwindowtitle()
for s in windowstr:
if s.find(mdnice_title) >= 0:
return 1;
if time.time() - begintime >= waittime: return 0
'''
if checkmdnice(0) == 0:
webbrowser.open('http://www.mdnice.com')
if checkmdnice(10) == 0:
printf('Can not open MDNICE .....')
exit()
'''
if mdniceflag > 0:
tspsendwindowkey(mdnice_title, '\t\t\t\t\t\t\t\t\t\t')
tspsendwindowkey(mdnice_title, "a", control=1)
tspsendwindowkey(mdnice_title, "%c"%VK_DELETE, vk=1)
if giteeflag > 0:
tspsendwindowkey(gitee_title, '\t\t\t\t\t\t\t\t\t\t')
tspsendwindowkey(gitee_title, "a", control=1)
tspsendwindowkey(gitee_title, "%c"%VK_DELETE, vk=1)
tspsendwindowkey(csdn_title, "acv", control=1)
csdnstrsect = clipboard.paste().split('\n')
pastestr = ''
notedim = []
linkdim = []
linknum = []
for s in csdnstrsect:
n1 = s.find('[^')
n2 = s.find(']:')
if n1 >= 0 and n2 >= 0 and n2 - n1 < 20:
notedim.append(s)
n1 = s.find('[')
n2 = s.find(']')
p1 = s.find('(')
p2 = s.find(')')
ss1 = s.find('![')
if n1 >= 0 and n2 >= 0 and p1 >= 0 and p2 >= 0 and n2 > n1 and p2 > p1 and p1 > n2 and ss1 < 0:
linkstr = s[p1+1:p2]
linkdim.append(linkstr)
linknum.append(0)
deleteflag = 0
lastlen = 0
nbspcount = 0
emsprtflag = 0
for id,s in enumerate(csdnstrsect):
if len(s) == 0:
emsprtflag = 0
continue
if s[0] == ' ':
emsprtflag = 0
continue
if emsprtflag > 0:
csdnstrsect[id] = '   ' + s + '<br>'
continue
if s[0:2] == ': ' and id > 0:
if csdnstrsect[id-1].find('●') >= 0 or csdnstrsect[id-1].find('○') >= 0 or\
csdnstrsect[id-1].find('△') >= 0 or csdnstrsect[id-1].find('▲') >= 0 or\
csdnstrsect[id-1].find('→') >= 0 or csdnstrsect[id-1].find('√') >= 0 or\
csdnstrsect[id-1].find('■') >= 0 or csdnstrsect[id-1].find('□') >= 0 or\
csdnstrsect[id-1].find('★') >= 0 or csdnstrsect[id-1].find('☆') >= 0 or\
csdnstrsect[id-1].find('⊙') >= 0 or csdnstrsect[id-1].find('◎') >= 0:
csdnstrsect[id-1] = '  ' + csdnstrsect[id-1] + '<br>'
else: csdnstrsect[id-1] = '  ● ' + csdnstrsect[id-1] + '<br>'
csdnstrsect[id] = '   ' + s[2:] + '<br>'
emsprtflag = 1
for s in csdnstrsect:
if keepnbspflag == 0 or nbspcount == 0:
if s.find(' ') >= 0:
nbspcount += 1
continue
if s.find(' ') >= 0:
nbspcount += 1
continue
if s.find('$~$') >= 0: continue
if s.find('<br/>') >= 0: continue
if s.find('---') == 0:
if linedeleteflag > 0:
continue
if giteeflag == 0:
if s.find('■ 相关文献链接') >= 0: continue
if s.find('■ 相关的链接') >= 0: continue
if s.find('相关图表链接') >= 0: continue
id = s.find('- [ ] [ ')
if id >= 0 and id < 10: continue
id = s.find('- [ ] [ ')
if id >= 0 and id < 10: continue
id = s.find('- [x] [ ')
if id >= 0 and id < 10: continue
id = s.find('* [')
if id >= 0 and id < 10:
id = s.find('](#')
if id > 0:
continue
if s.find(">简 介") > 0:
id = s.find('(#999000)')
if id > 0:
s = "><font face=黑体 color=purple size=4>简 介:</font>" + s[id+9:]
if s.find("<span id=") >= 0:
id = s.find('</span>')
if id > 0:
if giteeflag == 0:
s = s[id+7:]
if s.find('# <font color=white') >=0:
fontend = s.find('</font>')
if fontend > 0:
if keepnbspflag == 0:
s = s[fontend+len('</font>'):]
else:
s = '\r\n \r\n' + s[fontend+len('</font>'):]
if deletechapterflag > 0:
if s.find('>§<') > 0:
s = s.replace('>§<', '><')
if s.find("  ") == 0:
if s.find("   ") < 0:
s = '\r\n' + s
if s.find('- [ ] ') >= 0:
s = s.replace('- [ ] ', '- ')
if s.find('- [x] ') >= 0:
s = s.replace('- [x] ', '- ')
if len(changesizedict) > 0:
for l in changesizedict.keys():
if s.find('size=%s'%l):
if changesizedict[l] == '0':
s = s.replace('size=%s'%l, '')
else: s = s.replace('size=%s'%l, 'size=%s'%changesizedict[l])
if len(changetitledict) > 0:
for t in changetitledict.keys():
fromtitle = '#'*int(t)
totitle = '#'*int(changetitledict[t])
if len(s) > len(fromtitle):
if s[0:len(fromtitle)] == fromtitle:
if s[len(fromtitle)] != '#':
s = s.replace(fromtitle, totitle)
break
if deletecode:
if s.find('```python') == 0 or s.find('```c') == 0 or s.find('```mermaid') == 0:
deleteflag = 1
continue
if deleteflag:
if s.find('```') == 0:
deleteflag = 0
continue
else:
if typoraflag == 0:
if s.find('```mermaid') == 0:
deleteflag = 1
continue
if deleteflag:
if s.find('```') == 0:
deleteflag = 0
continue
if len(tablesect) > 0:
tls = s.split('|')
if len(tls) > max(tablesect):
s = '|'.join([tls[i] for i in tablesect])
n1 = s.find('*[')
n2 = s.find(']:')
if n1 >= 0 and n2 >= 0 and n2 > n1:
s = '<font face=楷体>(<u>%s</u>%s)</font>'%(s[n1+2:n2], s[n2+1:])
while True:
if giteeflag > 0: break
n1 = s.find('[**')
if n1 < 0: break
n2 = s[n1:].find(']') + n1
p1 = s[n1:].find('(') + n1
p2 = s[n1:].find(')') + n1
ss1 = s[n1:].find('![')
if n1 >= 0 and n2 >= 0 and p1 >= 0 and p2 >= 0 and n2 > n1 and p2 > p1 and p1 > n2 and ss1 < 0:
notestr = s[n1+1:n2]
linkstr = s[p1+1:p2]
headstr = s[0:n1]
tailstr = s[p2+1:]
flag = 0
for id, l in enumerate(linkdim):
if l == linkstr:
if linknum[id] > 0:
flag = id + 1
else: linknum[id] = 1
break
if linknoteflag > 0:
noteonlystr = notestr.strip('*').strip('*')
linknotestr = linknotestr + '* <font size=%d color=gray><u>%s</u>:<br>%s</font>\r\n'%(linknoteflag, noteonlystr, linkstr)
printf(linknotestr)
if notestr.find('**') < 0:
s = '%s**%s**%s\n'%(headstr, notestr, tailstr)
else:
s = '%s%s%s\n'%(headstr, notestr, tailstr)
if flag != 0:
if notestr.find('**') < 0:
s = '%s**%s<sup>[%d]</sup>**%s'%(headstr, notestr, flag, tailstr)
else:
s = '%s%s<sup>[%d]</sup>%s'%(headstr, notestr, flag, tailstr)
else:
if notestr.find('**') < 0:
s = '%s**%s**[](%s \"%s\")%s\n'%(headstr, notestr, linkstr, notestr, tailstr)
else:
s = '%s%s[](%s \"%s\")%s\n'%(headstr, notestr, linkstr, notestr, tailstr)
if flag != 0:
if notestr.find('**') < 0:
s = '%s**%s<sup>[%d]</sup>**%s'%(headstr, notestr, flag, tailstr)
else:
s = '%s%s<sup>[%d]</sup>%s'%(headstr, notestr, flag, tailstr)
else: break
if s.count('$') >= 2:
s = s.replace('\,', '\space ').replace('\:', '\space ')
n1 = s.find('[^')
n2 = s.find(']:')
if n1 >= 0 and n2 >= 0 and n2 - n1 < 20:
continue
n2 = s.find(']')
if n1 >= 0 and n2 >= 0 and n2 - n1 < 20:
replacestring = ''
for nd in notedim:
if nd.find(s[n1:n2+1]) >= 0:
sbs1 = nd.find(']:')
if sbs1 >= 1:
sstemp = nd[sbs1+2:]
notepos = sstemp.find(' : ')
nextspace = 0
if notepos < 0:
notepos = sstemp.find(': ')
if notepos < 0:
notepos = sstemp.find(' :')
if notepos < 0:
notepos = sstemp.find(':')
if notepos >= 0:
nextspace = 3
else: nextspace = 2
else: nextspace = 2
else: nextspace = 3
if nextspace > 0:
explainstr = sstemp[0:notepos].rstrip(' ')
notestr = sstemp[notepos+nextspace:]
else:
explainstr = '说明'
columnid = sstemp.find(':')
notestr = sstemp
if columnid > 0:
explainstr = sstemp[:columnid]
notestr = sstemp[columnid+1:]
replacestring = '[](%s \"%s\")'%(notestr, explainstr)
break
news = s[0:n1] + replacestring + s[n2 + 1:]
s = news
picwidth = 0
if s.find('#pic_center') >= 0:
equid = s.find('=')
if equid > 0:
equid = s.rindex('=')
widthstr = s[equid+1:]
endxid = widthstr.find('x)')
if endxid > 0:
widthstr = widthstr[:endxid]
picwidth = int(widthstr)
ss = s.split('#')
sss1 = ss[0].find('[')
sss2 = ss[0].find(']')
ss0 = ss[0]
ssall = '\r\n' + ss0 + '#pic_center)' + '\r\n'
s = ssall
if s.find('<sup>') >= 0 and s.find('</sup>') and s.find('``') >= 0:
continue
if s.find('@[toc]') >= 0:
s = '**文章目录**[toc]\r\n\r\n'
if deletecode == 0 and typoraflag == 0 and giteeflag == 0:
ssequal = s.split('==')
if len(ssequal) >= 2:
s = '*'.join(ssequal)
if indentflag != 0:
minlen = 5
if len(s) >= minlen:
if lastlen <= 1000:
lastlen = len(s)
flag = 0
if s.find('|') > 0: flag = flag + 1
if ord(s[0]) < 128:
if ord(s[0]) < ord('0') or ord(s[0]) > ord('9'):
flag = flag + 1
if flag == 0:
s = '  ' + s
else:
lastlen = len(s)
else: lastlen = 0
if bolddeleteflag != 0:
if s.find('**') >= 0:
s = s.replace('**', '')
if s.find('^') > 0:
sc = s.split('^')
if len(sc)%2 == 1:
s = ''
for a,b in zip(sc[0::2], sc[1::2]):
s = s + a + '<sup>' + b + '</sup>'
s = s + sc[-1]
if s.find('~') > 0 and s.find('~~') < 0:
sc = s.split('~')
if len(sc)%2 == 1:
s = ''
for a,b in zip(sc[0::2], sc[1::2]):
s = s + a + '<sub>' + b + '</sub>'
s = s + sc[-1]
if len(s) == 0:
if len(linknotestr) > 0:
s = linknotestr
linknotestr = ''
s = s.replace('![IMAGE](','![](')
if giteeflag > 0:
startid = s.find('![](')
if startid >= 0:
endid = s.find('#pic_center')
if endid > 0:
picurl = s[startid+4:endid]
if picwidth == 0: picwidth = 800
s = '<p align="center"><img src="%s" width="%d" /></p>\n'%(picurl, picwidth)
else:
startid = s.find('![▲ ')
midid = s.find('](')
endid = s.find('#pic_center')
if startid >= 0 and midid > 0 and endid > 0:
headstr = s[:startid]
notestr = s[startid+2:midid]
picurl = s[midid+2:endid]
if picwidth == 0:
s = headstr+'<p align="center"><img src="%s" /><div align="center">%s</div></p><br>'%(picurl, notestr)
else:
s = headstr+'<p align="center"><img src="%s" width="%d" /><div align="center">%s</div></p><br>'%(picurl, picwidth, notestr)
printf(s)
if s[0:10] == '# <center>':
if s.find('</u>') > 0:
ss = '§' + s[2:]
else: ss = s[2:]
s = ' \n<h1 align="center"> %s </h1>\n\n---\n'%ss
pastestr = pastestr + s + '\n'
if len(changecolordict) > 0:
for c in changecolordict.keys():
fromstr = 'color=%s'%c
tostr = 'color=%s'%changecolordict[c]
pastestr = pastestr.replace(fromstr, tostr)
if len(changefacedict) > 0:
for c in changecolordict.keys():
fromstr = 'face=%s'%c
tostr = 'face=%s'%changecolordict[c]
pastestr = pastestr.replace(fromstr, tostr)
if linkpicflag > 0:
pastestr = pastestr.replace(')\r\n\r\n![', ')![')
pastestr = pastestr.replace(')\r\n\n\r\n![', ')![')
pastestr = pastestr.replace(')\r\n\n\n\r\n![', ')![')
if linkpicflag > 1:
pastestr = pastestr.replace(')\r\n\n\n\n\r\n![', ')![')
if linkpicflag > 2:
pastestr = pastestr.replace(')\r\n\n\n\n\n\r\n![', ')![')
if linkpicflag > 3:
pastestr = pastestr.replace(')\r\n\n\n\n\n\n\r\n![', ')![')
if linkpicflag > 4:
pastestr = pastestr.replace(')\r\n\n\n\n\n\n\n\r\n![', ')![')
if linkpicflag > 5:
pastestr = pastestr.replace(')\r\n\n\n\n\n\n\n\n\r\n![', ')![')
if linkpicflag > 6:
pastestr = pastestr.replace(')\r\n\n\n\n\n\n\n\n\n\r\n![', ')![')
if linkpicflag > 7:
pastestr = pastestr.replace(')\r\n\n\n\n\n\n\n\n\n\n\r\n![', ')![')
if linkpicflag > 8:
pastestr = pastestr.replace(')\r\n\n\n\n\n\n\n\n\n\n\n\n\r\n![', ')![')
if mergepicflag > 0:
pastestr = pastestr.replace(')\r\n\r\n![', '),![')
pastestr = pastestr.replace(')\r\n\n\r\n![', '),![')
pastestr = pastestr.replace(')\r\n\n\n\r\n![', '),![')
if mergepicflag > 1:
pastestr = pastestr.replace(')\r\n\n\n\n\r\n![', '),![')
if mergepicflag > 2:
pastestr = pastestr.replace(')\r\n\n\n\n\n\r\n![', '),![')
if mergepicflag > 3:
pastestr = pastestr.replace(')\r\n\n\n\n\n\n\r\n![', '),![')
if mergepicflag > 4:
pastestr = pastestr.replace(')\r\n\n\n\n\n\n\n\r\n![', '),![')
if mergepicflag > 5:
pastestr = pastestr.replace(')\r\n\n\n\n\n\n\n\n\r\n![', '),![')
if mergepicflag > 6:
pastestr = pastestr.replace(')\r\n\n\n\n\n\n\n\n\n\r\n![', '),![')
if mergepicflag > 7:
pastestr = pastestr.replace(')\r\n\n\n\n\n\n\n\n\n\n\r\n![', '),![')
if mergepicflag > 8:
pastestr = pastestr.replace(')\r\n\n\n\n\n\n\n\n\n\n\n\n\r\n![', '),![')
mergestr = pastestr.replace(')\r\n\n\n\n\r\n![', '),![')
if mergestr.find('),![') >= 0:
strsect = mergestr.split('\n')
pastestr = ''
for s in strsect:
s = s.strip('\r')
if s.find('),![') >= 0:
pastestr = pastestr + '<%s>\n'%s
else: pastestr = pastestr + s + '\n'
if mdniceflag > 0:
clipboard.copy(pastestr)
tspsendwindowkey(mdnice_title, "v", control=1)
tspfocuswindow(mdnice_title)
if typoraflag > 0:
tspsendwindowkey(typora_title, "a", control=1)
tspsendwindowkey(typora_title, "\b")
tspsendwindowkey(typora_title, "\b")
pastestr = pastestr.replace("§", "")
clipboard.copy(pastestr)
tspsendwindowkey(typora_title, "v", control=1)
tspfocuswindow(typora_title)
elif giteeflag > 0:
if len(csdnpaper) > 0:
astr = ''
if len(csdnurl) > 0:
astr = "\n\n★ 本文来自于CSDN文献:[**%s**](%s) 。\n<br>\n"%(csdnpaper, csdnurl)
pastestr = '<h1 align="center"> %s </h1>\n<br>\n\n'%csdnpaper + pastestr + astr
else:
if len(csdnurl) > 0:
pastestr = pastestr + "\n\n★ 本文来自于CSDN文献:<%s>\n"%csdnurl
pastestr = pastestr.replace('<font color=slateblue face=宋体>**``关键词``**', '<br><font color=slateblue face=宋体>**``关键词``**')
clipboard.copy(pastestr)
tspsendwindowkey(gitee_title, "v", control=1)
tspfocuswindow(gitee_title)
printf('\a')
■ 相关文献链接:
● 相关图表链接:
|