<commit_before>var App = Ember.Application.create({
})

App.Router.map(function() {
    this.resource('item', {path: '/*idPath'})
})

App.TitleHandler = Ember.Mixin.create({
    title: config.title,
    onTitleChanged: function() {
        var title = this.get('title')
        if (title) {
            title = title + ' - ' + config.title
        } else {
            title = config.title
        }
        document.title = title
    }.observes('title'),
    beforeModel: function() {
        this.set('title')
    },
})

App.IndexRoute = Ember.Route.extend(App.TitleHandler, {
    redirect: function() {
        this.transitionTo('item', '')
    },
})

;(function() {
    var items = Ember.copy(config.items, true)

    var ensureIds = function ensureIds(item, parent) {
        if (item.name) {
            item.id = item.name
                .replace(/(\s|[\/])+/g, '-')
                .replace(/[?]+/g, '')
                .toLowerCase()
            if (parent && parent.idPath) {
                item.idPath = [parent.idPath, item.id].join('/')
            } else {
                item.idPath = item.id
            }
        }
        if (item.items) {
            item.items.forEach(function(child) {
                ensureIds(child, item)
            })
        }
    }
    ensureIds({items: items})

    var itemFactory = function(idPath) {
        // TODO: arbitrary level ID path selection
        idPath = idPath.toLowerCase()
        var item
        var localItems = Ember.copy(items, true)
        if (idPath === '') {
            item = localItems[0]
        } else {
            item = localItems.find(function(item) {
                return item.id == idPath
            })
        }
        if (item) {
            Ember.set(item, 'active', true)
            Ember.set(item, 'navigation', [localItems])<commit_msg>better item name to id slugging<commit_after>var App = Ember.Application.create({
})

App.Router.map(function() {
    this.resource('item', {path: '/*idPath'})
})

App.TitleHandler = Ember.Mixin.create({
    title: config.title,
    onTitleChanged: function() {
        var title = this.get('title')
        if (title) {
            title = title + ' - ' + config.title
        } else {
            title = config.title
        }
        document.title = title
    }.observes('title'),
    beforeModel: function() {
        this.set('title')
    },
})

App.IndexRoute = Ember.Route.extend(App.TitleHandler, {
    redirect: function() {
        this.transitionTo('item', '')
    },
})

;(function() {
    var items = Ember.copy(config.items, true)

    var ensureIds = function ensureIds(item, parent) {
        if (item.name) {
            item.id = item.name
                .replace(/([^a-z0-9])+/ig, '-')
                .replace(/^-|-$/g, '')
                .toLowerCase()
            if (parent && parent.idPath) {
                item.idPath = [parent.idPath, item.id].join('/')
            } else {
                item.idPath = item.id
            }
        }
        if (item.items) {
            item.items.forEach(function(child) {
                ensureIds(child, item)
            })
        }
    }
    ensureIds({items: items})

    var itemFactory = function(idPath) {
        // TODO: arbitrary level ID path selection
        idPath = idPath.toLowerCase()
        var item
        var localItems = Ember.copy(items, true)
        if (idPath === '') {
            item = localItems[0]
        } else {
            item = localItems.find(function(item) {
                return item.id == idPath
            })
        }
        if (item) {
            Ember.set(item, 'active', true)
            Ember.set(item, 'navigation', [localItems])
{'fraction_non_alphanumeric': 0.14897074756229686, 'fraction_numerical': 0.0010834236186348862, 'mean_word_length': 1.6135881104033971, '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': '1226551', 'n_tokens_mistral': 1108, 'n_tokens_neox': 1090, 'n_words': 210}