Example #1
0
    def __init__(self, filename):
        self.id = filename.split("/")[-1]

        suffix = filename.split(".")[-1]

        if suffix == "clj":
            self.language = "clojure"
        else:
            self.language = "jython"

        f = open(filename, "rt")
        self.title = ""

        self.text = quote(f.read(), replaceNewLines=0, hyperlinks=0)

        f.close()

        while 1:
            line, self.text = self.text.split("\n", 1)

            if line.strip().startswith("#"):
                line = line.split("#")[-1].strip()
            elif line.strip().startswith(";"):
                line = line.split(";")[-1].strip()
                
            if not line: break
            if self.title: self.title += " "
            self.title += line
Example #2
0
    def __init__(self, filename):
        self.id = filename.split("/")[-1].split(".")[0]

        f = open(filename, "rt")
        self.title = ""

        self.text = quote(f.read(), replaceNewLines=0)

        f.close()

        while 1:
            line, self.text = self.text.split("\n", 1)
            line = line.split("#")[-1].strip()
            if not line: break
            if self.title: self.title += " "
            self.title += line
Example #3
0
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()
Example #4
0
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()