(self, lines)
return lines
Parse Meta-Data and store in Markdown.Meta.
Parse Meta-Data and store in Markdown.Meta.
Parse Meta - Data and store in Markdown . Meta .
def run(self, lines):
        """ Parse Meta-Data and store in Markdown.Meta. """
        meta = {}
        key = None
        while 1:
            line = lines.pop(0)
            if line.strip() == '':
                break # blank line - done
            m1 = META_RE.match(line)
            if m1:
                key = m1.group('key').lower().strip()
                value = m1.group('value').strip()
                try:
                    meta[key].append(value)
                except KeyError:
                    meta[key] = [value]
            else:
                m2 = META_MORE_RE.match(line)
                if m2 and key:
                    # Add another line to existing key
                    meta[key].append(m2.group('value').strip())
                else:
                    lines.insert(0, line)
                    break # no meta data - done
        self.markdown.Meta = meta
        return lines
def run ( self , lines ) : meta = { } key = None while 1 : line = lines . pop ( 0 ) if line . strip ( ) == '' : break # blank line - done m1 = META_RE . match ( line ) if m1 : key = m1 . group ( 'key' ) . lower ( ) . strip ( ) value = m1 . group ( 'value' ) . strip ( ) try : meta [ key ] . append ( value ) except KeyError : meta [ key ] = [ value ] else : m2 = META_MORE_RE . match ( line ) if m2 and key : # Add another line to existing key meta [ key ] . append ( m2 . group ( 'value' ) . strip ( ) ) else : lines . insert ( 0 , line ) break # no meta data - done self . markdown . Meta = meta return lines