<commit_before>var fs = require('fs'),
	markdown = require('markdown').markdown;

var Utils = require('./utils');

var repo = 'git://git.curseforge.net/wow/%s/mainline.git';

module.exports.fetchChangelog = function(details, callback){
	Utils.Clone(repo.replace('%s', details.curse), details.curse, function(err, path){
		if(err)
			callback(err);
		else {
			var filePath = path + '/' + details.changelogPath;
			if(!fs.existsSync(filePath))
				callback(new Error(Utils.Strings.CHANGELOG_MISSING.replace('%s', details.changelogPath)))
			else {
				fs.readFile(filePath, {encoding: details.encoding || 'utf8'}, function(err, data){
					if(err)
						callback(err);
					else
						callback(null, data);
				});
			}
		}
	});
}

module.exports.formatChangelog = function(data){
	return Utils.HTMLToBBCode(markdown.toHTML(data));
}

module.exports.getInterfaceVersion = function(details, callback){
	Utils.Clone(repo.replace('%s', details.curse), details.curse, function(err, path){
		if(err)
			callback(err);
		else {
			var filePath = path + '/' + details.path + '.toc';
			if(!fs.existsSync(filePath))
				callback(new Error(Utils.Strings.TOC_MISSING))
			else {
				fs.readFile(filePath, {encoding: details.encoding || 'utf8'}, function(err, data){
					if(err)
						callback(err);
					else {
						var interfaceVersion = data.match(/Interface: ?(.+)/);
						if(!interfaceVersion)
							callback(new Error(Utils.Strings.INTERFACE_VERSION_MISSING));
						else
							callback(interfaceVersion[1]);
					}
				});
			}
		}
	});
}
<commit_msg>Return the interface version properly<commit_after>var fs = require('fs'),
	markdown = require('markdown').markdown;

var Utils = require('./utils');

var repo = 'git://git.curseforge.net/wow/%s/mainline.git';

module.exports.fetchChangelog = function(details, callback){
	Utils.Clone(repo.replace('%s', details.curse), details.curse, function(err, path){
		if(err)
			callback(err);
		else {
			var filePath = path + '/' + details.changelogPath;
			if(!fs.existsSync(filePath))
				callback(new Error(Utils.Strings.CHANGELOG_MISSING.replace('%s', details.changelogPath)))
			else {
				fs.readFile(filePath, {encoding: details.encoding || 'utf8'}, function(err, data){
					if(err)
						callback(err);
					else
						callback(null, data);
				});
			}
		}
	});
}

module.exports.formatChangelog = function(data){
	return Utils.HTMLToBBCode(markdown.toHTML(data));
}

module.exports.getInterfaceVersion = function(details, callback){
	Utils.Clone(repo.replace('%s', details.curse), details.curse, function(err, path){
		if(err)
			callback(err);
		else {
			var filePath = path + '/' + details.path + '.toc';
			if(!fs.existsSync(filePath))
				callback(new Error(Utils.Strings.TOC_MISSING))
			else {
				fs.readFile(filePath, {encoding: details.encoding || 'utf8'}, function(err, data){
					if(err)
						callback(err);
					else {
						var interfaceVersion = data.match(/Interface: ?(.+)/);
						if(!interfaceVersion)
							callback(new Error(Utils.Strings.INTERFACE_VERSION_MISSING));
						else
							callback(null, interfaceVersion[1]);
					}
				});
			}
		}
	});
}

{'fraction_non_alphanumeric': 0.16634738186462325, 'fraction_numerical': 0.0019157088122605363, 'mean_word_length': 3.82, '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': '3881209', 'n_tokens_mistral': 1265, 'n_tokens_neox': 1040, 'n_words': 171}