'Loop through lines and find, set, and remove footnote definitions.
Keywords:
* lines: A list of lines of text
Return: A list of lines of text with footnote definitions removed.'

def run(self, lines):

    newlines = []
    i = 0
    while True:
        m = DEF_RE.match(lines[i])
        if m:
            (fn, _i) = self.detectTabbed(lines[(i + 1):])
            fn.insert(0, m.group(2))
            i += (_i - 1)
            self.footnotes.setFootnote(m.group(1), u'\n'.join(fn))
        else:
            newlines.append(lines[i])
        if (len(lines) > (i + 1)):
            i += 1
        else:
            break
    return newlines
