Beispiel #1
0
def baseconvert(bformat="pdf"):
    files = os.listdir("./")
    for nfile in files:
        if ".tex" in nfile:
            dp = mung(open(nfile).read(), IMAGE_BLOCK, bformat=bformat)
            open("build/" + os.path.splitext(nfile)[0] + ".html",
                 "w").write(dp)
Beispiel #2
0
def fix_file(data, prefix="file", index=""):
    chaps = re.match(".*?\\chapter\{.*?\}\n(.*)", data, re.S)
    chap = chaps.groups()[0]
    sections = re.findall("(\\\\section\{.*?\}.*?)((?=\\\\section)|($))", data,
                          re.S)
    b = 1
    for j in sections:
        filename = prefix + index + "-" + str(b) + ".html"
        f_output = open("site/" + filename, "w")
        f_output.write(
            CHAPHEAD.replace("***NAV***", NAVIGATION) + "<h1>Week " + index +
            "</h1>" + mung(j[0], IMAGE_BLOCK) + get_prev_next(filename) +
            CHAPFOOT)
        f_output.close()
        b += 1
Beispiel #3
0
def fix_simple_file(data, filename):
	f_output = open("site/"+filename+".html", "w")
	f_output.write(CHAPHEAD.replace("***NAV***", NAVIGATION) + mung(data, IMAGE_BLOCK) + get_prev_next(filename + ".html") + CHAPFOOT)
	f_output.close()
Beispiel #4
0
def fix_file(data, prefix="file", index=""):
	chaps = re.match(".*?\\chapter\{.*?\}\n(.*)", data, re.S)
	chap = chaps.groups()[0]
	sections = re.findall("(\\\\section\{.*?\}.*?)((?=\\\\section)|($))", data, re.S)
	b = 1
	for j in sections:
		filename = prefix+index+"-"+str(b)+".html"
		f_output = open("site/"+filename, "w")
		f_output.write(CHAPHEAD.replace("***NAV***", NAVIGATION) + "<h1>Week " + index + "</h1>" + mung(j[0], IMAGE_BLOCK) + get_prev_next(filename) + CHAPFOOT)
		f_output.close()
		b += 1
Beispiel #5
0
def baseconvert(bformat="pdf"):
	files = os.listdir("./")
	for nfile in files:
		if ".tex" in nfile:
			dp = mung(open(nfile).read(), IMAGE_BLOCK, bformat=bformat)
			open("build/" + os.path.splitext(nfile)[0] + ".html", "w").write(dp)
Beispiel #6
0
def fix_simple_file(data, filename):
    f_output = open("site/" + filename + ".html", "w")
    f_output.write(
        CHAPHEAD.replace("***NAV***", NAVIGATION) + mung(data, IMAGE_BLOCK) +
        get_prev_next(filename + ".html") + CHAPFOOT)
    f_output.close()