예제 #1
0
if __name__ == '__main__':
	if len(sys.argv) < 2:
		print 'Create what?'
		sys.exit(-1)
	name = sys.argv[1]
	fname = '%s.wiki' % name
	print 'Creating %s...' % name
	if os.path.exists(fname):
		print 'Already exists.'
		sys.exit(1)
	f = open(fname,'w')
	fullname = raw_input("Full name? ")
	f.write("* Название: '''%s'''\n" % fullname)
	f.write("* Перевод: '''%s'''\n" % raw_input("Translation? "))
	status = implode(fullname)
	s = raw_input("Status[%s]? " % status)
	if s:
		status = s
	f.write('* Статус: %s\n' % explode(status))
	f.write('\n== Тематика ==\n* …\n\n== Ссылки ==\n')
	dblp = name.lower()
	while dblp != '' and not exists('http://dblp.uni-trier.de/db/conf/%s/index.html' % dblp):
		dblp = raw_input("DBLP[%s]? " % dblp)
	f.write('* [http://dblp.uni-trier.de/db/conf/%s/ %s] на [[DBLP]]\n' % (dblp, name))
	acad = raw_input("Academic? ")
	if acad:
		f.write('* [http://academic.research.microsoft.com/Conference/%s/ %s] на [[Academic]]\n' % (acad, name))
	f.close()
	print 'Yes.'
예제 #2
0
파일: lists.py 프로젝트: grammarware/ruconf
	sts = {'ws':[],'wc':[],'ss':[],'sy':[],'ic':[],'mc':[],'se':[],'co':[]}
	names = {}
	refd = []
	refby = {}
	byyear = {}
	for f in glob.glob('*.wiki'):
		found.append(f.replace('.wiki',''))
	for n in found:
		if n in ('All','Years','TODO') or n in listnames.values() or n.isdigit():
			continue
		# print 'Processing',n
		f = open('%s.wiki' % n,'r')
		content = f.read()
		if n != 'Home':
			for st in content.split('* Статус: [[')[1].split('\n')[0].split('[['):
				sts[implode(st.split('|')[0])].append(n)
			names[n] = content.split("* Перевод: '''")[1].split("'''")[0]
		for link in content.split('[[')[1:]:
			link = link.split(']]')[0].split('|')[0]
			if link.replace(' ','-') not in refd:
				refd.append(link.replace(' ','-'))
			# print n,'to',link.replace(' ','-')
			if link.replace(' ','-') not in refby.keys():
				refby[link.replace(' ','-')] = []
			if n not in refby[link.replace(' ','-')]:
				refby[link.replace(' ','-')].append(n)
		if n != 'Home':
			for link in content.split('== Архив ==')[1].split('== Ссылки ==')[0].split('\n'):
				# print 'Link is "%s"' %link
				if link.startswith('* '):
					# print link