<commit_before>from features.groups import models as groups
import markdown
from markdown import inlinepatterns

RE_GROUP_REF = r'@(\S+)'


class GroupReferencePattern(inlinepatterns.ReferencePattern):
    def handleMatch(self, m):
        slug = m.group(2)
        try:
            group = groups.Group.objects.get(slug=slug)
        except groups.Group.DoesNotExist:
            return None
        return self.makeTag(group.get_absolute_url(), None, str(group))


class GroupReferenceExtension(markdown.Extension):
    def extendMarkdown(self, md, md_globals):
        md.inlinePatterns['group_reference'] = GroupReferencePattern(RE_GROUP_REF, md)<commit_msg>Fix markdown group references, #203<commit_after>from features.groups import models as groups
import markdown
from markdown import inlinepatterns

RE_GROUP_REF = r'@([a-zA-Z_-]+)'


class GroupReferencePattern(inlinepatterns.ReferencePattern):
    def handleMatch(self, m):
        slug = m.group(2)
        try:
            group = groups.Group.objects.get(slug=slug)
        except groups.Group.DoesNotExist:
            return None
        return self.makeTag(group.get_absolute_url(), None, str(group))


class GroupReferenceExtension(markdown.Extension):
    def extendMarkdown(self, md, md_globals):
        md.inlinePatterns['group_reference'] = GroupReferencePattern(RE_GROUP_REF, md)
{'fraction_non_alphanumeric': 0.09748892171344166, 'fraction_numerical': 0.003692762186115214, 'mean_word_length': 3.9272727272727272, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6493646', 'n_tokens_mistral': 398, 'n_tokens_neox': 392, 'n_words': 85}