var _        = require('underscore');
var fs       = require('fs');
var getSlug  = require('speakingurl');
var path     = require('path');

var names = _.chain(fs.readFileSync(path.join(__dirname, 'node_modules/seanherron_Gov-Webicons/README.markdown'), 'utf8').split('\n'))
	.filter(function(line) {
		return line.match(/^\* /);
	})
	.invoke('substring', 2)
	.splice(34, 0, 'United States Social Security Administration')
	.value();

module.exports = _.chain(fs.readdirSync(path.join(__dirname, 'node_modules/seanherron_Gov-Webicons/images')))
	.filter(function(file) {
		return file.match(/\.svg$/);
	})
	.map(function(file, i) {
		file = file.replace(/\.svg$/, '');
		return {
			id:          getSlug(names[i] || file),
			name:        names[i] || file,
			keywords:    ['government', 'america', 'states', 'united', 'usa'],
			contributor: {
				name:      'Sean Herron',
				shortname: 'seanherron'
			},
			source: {
				name:      'Gov-Webicons',
				shortname: getSlug('Gov-Webicons'),
				url:       'https://github.com/seanherron/Gov-Webicons'
			},
			svg: {
				path: {
					directory: path.join(__dirname, 'node_modules/seanherron_Gov-Webicons/images'),
					filename:  file + '.svg'
				}
			}
		};
	})
	.value();

@@ -662,16 +662,60 @@
 /, '');%0A
+%09%09var shortname = file.replace(/gov-/, '');%0A
 %09%09return
@@ -741,31 +741,24 @@
 getSlug(
-names%5Bi%5D %7C%7C fil
+shortnam
 e),%0A%09%09%09n
@@ -782,15 +782,118 @@
 %5Bi%5D 
-%7C%7C file
++ (names%5Bi%5D.toLowerCase().includes(shortname.replace('-', ' ')) ? '' : (' (' + shortname.toUpperCase() + ')'))
 ,%0A%09%09

make the government names better