def generate_dirlist_html(FS, filepath):
yield '<STR_LIT>'<EOL>if filepath == '<STR_LIT:/>':<EOL><INDENT>filepath = '<STR_LIT>'<EOL><DEDENT>for name in FS.listdir(filepath):<EOL><INDENT>full_path = pathjoin(filepath, name)<EOL>if FS.isdir(full_path):<EOL><INDENT>full_path = full_path + '<STR_LIT:/>'<EOL><DEDENT>yield u'<STR_LIT>'.format(<EOL>cgi.escape(full_path))  <EOL><DEDENT>yield '<STR_LIT>'<EOL>
Generate directory listing HTML

Arguments:
    FS (FS): filesystem object to read files from
    filepath (str): path to generate directory listings for

Keyword Arguments:
    list_dir (callable: list[str]): list file names in a directory
    isdir (callable: bool): os.path.isdir

Yields:
    str: lines of an HTML table