<commit_before>from django import template
from django.template.defaultfilters import stringfilter
from django.conf import settings

from BeautifulSoup import BeautifulSoup, Comment

register = template.Library()


@register.filter(name="allowtags")
@stringfilter
def allowtags(value, allowed=None):
    """Allows only whitelisted tags and attributes through.

    The setting FORUM_ALLOWED_TAGS can override the behavior. The syntax of
    this setting is a space-separated list of tags, which are optionally
    followed by a colon and a comma-separated list of attribute permitted in
    the tag.
    
    For example, to allow <a> tags which are links or named anchors, but not
    to allow definition of an onclick attribute:

        FORUM_ALLOWED_TAGS = "a:href,name"

    Disallowed tags or attributes are simply removed.
    """

    if allowed is None:
        allowed = getattr(settings, "FORUM_ALLOWED_TAGS",
            "a:href b i ul ol li p br")
<commit_msg>Remove references to the previous home of this project<commit_after>from django import template
from django.template.defaultfilters import stringfilter
from django.conf import settings

from BeautifulSoup import BeautifulSoup, Comment

register = template.Library()


@register.filter(name="allowtags")
@stringfilter
def allowtags(value, allowed=None):
    """Allows only whitelisted tags and attributes through.

    The setting ALLOWED_TAGS can override the behavior. The syntax of
    this setting is a space-separated list of tags, which are optionally
    followed by a colon and a comma-separated list of attribute permitted in
    the tag.
    
    For example, to allow <a> tags which are links or named anchors, but not
    to allow definition of an onclick attribute:

        ALLOWED_TAGS = "a:href,name"

    Disallowed tags or attributes are simply removed.
    """

    if allowed is None:
        allowed = getattr(settings, "ALLOWED_TAGS",
            "a:href b i ul ol li p br")

{'fraction_non_alphanumeric': 0.05891315388522093, 'fraction_numerical': 0.0, 'mean_word_length': 3.657210401891253, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6420662', 'n_tokens_mistral': 532, 'n_tokens_neox': 513, 'n_words': 230}