Exemplo n.º 1
0
def do(filepath, filter_regex):
	if os.path.exists(outdir):
		shutil.rmtree(outdir)
	rdir, dirs, _ = os.walk(tpldir).next()
	dirs = [('%s/%s' % (rdir, d), "%s/%s" % (outdir, d)) for d in dirs]
	for src, dst in dirs:
		shutil.copytree(src, dst)
	datas = gojspp.do(filepath, filter_regex)
	make(datas)
Exemplo n.º 2
0
def do(struct_keys, struct_datas, domain):
	datas = gojspp.do(filepath, filterstring)
	keys, result = makehtml.make_tree(datas)
	content = openfile(gistpath)
	content = unicode(content, "utf-8")
	news = []
	ks = [(i.replace(".", "/"), i) for i in re_symbol.findall(content)]
	for k, kn in ks:
		try:
			c = (i for i in keys if i.endswith(k)).next()
			if (kn, c) in news:
				continue
			news.append((kn, c))
		except StopIteration:
			pass
	for i in news:
		o = u"`%s`" % i[0]
		n = u"[`%s`](%s/%s.html)" % (i[0], domain, i[1])
		content = content.replace(o, n)