<commit_before># -*- coding:utf-8 -*-

'''
The functions for generating add, edit, view HTML file.
for each item.
'''


def gen_input_add(sig_dic):
    '''
    Adding for HTML Input control.
    :param sig_dic:
    :return:
    '''
    if sig_dic['en'] == 'tag_file_download':
        return '''
    <div class="form-group">
        <label class="col-sm-2 control-label" for="{sig_en}">
        <span><a class="glyphicon glyphicon-star" style="color: red;font-size: xx-small;">
        </a>{sig_zh}</span>
        </label>
        <div class="col-sm-8">
        <input id='{sig_en}' name="{sig_en}" value="" type="{sig_type}"
        class="form-control">
         </div>
         <div class="col-sm-2">
         <a href="/entry/add" target="_blank" class="btn btn-primary" role="button">Upload</a>
        </div></div>
        '''.format(sig_en=sig_dic['en'],
                   sig_zh=sig_dic['zh'],
                   sig_dic=sig_dic['dic'][1],
                   sig_type=sig_dic['type'])
    else:
        return '''
        <div class="form-group">
        <label class="col-sm-2 control-label" for="{sig_en}">
        <span><a class="glyphicon glyphicon-star" style="color: red;font-size: xx-small;">
        </a>{sig_zh}</span>
        </label>
        <div class="col-sm-9">
        <input id='{sig_en}' name="{sig_en}" value="" type="{sig_type}"
        class="form-control">
         </div>
         <div class="col-sm-1">
         {sig_dic}
        </div></div>
        '''.format(sig_en=sig_dic['en'],
                   sig_zh=sig_dic['zh'],
                   sig_dic=sig_dic['dic'][1],
                   sig_type=sig_dic['type'])


def gen_input_edit(sig_dic):
    '''
    Editing for HTML input control.
    :param sig_dic:
    :return:
    '''
    if sig_dic['en'] == 'tag_file_download':
        return '''
    <div class="form-group">
        <label  class="col-sm-2 control-label"  for="{sig_en}">
        <span><a class="glyphicon glyphicon-star" style="color: red;font-size: xx-small;">
        </a>{sig_zh}</span>
        </label>
        <div class="col-sm-8">
        <input id='{sig_en}' name="{sig_en}"
        value="{{{{ post_info.extinfo['{sig_en}'] if '{sig_en}' in post_info.extinfo else '' }}}}"
        type="{sig_type}"  class="form-control"> </div>
         <div class="col-sm-2"><a href="/entry/add" target="_blank" class="btn btn-primary" role="button">Upload</a></div>
         </div>
        '''.format(sig_en=sig_dic['en'],
                   sig_zh=sig_dic['zh'],
                   sig_dic=sig_dic['dic'][1],
                   sig_type=sig_dic['type'])
    else:
        return '''
        <div class="form-group">
        <label  class="col-sm-2 control-label"  for="{sig_en}">
        <span><a class="glyphicon glyphicon-star" style="color: red;font-size: xx-small;">
        </a>{sig_zh}</span>
        </label>
        <div class="col-sm-9">
        <input id='{sig_en}' name="{sig_en}"
        value="{{{{ post_info.extinfo['{sig_en}'] if '{sig_en}' in post_info.extinfo else '' }}}}"
        type="{sig_type}"  class="form-control"> </div>
         <div class="col-sm-1">{sig_dic}</div>
         </div>
        '''.format(sig_en=sig_dic['en'],
                   sig_zh=sig_dic['zh'],
                   sig_dic=sig_dic['dic'][1],
                   sig_type=sig_dic['type'])


def gen_input_view(sig_dic):
    '''
    Viewing the HTML text.
    :param sig_dic:
    :return:
    '''

    if sig_dic['en'] == 'tag_file_download':
        return '''<div class="row">
    <div class="col-sm-4"><span class="des"><strong>{sig_zh}</strong></span></div>
    <div class="col-sm-8">
    <a class="val" onclick=entity_down("{{{{post_info.uid}}}}")
     id="file_download" style="cursor: pointer; color:#069">
     {{{{    post_info.uid }}}}
     {sig_unit}</a></div></div>
    '''.format(sig_zh=sig_dic['zh'], sig_unit=sig_dic['dic'][1])
    elif sig_dic['en'] in ['tag_access_link','tag_dmoz_url','tag_online_link','tag_event_url']:
        return '''<div class="row">
    <div class="col-sm-4"><span class="des"><strong>{1}</strong></span></div>
    <div class="col-sm-8">
    <a class="val" target="_blank" href="{{{{ post_info.extinfo['{0}'] if '{0}' in post_info.extinfo else '' }}}}
     {2}" style="cursor: pointer; color:#069">
     {{{{ post_info.extinfo['{0}'] if '{0}' in post_info.extinfo else '' }}}}
     {2} </a></div></div>
    '''.format(sig_dic['en'], sig_dic['zh'], sig_dic['dic'][1])

    else:
        return '''<div class="row">
    <div class="col-sm-4"><span class="des"><strong>{1}</strong></span></div>
    <div class="col-sm-8">
    <span class="val">{{{{ post_info.extinfo['{0}'] if '{0}' in post_info.extinfo else '' }}}}
     {2}</span></div></div>
    '''.format(sig_dic['en'], sig_dic['zh'], sig_dic['dic'][1])
<commit_msg>xiugai<commit_after># -*- coding:utf-8 -*-

'''
The functions for generating add, edit, view HTML file.
for each item.
'''


