# Path: likert_field/templatetags/likert_star_tools.py
# def render_stars(num, max_stars, star_set):
#     """
#     Star renderer returns a HTML string of stars
# 
#     If num is None or a blank string, it returns the unanswered tag
# 
#     Otherwise, the returned string will contain num solid stars
#     followed by max_stars - num empty stars
# 
#     If num > max_stars, render max_stars solid stars
# 
#     star_set is a dictionary of strings with keys: star, unlit, noanswer
#     """
#     if num is None or (isinstance(num, string_types) and len(num) == 0):
#         return star_set['noanswer']
# 
#     difference = int(max_stars) - int(num)
#     if difference < 0:
#         num = max_stars
#         difference = 0
# 
#     return ''.join(
#         star_set['star'] * int(num) + star_set['unlit'] * difference)


from django import template
from .likert_star_tools import render_stars
from django.utils.safestring import mark_safe
    'noanswer': "<i class='icon-ban-circle likert-star'></i>"
}

# Font-awesome stars ver 4
star_set_4 = {
    'star': "<i class='fa fa-star likert-star'></i>",
    'unlit': "<i class='fa fa-star-o likert-star'></i>",
    'noanswer': "<i class='fa fa-ban likert-star'></i>"
}


def fa_stars3(num, max_stars=5):
    """
    Stars for Font Awesome 3

    If num is not None, the returned string will contain num solid stars
    followed by max_stars - num empty stars
    """
    return mark_safe(render_stars(num, max_stars, star_set_3))

register.filter('fa_stars3', fa_stars3)


def fa_stars4(num, max_stars=5):
    """
    Stars for Font Awesome 4

    If num is not None, the returned string will contain num solid stars
    followed by max_stars - num empty stars
    """

# Path: likert_field/templatetags/likert_star_tools.py
# def render_stars(num, max_stars, star_set):
#     """
#     Star renderer returns a HTML string of stars
# 
#     If num is None or a blank string, it returns the unanswered tag
# 
#     Otherwise, the returned string will contain num solid stars
#     followed by max_stars - num empty stars
# 
#     If num > max_stars, render max_stars solid stars
# 
#     star_set is a dictionary of strings with keys: star, unlit, noanswer
#     """
#     if num is None or (isinstance(num, string_types) and len(num) == 0):
#         return star_set['noanswer']
# 
#     difference = int(max_stars) - int(num)
#     if difference < 0:
#         num = max_stars
#         difference = 0
# 
#     return ''.join(
#         star_set['star'] * int(num) + star_set['unlit'] * difference)


# Path: likert_field/templatetags/likert_fa_stars.py
from django import template
from .likert_star_tools import render_stars
from django.utils.safestring import mark_safe

    'noanswer': "<i class='icon-ban-circle likert-star'></i>"
}

# Font-awesome stars ver 4
star_set_4 = {
    'star': "<i class='fa fa-star likert-star'></i>",
    'unlit': "<i class='fa fa-star-o likert-star'></i>",
    'noanswer': "<i class='fa fa-ban likert-star'></i>"
}


def fa_stars3(num, max_stars=5):
    """
    Stars for Font Awesome 3

    If num is not None, the returned string will contain num solid stars
    followed by max_stars - num empty stars
    """
    return mark_safe(render_stars(num, max_stars, star_set_3))

register.filter('fa_stars3', fa_stars3)


def fa_stars4(num, max_stars=5):
    """
    Stars for Font Awesome 4

    If num is not None, the returned string will contain num solid stars
    followed by max_stars - num empty stars
    """

    return mark_safe(render_stars(num, max_stars, star_set_4))