def build_markdown_header(title, date, author, categories, tags, slug, status=None, attachments=None):
 header = (u'Title: %s\n' % title)
 if date:
  header += (u'Date: %s\n' % date)
 if author:
  header += (u'Author: %s\n' % author)
 if categories:
  header += (u'Category: %s\n' % u', '.join(categories))
 if tags:
  header += (u'Tags: %s\n' % u', '.join(tags))
 if slug:
  header += (u'Slug: %s\n' % slug)
 if status:
  header += (u'Status: %s\n' % status)
 if attachments:
  header += (u'Attachments: %s\n' % u', '.join(attachments))
 header += u'\n'
 return header

def build_markdown_header ( title , date , author , categories , tags , slug , status = None , attachments = None ) : header = ( u'Title: %s\n' % title ) if date : header += ( u'Date: %s\n' % date ) if author : header += ( u'Author: %s\n' % author ) if categories : header += ( u'Category: %s\n' % u', ' . join ( categories ) ) if tags : header += ( u'Tags: %s\n' % u', ' . join ( tags ) ) if slug : header += ( u'Slug: %s\n' % slug ) if status : header += ( u'Status: %s\n' % status ) if attachments : header += ( u'Attachments: %s\n' % u', ' . join ( attachments ) ) header += u'\n' return header
build a header from a list of fields .