dystic/marker.py
def extract_meta(self, text):
        """
        Takes input as the entire file.
        Reads the first yaml document as metadata.
        and the rest of the document as text
        """
        first_line = True
        metadata = []
        content = []
        metadata_parsed = False

        for line in text.split('\n'):
            if first_line:
                first_line = False
                if line.strip() != '---':
                    raise MetaParseException('Invalid metadata')
                else:
                    continue
            if line.strip() == '' and not metadata_parsed:
                continue
            if line.strip() == '---' and not metadata_parsed:
                # reached the last line
                metadata_parsed = True
            elif not metadata_parsed:
                metadata.append(line)
            else:
                content.append(line)

        content = '\n'.join(content)
        try:
            metadata = yaml.load('\n'.join(metadata))
        except:
            raise
            content = text
            metadata = yaml.load('')

        return content, metadata

        Takes input as the entire file.
        Reads the first yaml document as metadata.
        and the rest of the document as text
        
Takes input as the entire file.
Reads the first yaml document as metadata.
and the rest of the document as text
Takes input as the entire file . Reads the first yaml document as metadata . and the rest of the document as text
def extract_meta(self, text):
        first_line = True
        metadata = []
        content = []
        metadata_parsed = False
        for line in text.split('\n'):
            if first_line:
                first_line = False
                if line.strip() != '---':
                    raise MetaParseException('Invalid metadata')
                else:
                    continue
            if line.strip() == '' and not metadata_parsed:
                continue
            if line.strip() == '---' and not metadata_parsed:
                metadata_parsed = True
            elif not metadata_parsed:
                metadata.append(line)
            else:
                content.append(line)
        content = '\n'.join(content)
        try:
            metadata = yaml.load('\n'.join(metadata))
        except:
            raise
            content = text
            metadata = yaml.load('')
        return content, metadata
def extract_meta ( self , text ) : first_line = True metadata = [ ] content = [ ] metadata_parsed = False for line in text . split ( '\n' ) : if first_line : first_line = False if line . strip ( ) != '---' : raise MetaParseException ( 'Invalid metadata' ) else : continue if line . strip ( ) == '' and not metadata_parsed : continue if line . strip ( ) == '---' and not metadata_parsed : metadata_parsed = True elif not metadata_parsed : metadata . append ( line ) else : content . append ( line ) content = '\n' . join ( content ) try : metadata = yaml . load ( '\n' . join ( metadata ) ) except : raise content = text metadata = yaml . load ( '' ) return content , metadata
Takes input as the entire file.
Takes input as the entire file .
"""
        Takes input as the entire file.
        Reads the first yaml document as metadata.
        and the rest of the document as text
        """ # reached the last line
self
text