Exemple #1
0
	def __read_yaml(self):
		with open(self.yaml) as f:
			contents = f.read()
		
		pattern = re.compile('^\#include[\s]+([\S]+)[\s]*$', re.MULTILINE)
		contents = pattern.sub(self.__yaml_include, contents)
		
		doc = Document(self, yaml.load(contents))
		doc.save()
Exemple #2
0
def main(file):
    doc = Document(file)
    input = open(file).read()
    border = re.compile('^-{20,}$', re.MULTILINE)
    if re.search(border, input):
        intro, text = re.split(border, input, 1)
    else:
        intro, text = "", input
    doc.init(intro)
    try:
        doc.render(text)
    except PressError as e:
        e.report()
    doc.save()