app/assets.py
def parse_markdown_post(md_path: str, meta=False) -> Union[Post, None]:
    '''
    :param md_path -> path to markdown file
    :param meta -> set True if you want to retrive only meta data for index page
    :return Object of class Post or None if error occured during parsing
    '''
    try:
        with open(md_path, 'r') as f:
            markdown = f.read()
    except FileNotFoundError:
        return None
    '''
    following regex extracts the metadata fields and the blog content into seperate variables
    '''
    blog_pattern = re.compile(r'title: (?P<title>[^\n]*)\sdate: (?P<date>\d{4}-\d{2}-\d{2})\ssummary: (?P<summary>[^\n]*)')
    match_obj = re.match(blog_pattern, markdown)
    if match_obj is None:
        '''
        if the pattern not found, then return nothing
        '''
        return None
    title = match_obj.group('title')
    date = match_obj.group('date')
    summary = match_obj.group('summary')
    '''
    link for clog is created by replacing whitespaces in the title of blog
    '''
    href = title.lower().replace(' ', '-')
    if meta == False:
        md_content = re.split(blog_pattern, markdown)[-1]
        return Post(title, date, summary, href, md_content=md_content)
    else:
        return Post(title, date, summary, href)

    :param md_path -> path to markdown file
    :param meta -> set True if you want to retrive only meta data for index page
    :return Object of class Post or None if error occured during parsing
    
:param md_path -> path to markdown file
:param meta -> set True if you want to retrive only meta data for index page
:return Object of class Post or None if error occured during parsing
: param md_path - > path to markdown file : param meta - > set True if you want to retrive only meta data for index page : return Object of class Post or None if error occured during parsing
def parse_markdown_post(md_path: str, meta=False) -> Union[Post, None]:
    try:
        with open(md_path, 'r') as f:
            markdown = f.read()
    except FileNotFoundError:
        return None
    blog_pattern = re.compile(r'title: (?P<title>[^\n]*)\sdate: (?P<date>\d{4}-\d{2}-\d{2})\ssummary: (?P<summary>[^\n]*)')
    match_obj = re.match(blog_pattern, markdown)
    if match_obj is None:
        return None
    title = match_obj.group('title')
    date = match_obj.group('date')
    summary = match_obj.group('summary')
    href = title.lower().replace(' ', '-')
    if meta == False:
        md_content = re.split(blog_pattern, markdown)[-1]
        return Post(title, date, summary, href, md_content=md_content)
    else:
        return Post(title, date, summary, href)
def parse_markdown_post ( md_path : str , meta = False ) -> Union [ Post , None ] : try : with open ( md_path , 'r' ) as f : markdown = f . read ( ) except FileNotFoundError : return None '''
    following regex extracts the metadata fields and the blog content into seperate variables
    ''' blog_pattern = re . compile ( r'title: (?P<title>[^\n]*)\sdate: (?P<date>\d{4}-\d{2}-\d{2})\ssummary: (?P<summary>[^\n]*)' ) match_obj = re . match ( blog_pattern , markdown ) if match_obj is None : '''
        if the pattern not found, then return nothing
        ''' return None title = match_obj . group ( 'title' ) date = match_obj . group ( 'date' ) summary = match_obj . group ( 'summary' ) '''
    link for clog is created by replacing whitespaces in the title of blog
    ''' href = title . lower ( ) . replace ( ' ' , '-' ) if meta == False : md_content = re . split ( blog_pattern , markdown ) [ - 1 ] return Post ( title , date , summary , href , md_content = md_content ) else : return Post ( title , date , summary , href )
:param md_path -> path to markdown file
:param meta -> set True if you want to retrive only meta data for index page
:return Object of class Post or None if error occured during parsing
: param md_path - > path to markdown file : param meta - > set True if you want to retrive only meta data for index page : return Object of class Post or None if error occured during parsing
'''
    :param md_path -> path to markdown file
    :param meta -> set True if you want to retrive only meta data for index page
    :return Object of class Post or None if error occured during parsing
    ''' '''
    following regex extracts the metadata fields and the blog content into seperate variables
    ''' '''
        if the pattern not found, then return nothing
        ''' '''
    link for clog is created by replacing whitespaces in the title of blog
    '''
md_path
str
meta