def scripts2xml(filenames): output = XMLOutput("scripts") for filename in filenames: script = Script(filename) output.addLiteral("script", script.text, id=script.id, title=script.title, language=script.language) return output.result()
def outline2xml(file): output = XMLOutput("todo") for line in file.readlines(): line = quote(line) if line[:3] == "-*-": continue if line and line[0] == "*": depth = 0 while line[depth] == "*": depth = depth + 1 output.closeToDepth(depth) # for difference in range(output._stack.depth(), depth): # output.openSection("", depth=difference) output.openSection(line[depth:].strip(), depth = depth) else: output.addLine(line) return output.result()
def outline2xml(file): output = XMLOutput("todo") for line in file.readlines(): line = quote(line) if line[:3] == "-*-": continue if line and line[0] == "*": depth = 0 while line[depth] == "*": depth = depth + 1 output.closeToDepth(depth) # for difference in range(output._stack.depth(), depth): # output.openSection("", depth=difference) output.openSection(line[depth:].strip(), depth=depth) else: output.addLine(line) return output.result()