<commit_before>package main

import (
	"encoding/json"
	"fmt"
	"html/template"
	"log"
	"net/http"
	"strings"
	"time"

	humanize "github.com/dustin/go-humanize"

	"github.com/Mayo-QIN/grunt/dassets"
	"github.com/gorilla/mux"
	"github.com/imdario/mergo"
	"github.com/russross/blackfriday"
)

// Add some helper functions
var funcs = template.FuncMap{
	"json": func(v interface{}) (string, error) {
		a, err := json.Marshal(v)
		if err != nil {
			return "", err
		}
		return string(a), nil
	},
	"humanizeTime": humanize.Time,
	"now":          time.Now,
	"isArray":      func(s string) bool { return strings.HasPrefix(s, "[") && strings.HasSuffix(s, "]") },
	"toArray": func(s string) []string {
		v := strings.TrimPrefix(s, "[")
		v = strings.TrimSuffix(v, "]")
		return strings.Split(v, ",")
	},
	"markdown": func(s string) template.HTML {
		return template.HTML(string(blackfriday.MarkdownCommon([]byte(s))))
	},
}

var templates = template.New("").Funcs(funcs)
var helpText = template.HTML("")

func init() {
	loadTemplates(AssetNames(), Asset)
}

func loadTemplates(names []string, asset func(name string) ([]byte, error)) {<commit_msg>Make template function `now` do something intelligent<commit_after>package main

import (
	"encoding/json"
	"fmt"
	"html/template"
	"log"
	"net/http"
	"strings"
	"time"

	humanize "github.com/dustin/go-humanize"

	"github.com/Mayo-QIN/grunt/dassets"
	"github.com/gorilla/mux"
	"github.com/imdario/mergo"
	"github.com/russross/blackfriday"
)

// Add some helper functions
var funcs = template.FuncMap{
	"json": func(v interface{}) (string, error) {
		a, err := json.Marshal(v)
		if err != nil {
			return "", err
		}
		return string(a), nil
	},
	"humanizeTime": humanize.Time,
	"now":          func() string { return time.Now().Format(time.RFC1123) },
	"isArray":      func(s string) bool { return strings.HasPrefix(s, "[") && strings.HasSuffix(s, "]") },
	"toArray": func(s string) []string {
		v := strings.TrimPrefix(s, "[")
		v = strings.TrimSuffix(v, "]")
		return strings.Split(v, ",")
	},
	"markdown": func(s string) template.HTML {
		return template.HTML(string(blackfriday.MarkdownCommon([]byte(s))))
	},
}

var templates = template.New("").Funcs(funcs)
var helpText = template.HTML("")

func init() {
	loadTemplates(AssetNames(), Asset)
}

func loadTemplates(names []string, asset func(name string) ([]byte, error)) {
{'fraction_non_alphanumeric': 0.18358714043993232, 'fraction_numerical': 0.001692047377326565, 'mean_word_length': 4.350678733031674, 'pattern_counts': {'":': 12, '<': 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': '2701129', 'n_tokens_mistral': 916, 'n_tokens_neox': 881, 'n_words': 177}