def gen_input_add(sig_dic):
    '''
    Adding for HTML Input control.
    :param sig_dic:
    :return:
    '''
    if sig_dic['en'] == 'tag_file_download':
        return '''
    <div class="form-group">
        <label class="col-sm-2 control-label" for="{sig_en}">
        <span><a class="glyphicon glyphicon-star" style="color: red;font-size: xx-small;">
        </a>{sig_zh}</span>
        </label>
        <div class="col-sm-8">
        <input id='{sig_en}' name="{sig_en}" value="" type="{sig_type}"
        class="form-control">
         </div>
         <div class="col-sm-2">
         <a href="/entry/add" target="_blank" class="btn btn-primary" role="button">Upload</a>
        </div></div>
        '''.format(sig_en=sig_dic['en'],
                   sig_zh=sig_dic['zh'],
                   sig_dic=sig_dic['dic'][1],
                   sig_type=sig_dic['type'])
    else:
        return '''
        <div class="form-group">
        <label class="col-sm-2 control-label" for="{sig_en}">
        <span><a class="glyphicon glyphicon-star" style="color: red;font-size: xx-small;">
        </a>{sig_zh}</span>
        </label>
        <div class="col-sm-9">
        <input id='{sig_en}' name="{sig_en}" value="" type="{sig_type}"
        class="form-control">
         </div>
         <div class="col-sm-1">
         {sig_dic}
        </div></div>
        '''.format(sig_en=sig_dic['en'],
                   sig_zh=sig_dic['zh'],
                   sig_dic=sig_dic['dic'][1],
                   sig_type=sig_dic['type'])


def gen_input_edit(sig_dic):
    '''
    Editing for HTML input control.
    :param sig_dic:
    :return:
    '''
    if sig_dic['en'] == 'tag_file_download':
        return '''
    <div class="form-group">
        <label  class="col-sm-2 control-label"  for="{sig_en}">
        <span><a class="glyphicon glyphicon-star" style="color: red;font-size: xx-small;">
        </a>{sig_zh}</span>
        </label>
        <div class="col-sm-8">
        <input id='{sig_en}' name="{sig_en}"
        value="{{{{ post_info.extinfo['{sig_en}'] if '{sig_en}' in post_info.extinfo else '' }}}}"
        type="{sig_type}"  class="form-control"> </div>
         <div class="col-sm-2"><a href="/entry/add" target="_blank" class="btn btn-primary" role="button">Upload</a></div>
         </div>
        '''.format(sig_en=sig_dic['en'],
                   sig_zh=sig_dic['zh'],
                   sig_dic=sig_dic['dic'][1],
                   sig_type=sig_dic['type'])
    else:
        return '''
        <div class="form-group">
        <label  class="col-sm-2 control-label"  for="{sig_en}">
        <span><a class="glyphicon glyphicon-star" style="color: red;font-size: xx-small;">
        </a>{sig_zh}</span>
        </label>
        <div class="col-sm-9">
        <input id='{sig_en}' name="{sig_en}"
        value="{{{{ post_info.extinfo['{sig_en}'] if '{sig_en}' in post_info.extinfo else '' }}}}"
        type="{sig_type}"  class="form-control"> </div>
         <div class="col-sm-1">{sig_dic}</div>
         </div>
        '''.format(sig_en=sig_dic['en'],
                   sig_zh=sig_dic['zh'],
                   sig_dic=sig_dic['dic'][1],
                   sig_type=sig_dic['type'])


def gen_input_view(sig_dic):
    '''
    Viewing the HTML text.
    :param sig_dic:
    :return:
    '''

    if sig_dic['en'] == 'tag_file_download':
        return '''<div class="row">
    <div class="col-sm-4"><span class="des"><strong>{sig_zh}</strong></span></div>
    <div class="col-sm-8">
    <a class="val" onclick=entity_down("{{{{post_info.uid}}}}")
     id="file_download" style="cursor: pointer; color:#069">
     {{{{    post_info.uid }}}}
     {sig_unit}</a></div></div>
    '''.format(sig_zh=sig_dic['zh'], sig_unit=sig_dic['dic'][1])
    elif sig_dic['en'] in ['tag_access_link','tag_dmoz_url','tag_online_link','tag_event_url','tag_expert_home']:
        return '''<div class="row">
    <div class="col-sm-4"><span class="des"><strong>{1}</strong></span></div>
    <div class="col-sm-8">
    <a class="val" target="_blank" href="{{{{ post_info.extinfo['{0}'] if '{0}' in post_info.extinfo else '' }}}}
     {2}" style="cursor: pointer; color:#069">
     {{{{ post_info.extinfo['{0}'] if '{0}' in post_info.extinfo else '' }}}}
     {2} </a></div></div>
    '''.format(sig_dic['en'], sig_dic['zh'], sig_dic['dic'][1])

    else:
        return '''<div class="row">
    <div class="col-sm-4"><span class="des"><strong>{1}</strong></span></div>
    <div class="col-sm-8">
    <span class="val">{{{{ post_info.extinfo['{0}'] if '{0}' in post_info.extinfo else '' }}}}
     {2}</span></div></div>
    '''.format(sig_dic['en'], sig_dic['zh'], sig_dic['dic'][1])

{'fraction_non_alphanumeric': 0.22036015405433537, 'fraction_numerical': 0.008951805974810035, 'mean_word_length': 2.629769550434454, 'pattern_counts': {'":': 0, '<': 187, '<?xml version=': 0, '>': 187, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2964868', 'n_tokens_mistral': 3522, 'n_tokens_neox': 3425, 'n_words': 558}