<commit_before>package markdown.blog

import com.sourcerefinery.markdownblog.MarkdownBlogPost

class MarkdownBlogTagLib {
    static namespace = "blog"
    static defaultEncodeAs = 'html'
    //static encodeAsForTags = [tagName: 'raw']

    def grailsApplication

    def link = { attrs, body ->
        attrs.uri = createLink(attrs, body)

        out << g.link(attrs, body)
    }

    def createLink = { attrs, body ->
        def post = attrs.post as MarkdownBlogPost

        if (!post) {
            // nothing
        } else if (post.type == "post") {
            attrs.controller = "markdownBlog"

            if (grailsApplication.config.grails.plugin?.markdownblog?.postUrlShowYYYYMM && post.permalink) {
                def yyyy = g.formatDate(date: post.date, format: 'yyyy')
                def mm = g.formatDate(date: post.date, format: 'MM')

                attrs.action = "post"<commit_msg>Changed taglib to output raw, so the output doesn't get double-encoded in Grails 2.3.<commit_after>package markdown.blog

import com.sourcerefinery.markdownblog.MarkdownBlogPost

class MarkdownBlogTagLib {
    static namespace = "blog"
    static defaultEncodeAs = 'raw'
    //static encodeAsForTags = [tagName: 'raw']

    def grailsApplication

    def link = { attrs, body ->
        attrs.url = createLink(attrs, body)

        out << g.link(attrs, body)
    }

    def createLink = { attrs, body ->
        def post = attrs.post as MarkdownBlogPost

        if (!post) {
            // nothing
        } else if (post.type == "post") {
            attrs.controller = "markdownBlog"

            if (grailsApplication.config.grails.plugin?.markdownblog?.postUrlShowYYYYMM && post.permalink) {
                def yyyy = g.formatDate(date: post.date, format: 'yyyy')
                def mm = g.formatDate(date: post.date, format: 'MM')

                attrs.action = "post"
{'fraction_non_alphanumeric': 0.11099309612320765, 'fraction_numerical': 0.0010621348911311736, 'mean_word_length': 2.3345132743362833, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '1368876', 'n_tokens_mistral': 586, 'n_tokens_neox': 547, 'n_words': 138}