From 7db19364d3dd284b2a57f049500f76ec35fcf7e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Sko=C5=99epa?= <jakub@skorepa.info> Date: Thu, 10 Mar 2016 01:42:01 +0100 Subject: [PATCH] Make jslint happy --- .jshintrc | 34 ++++++++++++++++++++++++++++++++++ index.js | 34 +++++++++++++++++----------------- sitegin/config.js | 6 +++--- sitegin/gitInfo.js | 20 ++++++++++---------- sitegin/jobs.js | 16 ++++++++++------ sitegin/markdown.js | 22 +++++++++++----------- sitegin/nunjucks.js | 3 ++- sitegin/parseHugo.js | 12 ++++++------ sitegin/tags.js | 32 +++++++++++++++++--------------- sitegin/toURL.js | 13 +++++++------ sitegin/writeFiles.js | 2 +- 11 files changed, 118 insertions(+), 76 deletions(-) create mode 100644 .jshintrc diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 00000000..f85dbcc8 --- /dev/null +++ b/.jshintrc @@ -0,0 +1,34 @@ +{ + // JSHint Default Configuration File (as on JSHint website) + // See http://jshint.com/docs/ for more details + + "maxerr" : 50, // {int} Maximum error before stopping + + // Enforcing + "camelcase" : true, // true: Identifiers must be in camelCase + "curly" : false, // true: Require {} for every new block or scope + "nonew" : true, // true: Prohibit use of constructors for side-effects (without assignment) + "quotmark" : "single", // Quotation mark consistency + "strict" : false, // true: Requires all functions run in ES5 Strict Mode + + "maxparams" : 5, // {int} Max number of formal params allowed per function + "maxdepth" : 5, // {int} Max depth of nested blocks (within functions) + "maxstatements" : 40, // {int} Max number statements per function + "maxcomplexity" : 10, // {int} Max cyclomatic complexity per function + "maxlen" : 120, // {int} Max number of characters per line + + // Relaxing + "asi" : true, // true: Tolerate Automatic Semicolon Insertion (no semicolons) + "esversion" : 6, // {int} Specify the ECMAScript version to which the code must adhere. + "funcscope" : true, // true: Tolerate defining variables inside control statements + + // Environments + "browser" : false, // Web Browser (window, document, etc) + "devel" : true, // Development/debugging (alert, confirm, etc) + "jquery" : false, // jQuery + "mocha" : true, // Mocha + "node" : true, // Node.js + + // Custom Globals + "globals" : {} // additional predefined global variables +} diff --git a/index.js b/index.js index 243f6585..bd93f397 100755 --- a/index.js +++ b/index.js @@ -34,23 +34,23 @@ var sitegin = function(config) { var startTime = moment(); runAgain = false; if(isRunning) { - console.log("Generator is still running. Queing another run after it finishes.") + console.log('Generator is still running. Queing another run after it finishes.') runAgain = true; return; } - console.log("================================================================================") - console.log("Running generator") + console.log('================================================================================') + console.log('Running generator') isRunning = true; jobs.run('pipeline',jobs) .then(function() { isRunning = false; - console.log("Generator finished in",moment().diff(startTime,'seconds'),'seconds') + console.log('Generator finished in',moment().diff(startTime,'seconds'),'seconds') doSync(); if(runAgain) run(); }) .catch(function(e) { isRunning = false; - console.log("Generator crashed in",moment().diff(startTime,'seconds'),'seconds') + console.log('Generator crashed in',moment().diff(startTime,'seconds'),'seconds') if(runAgain) run(); if(e.stack) console.log(e.stack) @@ -89,7 +89,7 @@ var sitegin = function(config) { // sitegin reload jobs.onReload(function() { - console.log("Sitegin reloaded"); + console.log('Sitegin reloaded'); run(); }) } @@ -106,19 +106,19 @@ var copyStaticFiles = function(builddir) { fsextra.copy( 'static', builddir, - function(file){ return !(file.match(".git") || file.match("static/articles")); }, - function(){console.log("copy static done");} + function(file){ return !(file.match('.git') || file.match('static/articles')); }, + function(){console.log('copy static done');} ); fsextra.copy( 'static/articles', - builddir+"/clanek", - function(){console.log("copy static/articles done");} + builddir+'/clanek', + function(){console.log('copy static/articles done');} ); fsextra.copy( 'theme/static', builddir, - function(file){ return !file.match("\\.git") }, - function(){console.log("copy theme/static done");} + function(file){ return !file.match('\\.git') }, + function(){console.log('copy theme/static done');} ); } @@ -127,10 +127,10 @@ var rendersass = function(builddir) { var sass = require('node-sass'); var fs = require('fs'); - sass.render ({file: "theme/sass/style.scss"},function(err, result) { - if(err == null) { - console.log("compiled sass"); - fs.writeFile(builddir+"/theme/style.css",result.css); - } else console.log("error ", err); + sass.render ({file: 'theme/sass/style.scss'},function(err, result) { + if(err === null) { + console.log('compiled sass'); + fs.writeFile(builddir+'/theme/style.css',result.css); + } else console.log('error ', err); }); }; diff --git a/sitegin/config.js b/sitegin/config.js index 02378ba8..ebc1e18a 100644 --- a/sitegin/config.js +++ b/sitegin/config.js @@ -13,9 +13,9 @@ var options = cli.parse({ }); module.exports = function() { - var builddir = "build"; - if(!options.noserver) builddir = "build-debug"; - + var builddir = 'build'; + if(!options.noserver) builddir = 'build-debug'; + if(options.uiport == 'port+1') { options.uiport = options.port+1; } diff --git a/sitegin/gitInfo.js b/sitegin/gitInfo.js index 076fce51..d9281532 100644 --- a/sitegin/gitInfo.js +++ b/sitegin/gitInfo.js @@ -8,22 +8,22 @@ var git = require('nodegit-kit'); var path = require('path'); var moment = require('moment'); -var pathToRepo = path.resolve("content"); +var pathToRepo = path.resolve('content'); // Returns promise for patch of single commit -var gitShow = function(repo, commit_data) { +var gitShow = function(repo, commitData) { var commit, tree, parentTree; - return nodegit.Revparse.single(repo, commit_data.commit) + return nodegit.Revparse.single(repo, commitData.commit) .then((obj) => { return nodegit.Commit.lookup(repo, obj.id()); }) .then((_commit) => { commit = _commit; if(commit.parentcount() < 1) return null; - return parent = commit.getParents(1); + return commit.getParents(1); }) .then((parents) => { - if(parents == null) return null; + if(parents === null) return null; return parents[0].getTree(); }) .then((_parentTree) => { @@ -40,7 +40,7 @@ var gitShow = function(repo, commit_data) { .then((patches) => { return [ patches, - commit_data + commitData ]; }); } @@ -90,10 +90,10 @@ module.exports = function(obj) { var newestCommit = commits[0]; var oldestCommit = commits[commits.length-1]; - if(article.metadata.date == undefined) + if(article.metadata.date === undefined) article.metadata.date = {}; - if(article.metadata.date.creation == undefined) + if(article.metadata.date.creation === undefined) article.metadata.date.creation = oldestCommit.date; article.metadata.date.modification = newestCommit.date; @@ -101,9 +101,9 @@ module.exports = function(obj) { if(article.metadata.author === undefined) article.metadata.author = {} - if(article.metadata.author.name == undefined) + if(article.metadata.author.name === undefined) article.metadata.author.name = oldestCommit.author.name - if(article.metadata.author.email == undefined) + if(article.metadata.author.email === undefined) article.metadata.author.email = oldestCommit.author.email article.commits = commits; diff --git a/sitegin/jobs.js b/sitegin/jobs.js index bf4ed3e4..89e1217f 100644 --- a/sitegin/jobs.js +++ b/sitegin/jobs.js @@ -1,7 +1,9 @@ +'use strict'; + var syntaxError = require('syntax-error'); var fs = require('fs'); var chokidar = require('chokidar'); -var eventEmitter = new (require('events').EventEmitter); +var eventEmitter = new (require('events').EventEmitter)(); var jobList = {}; var watchers = []; @@ -16,15 +18,16 @@ function JobError(message, name) { var onReload = function() {} var requireError = function(e, jobName, module, reject) { if(e instanceof SyntaxError) { + console.log(module+': '+e); var resolved = require.resolve(module); fs.readFile(resolved, 'utf8', function(err, content) { console.log(syntaxError(content,resolved)); - reject(new JobError('Failed to register job '+jobName,'Require')) + reject(new JobError('Failed to register job '+jobName+' (SyntaxError)','Require')) }) } else { if(e.code === 'MODULE_NOT_FOUND') console.log(e.toString()); - reject(new JobError('Failed to register job '+jobName,'Require')) + reject(new JobError('Failed to register job '+jobName+' ('+e+')','Require')) } } @@ -91,9 +94,10 @@ var jobs = { registerMultiple: function() { var regs = []; var watch = true; + var i; for(i in arguments) { var job = arguments[i]; - if(i == 0) { + if(i === '0') { if(job.watch !== undefined) watch = job.watch; } else { regs.push(jobs.register(job[0], job[1], watch)); @@ -109,14 +113,14 @@ var jobs = { try { return jobList[jobName].f.apply(null, Array.prototype.slice.call(arguments, 1)); } catch(e) { - console.log("Error running job",jobName); + console.log('Error running job',jobName); console.log(jobList[jobName]); throw e; } }, runSequence: function() { var prom; - console.log("Running",Array.prototype.slice.call(arguments, 0)) + console.log('Running',Array.prototype.slice.call(arguments, 0)) var jobSequence = [].splice.call(arguments, 0); jobSequence.forEach(function(job){ if(prom === undefined) { diff --git a/sitegin/markdown.js b/sitegin/markdown.js index 81b2bd27..083be8fe 100644 --- a/sitegin/markdown.js +++ b/sitegin/markdown.js @@ -13,15 +13,15 @@ var toURL = function(url) { } renderer.heading = function(text, level, raw) { - return '<h' - + (level+2) - + ' id="' - + toURL(raw) - + '">' - + text - + '</h' - + (level+2) - + '>\n'; + return '<h' + + (level+2) + + ' id="' + + toURL(raw) + + '">' + + text + + '</h' + + (level+2) + + '>\n'; } renderer.paragraph = function(text) { @@ -43,8 +43,8 @@ marked.setOptions({ module.exports = function(obj) { obj.pages.forEach(function(article) { renderer.image = function(href, title, text) { - href = href.split(path.sep).join("/"); - href = href.split(" ="); + href = href.split(path.sep).join('/'); + href = href.split(' ='); var size = href[1]; href = href[0]; var rel = path.relative(process.cwd(),path.resolve(article.filename,href)); diff --git a/sitegin/nunjucks.js b/sitegin/nunjucks.js index aa87c041..7534dffe 100644 --- a/sitegin/nunjucks.js +++ b/sitegin/nunjucks.js @@ -1,3 +1,4 @@ +'use strict'; /* * This job renders `data` using nunjucks template `type` */ @@ -26,7 +27,7 @@ env.addFilter('paginationList', function(page, count) { } curPage = page; - for(var i = 0; i < count; i++) { + for(let i = 0; i < count; i++) { curPage = curPage.metadata.nextpage; if(curPage === undefined) break; pages.push(curPage); diff --git a/sitegin/parseHugo.js b/sitegin/parseHugo.js index 43af577a..cbcc984d 100644 --- a/sitegin/parseHugo.js +++ b/sitegin/parseHugo.js @@ -4,23 +4,23 @@ var path = require('path'); var jsesc = require('jsesc') var readPageWorker = function(content, obj) { - if(content === undefined) throw new Error("content is undefined"); + if(content === undefined) throw new Error('content is undefined'); var head = content.substring(0,4) if(head !== '+++\n') throw new Error('Failed to parse file '+obj.filename+':\n'+ 'Wrong header (expected "+++\\n" got "'+jsesc(head)+'")') content = content.substring(4); - var fm_end = content.indexOf("+++\n"); - if(fm_end < 0) { + var fmEnd = content.indexOf('+++\n'); + if(fmEnd < 0) { console.log(jsesc(content)); throw new Error('Cannot find terminating +++\n in file '+obj.filename); } - obj.content = content.substring(fm_end+4); + obj.content = content.substring(fmEnd+4); try { - obj.metadata = toml.parse(content.substring(0,fm_end-1)+"\n"); + obj.metadata = toml.parse(content.substring(0,fmEnd-1)+'\n'); } catch(e) { - console.log(obj.filename+": Failed to parse metadata"); + console.log(obj.filename+': Failed to parse metadata'); throw e; } if(obj.metadata.date && obj.metadata.date.creation) obj.metadata.date.creation = moment(obj.metadata.date.creation); diff --git a/sitegin/tags.js b/sitegin/tags.js index 2e27c8dc..3041b3c0 100644 --- a/sitegin/tags.js +++ b/sitegin/tags.js @@ -1,3 +1,5 @@ +'use strict'; + var moment = require('moment'); var jobs = require('./jobs'); @@ -7,7 +9,7 @@ var toURL = function(url) { module.exports = function(obj) { return new Promise(function(resolve, reject) { - var tags = new Array(); + var tags = []; var tagPages = {}; obj.pages.forEach(function(article) { if(article.metadata.tags) { @@ -20,7 +22,7 @@ module.exports = function(obj) { ntags.push(tag); if(tags.map(function(e) { return e.url; }).indexOf(tag.url) < 0) tags.push(tag) - if(tagPages[tag.url] == undefined) tagPages[tag.url] = new Array(); + if(tagPages[tag.url] === undefined) tagPages[tag.url] = []; tagPages[tag.url].push(article) }) article.metadata.tags = ntags; @@ -31,11 +33,11 @@ module.exports = function(obj) { obj.redirects = []; var generateTagPages = function(file, pageList) { - var p = {}; - p.type = "redirect"; - p.file = file; - p.content = file+"/1"; - obj.redirects.push(p); + var pg = {}; + pg.type = 'redirect'; + pg.file = file; + pg.content = file+'/1'; + obj.redirects.push(pg); pageList.sort(function (a, b) { var rhs = a.metadata.date.creation; @@ -43,18 +45,18 @@ module.exports = function(obj) { return lhs > rhs ? 1 : lhs < rhs ? -1 : 0; }) var c = 0; - var p = 0; + let p = 0; var tagPage; var prevurl; var prevpage; var firstpage; var lastpage; - tagPageList = []; + var tagPageList = []; pageList.forEach(function(page) { - if(c == 0) { + if(c === 0) { p++; if(tagPage !== undefined) { - tagPage.metadata.nexturl = file+"/"+p; + tagPage.metadata.nexturl = file+'/'+p; obj.tags.push(tagPage); tagPageList.push(tagPage); } @@ -62,15 +64,15 @@ module.exports = function(obj) { if(firstpage === undefined) firstpage = tagPage; lastpage = tagPage; - tagPage.file = file+"/"+p; - tagPage.type = "tag"; + tagPage.file = file+'/'+p; + tagPage.type = 'tag'; tagPage.metadata.firstpage = firstpage; tagPage.metadata.prevpage = prevpage; tagPage.metadata.prevurl = prevurl; tagPage.metadata.thispage = tagPage; tagPage.metadata.pagenumber = p; - tagPage.content = new Array(); + tagPage.content = []; if(prevpage !== undefined) prevpage.metadata.nextpage = tagPage; prevurl = tagPage.file; @@ -89,7 +91,7 @@ module.exports = function(obj) { } tags.forEach(function(tag) { - generateTagPages("tag/"+tag.url, tagPages[tag.url]) + generateTagPages('tag/'+tag.url, tagPages[tag.url]) }) resolve(obj); }) diff --git a/sitegin/toURL.js b/sitegin/toURL.js index d94e8056..997e3c07 100644 --- a/sitegin/toURL.js +++ b/sitegin/toURL.js @@ -1,10 +1,11 @@ -var Latinise={};Latinise.latin_map={"Ă":"A","Ä‚":"A","áş®":"A","Ặ":"A","áş°":"A","Ẳ":"A","áş´":"A","ÇŤ":"A","Ă‚":"A","Ấ":"A","Ậ":"A","Ầ":"A","Ẩ":"A","Ẫ":"A","Ă„":"A","Çž":"A","Ȧ":"A","Ç ":"A","áş ":"A","Č€":"A","Ă€":"A","Ả":"A","Č‚":"A","Ä€":"A","Ä„":"A","Ă…":"A","Çş":"A","Ḁ":"A","Čş":"A","Ă":"A","Ꜳ":"AA","Æ":"AE","ÇĽ":"AE","Ǣ":"AE","ęś´":"AO","Ꜷ":"AU","Ꜹ":"AV","ęśş":"AV","Ꜽ":"AY","Ḃ":"B","Ḅ":"B","Ć":"B","Ḇ":"B","É":"B","Ć‚":"B","Ć":"C","ÄŚ":"C","Ç":"C","á¸":"C","Ä":"C","ÄŠ":"C","Ƈ":"C","Č»":"C","ÄŽ":"D","á¸":"D","Ḓ":"D","Ḋ":"D","Ḍ":"D","ĆŠ":"D","Ḏ":"D","Dz":"D","Ç…":"D","Ä":"D","Ć‹":"D","DZ":"DZ","Ç„":"DZ","É":"E","Ä”":"E","Äš":"E","Ȩ":"E","Ḝ":"E","ĂŠ":"E","áşľ":"E","Ệ":"E","Ề":"E","Ể":"E","Ễ":"E","á¸":"E","Ă‹":"E","Ä–":"E","Ẹ":"E","Č„":"E","Ă":"E","áşş":"E","Ȇ":"E","Ä’":"E","Ḗ":"E","Ḕ":"E","Ä":"E","Ɇ":"E","Ẽ":"E","Ḛ":"E","Ꝫ":"ET","Ḟ":"F","Ć‘":"F","Ç´":"G","Äž":"G","Ǧ":"G","Ģ":"G","Äś":"G","Ä ":"G","Ć“":"G","Ḡ":"G","Ǥ":"G","Ḫ":"H","Čž":"H","Ḩ":"H","Ĥ":"H","Ⱨ":"H","Ḧ":"H","Ḣ":"H","Ḥ":"H","Ħ":"H","ĂŤ":"I","Ĭ":"I","ÇŹ":"I","ĂŽ":"I","ĂŹ":"I","Ḯ":"I","Ä°":"I","Ị":"I","Č":"I","ĂŚ":"I","á»":"I","ČŠ":"I","ÄŞ":"I","Ä®":"I","Ć—":"I","Ĩ":"I","Ḭ":"I","ęťą":"D","ęť»":"F","ęť˝":"G","ęž‚":"R","ęž„":"S","Ꞇ":"T","Ꝭ":"IS","Ä´":"J","É":"J","Ḱ":"K","Ǩ":"K","Ķ":"K","Ⱪ":"K","ęť‚":"K","Ḳ":"K","Ć":"K","Ḵ":"K","Ꝁ":"K","ęť„":"K","Äą":"L","Č˝":"L","Ä˝":"L","Ä»":"L","Ḽ":"L","Ḷ":"L","Ḹ":"L","â± ":"L","ęť":"L","Ḻ":"L","Äż":"L","Ɫ":"L","Ç":"L","Ĺ":"L","LJ":"LJ","Ḿ":"M","Ṁ":"M","áą‚":"M","â±®":"M","Ĺ":"N","Ň":"N","Ĺ…":"N","Ṋ":"N","áą„":"N","Ṇ":"N","Ǹ":"N","Ćť":"N","áą":"N","Č ":"N","Ç‹":"N","Ă‘":"N","ÇŠ":"NJ","Ă“":"O","ĹŽ":"O","Ç‘":"O","Ă”":"O","á»":"O","á»":"O","á»’":"O","á»”":"O","á»–":"O","Ă–":"O","ČŞ":"O","Č®":"O","Č°":"O","Ọ":"O","Ĺ":"O","ČŚ":"O","Ă’":"O","Ỏ":"O","Ć ":"O","Ớ":"O","Ợ":"O","Ờ":"O","Ở":"O","á» ":"O","ČŽ":"O","Ꝋ":"O","Ꝍ":"O","ĹŚ":"O","áą’":"O","áą":"O","Ćź":"O","ÇŞ":"O","Ǭ":"O","Ă":"O","Çľ":"O","Ă•":"O","Ṍ":"O","Ṏ":"O","Ȭ":"O","Ƣ":"OI","Ꝏ":"OO","Ć":"E","Ɔ":"O","Ȣ":"OU","áą”":"P","áą–":"P","ęť’":"P","Ƥ":"P","ęť”":"P","Ᵽ":"P","ęť":"P","ęť":"Q","ęť–":"Q","Ĺ”":"R","Ĺ":"R","Ĺ–":"R","áą":"R","áąš":"R","áąś":"R","Č":"R","Č’":"R","áąž":"R","ÉŚ":"R","Ɽ":"R","ęśľ":"C","ĆŽ":"E","Ĺš":"S","Ṥ":"S","Ĺ ":"S","Ṧ":"S","Ĺž":"S","Ĺś":"S","Č":"S","áą ":"S","Ṣ":"S","Ṩ":"S","Ť":"T","Ţ":"T","áą°":"T","Čš":"T","Čľ":"T","Ṫ":"T","Ṭ":"T","Ƭ":"T","áą®":"T","Ć®":"T","Ŧ":"T","Ɐ":"A","Ꞁ":"L","Ćś":"M","É…":"V","Ꜩ":"TZ","Ăš":"U","Ŭ":"U","Ç“":"U","Ă›":"U","Ṷ":"U","Ăś":"U","Ç—":"U","Ç™":"U","Ç›":"U","Ç•":"U","Ṳ":"U","Ụ":"U","Ĺ°":"U","Č”":"U","Ă™":"U","Ủ":"U","ĆŻ":"U","Ứ":"U","á»°":"U","Ừ":"U","Ử":"U","á»®":"U","Č–":"U","ĹŞ":"U","áąş":"U","Ų":"U","Ĺ®":"U","Ũ":"U","Ṹ":"U","áą´":"U","ęťž":"V","áąľ":"V","Ʋ":"V","Ṽ":"V","ęť ":"VY","áş‚":"W","Ĺ´":"W","áş„":"W","Ẇ":"W","áş":"W","Ẁ":"W","Ⱳ":"W","Ẍ":"X","Ẋ":"X","Ăť":"Y","Ŷ":"Y","Ÿ":"Y","Ẏ":"Y","á»´":"Y","Ỳ":"Y","Ćł":"Y","Ỷ":"Y","Ỿ":"Y","Ȳ":"Y","ÉŽ":"Y","Ỹ":"Y","Ĺą":"Z","Ĺ˝":"Z","áş":"Z","Ⱬ":"Z","Ĺ»":"Z","áş’":"Z","Ȥ":"Z","áş”":"Z","Ƶ":"Z","IJ":"IJ","Ĺ’":"OE","á´€":"A","á´":"AE","Ę™":"B","á´":"B","á´„":"C","á´…":"D","á´‡":"E","ęś°":"F","ɢ":"G","Ę›":"G","Ęś":"H","ÉŞ":"I","Ę":"R","á´Š":"J","á´‹":"K","Ęź":"L","á´Ś":"L","á´Ť":"M","É´":"N","á´Ź":"O","ɶ":"OE","á´":"O","á´•":"OU","á´":"P","Ę€":"R","á´Ž":"N","á´™":"R","ęś±":"S","á´›":"T","â±»":"E","á´š":"R","á´ś":"U","á´ ":"V","á´ˇ":"W","ĘŹ":"Y","á´˘":"Z","á":"a","Ä":"a","ắ":"a","áş·":"a","áş±":"a","áşł":"a","áşµ":"a","ÇŽ":"a","â":"a","ấ":"a","áş":"a","ầ":"a","áş©":"a","áş«":"a","ä":"a","Çź":"a","ȧ":"a","ǡ":"a","ạ":"a","Č":"a","Ă ":"a","ả":"a","Č":"a","Ä":"a","Ä…":"a","ᶏ":"a","áşš":"a","ĂĄ":"a","Ç»":"a","á¸":"a","ⱥ":"a","ĂŁ":"a","ęśł":"aa","æ":"ae","Ç˝":"ae","ÇŁ":"ae","ęśµ":"ao","ęś·":"au","ęśą":"av","ęś»":"av","ęś˝":"ay","á¸":"b","ḅ":"b","É“":"b","ḇ":"b","ᵬ":"b","ᶀ":"b","Ć€":"b","Ć":"b","ɵ":"o","ć":"c","ÄŤ":"c","ç":"c","ḉ":"c","ĉ":"c","É•":"c","Ä‹":"c","Ć":"c","ČĽ":"c","ÄŹ":"d","ḑ":"d","ḓ":"d","ȡ":"d","ḋ":"d","ḍ":"d","É—":"d","ᶑ":"d","ḏ":"d","áµ":"d","á¶":"d","Ä‘":"d","É–":"d","ĆŚ":"d","ı":"i","Č·":"j","Éź":"j","Ę„":"j","Çł":"dz","dž":"dz","Ă©":"e","Ä•":"e","Ä›":"e","Č©":"e","ḝ":"e","ĂŞ":"e","áşż":"e","ệ":"e","á»":"e","á»":"e","á»…":"e","ḙ":"e","Ă«":"e","Ä—":"e","áşą":"e","Č…":"e","è":"e","áş»":"e","ȇ":"e","Ä“":"e","ḗ":"e","ḕ":"e","ⱸ":"e","Ä™":"e","ᶒ":"e","ɇ":"e","áş˝":"e","ḛ":"e","ęť«":"et","ḟ":"f","Ć’":"f","áµ®":"f","ᶂ":"f","ǵ":"g","Äź":"g","ǧ":"g","ÄŁ":"g","Äť":"g","ġ":"g","É ":"g","ḡ":"g","á¶":"g","ÇĄ":"g","ḫ":"h","Čź":"h","ḩ":"h","ÄĄ":"h","ⱨ":"h","ḧ":"h","ḣ":"h","ḥ":"h","ɦ":"h","áş–":"h","ħ":"h","Ć•":"hv","Ă":"i","Ä":"i","Ç":"i","Ă®":"i","ĂŻ":"i","ḯ":"i","ị":"i","ȉ":"i","ì":"i","ỉ":"i","Č‹":"i","Ä«":"i","ÄŻ":"i","ᶖ":"i","ɨ":"i","Ä©":"i","á¸":"i","ęťş":"d","ꝼ":"f","ᵹ":"g","ęž":"r","ęž…":"s","ꞇ":"t","ęť":"is","Ç°":"j","ĵ":"j","Ęť":"j","ɉ":"j","ḱ":"k","Ç©":"k","Ä·":"k","ⱪ":"k","ęť":"k","ḳ":"k","Ć™":"k","ḵ":"k","ᶄ":"k","ęť":"k","ęť…":"k","Äş":"l","Ćš":"l","ɬ":"l","Äľ":"l","ÄĽ":"l","ḽ":"l","Č´":"l","ḷ":"l","ḹ":"l","ⱡ":"l","ꝉ":"l","ḻ":"l","Ĺ€":"l","É«":"l","ᶅ":"l","É":"l","Ĺ‚":"l","lj":"lj","Ĺż":"s","áşś":"s","áş›":"s","áşť":"s","ḿ":"m","áą":"m","áą":"m","ɱ":"m","ᵯ":"m","ᶆ":"m","Ĺ„":"n","Ĺ":"n","ņ":"n","áą‹":"n","ȵ":"n","áą…":"n","ṇ":"n","Çą":"n","ɲ":"n","ṉ":"n","Ćž":"n","áµ°":"n","ᶇ":"n","Éł":"n","ñ":"n","ÇŚ":"nj","Ăł":"o","ĹŹ":"o","Ç’":"o","Ă´":"o","ố":"o","á»™":"o","ồ":"o","ổ":"o","á»—":"o","ö":"o","Č«":"o","ČŻ":"o","ȱ":"o","ọ":"o","Ĺ‘":"o","ČŤ":"o","ò":"o","ỏ":"o","ơ":"o","á»›":"o","ợ":"o","ờ":"o","ở":"o","ỡ":"o","ČŹ":"o","ęť‹":"o","ꝍ":"o","ⱺ":"o","ĹŤ":"o","áą“":"o","áą‘":"o","Ç«":"o","Ç":"o","ø":"o","Çż":"o","õ":"o","ṍ":"o","ṏ":"o","Č":"o","ĆŁ":"oi","ꝏ":"oo","É›":"e","ᶓ":"e","É”":"o","ᶗ":"o","ČŁ":"ou","áą•":"p","áą—":"p","ęť“":"p","ĆĄ":"p","áµ±":"p","á¶":"p","ęť•":"p","áµ˝":"p","ęť‘":"p","ęť™":"q","Ę ":"q","É‹":"q","ęť—":"q","Ĺ•":"r","Ĺ™":"r","Ĺ—":"r","áą™":"r","áą›":"r","áąť":"r","Č‘":"r","Éľ":"r","ᵳ":"r","Č“":"r","áąź":"r","ÉĽ":"r","ᵲ":"r","ᶉ":"r","ÉŤ":"r","É˝":"r","ↄ":"c","ęśż":"c","É":"e","Éż":"r","Ĺ›":"s","ṥ":"s","š":"s","ṧ":"s","Ĺź":"s","Ĺť":"s","Č™":"s","ṡ":"s","ṣ":"s","áą©":"s","Ę‚":"s","áµ´":"s","ᶊ":"s","Čż":"s","ɡ":"g","á´‘":"o","á´“":"o","á´ť":"u","ĹĄ":"t","ĹŁ":"t","áą±":"t","Č›":"t","ȶ":"t","áş—":"t","ⱦ":"t","áą«":"t","áą":"t","Ć":"t","ṯ":"t","áµµ":"t","Ć«":"t","Ę":"t","ŧ":"t","ᵺ":"th","É":"a","á´‚":"ae","Çť":"e","áµ·":"g","ÉĄ":"h","Ę®":"h","ĘŻ":"h","á´‰":"i","Ęž":"k","ęž":"l","ÉŻ":"m","É°":"m","á´”":"oe","Éą":"r","É»":"r","Éş":"r","ⱹ":"r","ʇ":"t","ĘŚ":"v","ĘŤ":"w","ĘŽ":"y","ęś©":"tz","Ăş":"u","Ĺ":"u","Ç”":"u","Ă»":"u","áą·":"u","ĂĽ":"u","Ç":"u","Çš":"u","Çś":"u","Ç–":"u","áął":"u","ụ":"u","ű":"u","Č•":"u","Ăą":"u","ủ":"u","Ć°":"u","ứ":"u","á»±":"u","ừ":"u","á»":"u","ữ":"u","Č—":"u","Ĺ«":"u","áą»":"u","Ĺł":"u","ᶙ":"u","ĹŻ":"u","Ĺ©":"u","áąą":"u","áąµ":"u","ᵫ":"ue","ꝸ":"um","â±´":"v","ęťź":"v","áąż":"v","Ę‹":"v","ᶌ":"v","â±±":"v","áą˝":"v","ꝡ":"vy","áş":"w","ŵ":"w","áş…":"w","ẇ":"w","ẉ":"w","áş":"w","ⱳ":"w","áş":"w","ẍ":"x","áş‹":"x","ᶍ":"x","Ă˝":"y","Ĺ·":"y","Ăż":"y","ẏ":"y","ỵ":"y","ỳ":"y","Ć´":"y","á»·":"y","ỿ":"y","Čł":"y","áş™":"y","ÉŹ":"y","ỹ":"y","Ĺş":"z","Ĺľ":"z","áş‘":"z","Ę‘":"z","ⱬ":"z","ĹĽ":"z","áş“":"z","ČĄ":"z","áş•":"z","ᵶ":"z","ᶎ":"z","Ę":"z","ƶ":"z","É€":"z","ff":"ff","ď¬":"ffi","ffl":"ffl","ď¬":"fi","fl":"fl","Äł":"ij","Ĺ“":"oe","st":"st","â‚":"a","â‚‘":"e","ᵢ":"i","ⱼ":"j","â‚’":"o","ᵣ":"r","ᵤ":"u","ᵥ":"v","â‚“":"x"}; -String.prototype.latinise=function(){return this.replace(/[^A-Za-z0-9\[\] ]/g,function(a){return Latinise.latin_map[a]||a})}; -String.prototype.latinize=String.prototype.latinise; -String.prototype.isLatin=function(){return this==this.latinise()} + +/* jshint ignore:start */ +var Latinise={};Latinise.latin_map={'Ă':'A','Ä‚':'A','áş®':'A','Ặ':'A','áş°':'A','Ẳ':'A','áş´':'A','ÇŤ':'A','Ă‚':'A','Ấ':'A','Ậ':'A','Ầ':'A','Ẩ':'A','Ẫ':'A','Ă„':'A','Çž':'A','Ȧ':'A','Ç ':'A','áş ':'A','Č€':'A','Ă€':'A','Ả':'A','Č‚':'A','Ä€':'A','Ä„':'A','Ă…':'A','Çş':'A','Ḁ':'A','Čş':'A','Ă':'A','Ꜳ':'AA','Æ':'AE','ÇĽ':'AE','Ǣ':'AE','ęś´':'AO','Ꜷ':'AU','Ꜹ':'AV','ęśş':'AV','Ꜽ':'AY','Ḃ':'B','Ḅ':'B','Ć':'B','Ḇ':'B','É':'B','Ć‚':'B','Ć':'C','ÄŚ':'C','Ç':'C','á¸':'C','Ä':'C','ÄŠ':'C','Ƈ':'C','Č»':'C','ÄŽ':'D','á¸':'D','Ḓ':'D','Ḋ':'D','Ḍ':'D','ĆŠ':'D','Ḏ':'D','Dz':'D','Ç…':'D','Ä':'D','Ć‹':'D','DZ':'DZ','Ç„':'DZ','É':'E','Ä”':'E','Äš':'E','Ȩ':'E','Ḝ':'E','ĂŠ':'E','áşľ':'E','Ệ':'E','Ề':'E','Ể':'E','Ễ':'E','á¸':'E','Ă‹':'E','Ä–':'E','Ẹ':'E','Č„':'E','Ă':'E','áşş':'E','Ȇ':'E','Ä’':'E','Ḗ':'E','Ḕ':'E','Ä':'E','Ɇ':'E','Ẽ':'E','Ḛ':'E','Ꝫ':'ET','Ḟ':'F','Ć‘':'F','Ç´':'G','Äž':'G','Ǧ':'G','Ģ':'G','Äś':'G','Ä ':'G','Ć“':'G','Ḡ':'G','Ǥ':'G','Ḫ':'H','Čž':'H','Ḩ':'H','Ĥ':'H','Ⱨ':'H','Ḧ':'H','Ḣ':'H','Ḥ':'H','Ħ':'H','ĂŤ':'I','Ĭ':'I','ÇŹ':'I','ĂŽ':'I','ĂŹ':'I','Ḯ':'I','Ä°':'I','Ị':'I','Č':'I','ĂŚ':'I','á»':'I','ČŠ':'I','ÄŞ':'I','Ä®':'I','Ć—':'I','Ĩ':'I','Ḭ':'I','ęťą':'D','ęť»':'F','ęť˝':'G','ęž‚':'R','ęž„':'S','Ꞇ':'T','Ꝭ':'IS','Ä´':'J','É':'J','Ḱ':'K','Ǩ':'K','Ķ':'K','Ⱪ':'K','ęť‚':'K','Ḳ':'K','Ć':'K','Ḵ':'K','Ꝁ':'K','ęť„':'K','Äą':'L','Č˝':'L','Ä˝':'L','Ä»':'L','Ḽ':'L','Ḷ':'L','Ḹ':'L','â± ':'L','ęť':'L','Ḻ':'L','Äż':'L','Ɫ':'L','Ç':'L','Ĺ':'L','LJ':'LJ','Ḿ':'M','Ṁ':'M','áą‚':'M','â±®':'M','Ĺ':'N','Ň':'N','Ĺ…':'N','Ṋ':'N','áą„':'N','Ṇ':'N','Ǹ':'N','Ćť':'N','áą':'N','Č ':'N','Ç‹':'N','Ă‘':'N','ÇŠ':'NJ','Ă“':'O','ĹŽ':'O','Ç‘':'O','Ă”':'O','á»':'O','á»':'O','á»’':'O','á»”':'O','á»–':'O','Ă–':'O','ČŞ':'O','Č®':'O','Č°':'O','Ọ':'O','Ĺ':'O','ČŚ':'O','Ă’':'O','Ỏ':'O','Ć ':'O','Ớ':'O','Ợ':'O','Ờ':'O','Ở':'O','á» ':'O','ČŽ':'O','Ꝋ':'O','Ꝍ':'O','ĹŚ':'O','áą’':'O','áą':'O','Ćź':'O','ÇŞ':'O','Ǭ':'O','Ă':'O','Çľ':'O','Ă•':'O','Ṍ':'O','Ṏ':'O','Ȭ':'O','Ƣ':'OI','Ꝏ':'OO','Ć':'E','Ɔ':'O','Ȣ':'OU','áą”':'P','áą–':'P','ęť’':'P','Ƥ':'P','ęť”':'P','Ᵽ':'P','ęť':'P','ęť':'Q','ęť–':'Q','Ĺ”':'R','Ĺ':'R','Ĺ–':'R','áą':'R','áąš':'R','áąś':'R','Č':'R','Č’':'R','áąž':'R','ÉŚ':'R','Ɽ':'R','ęśľ':'C','ĆŽ':'E','Ĺš':'S','Ṥ':'S','Ĺ ':'S','Ṧ':'S','Ĺž':'S','Ĺś':'S','Č':'S','áą ':'S','Ṣ':'S','Ṩ':'S','Ť':'T','Ţ':'T','áą°':'T','Čš':'T','Čľ':'T','Ṫ':'T','Ṭ':'T','Ƭ':'T','áą®':'T','Ć®':'T','Ŧ':'T','Ɐ':'A','Ꞁ':'L','Ćś':'M','É…':'V','Ꜩ':'TZ','Ăš':'U','Ŭ':'U','Ç“':'U','Ă›':'U','Ṷ':'U','Ăś':'U','Ç—':'U','Ç™':'U','Ç›':'U','Ç•':'U','Ṳ':'U','Ụ':'U','Ĺ°':'U','Č”':'U','Ă™':'U','Ủ':'U','ĆŻ':'U','Ứ':'U','á»°':'U','Ừ':'U','Ử':'U','á»®':'U','Č–':'U','ĹŞ':'U','áąş':'U','Ų':'U','Ĺ®':'U','Ũ':'U','Ṹ':'U','áą´':'U','ęťž':'V','áąľ':'V','Ʋ':'V','Ṽ':'V','ęť ':'VY','áş‚':'W','Ĺ´':'W','áş„':'W','Ẇ':'W','áş':'W','Ẁ':'W','Ⱳ':'W','Ẍ':'X','Ẋ':'X','Ăť':'Y','Ŷ':'Y','Ÿ':'Y','Ẏ':'Y','á»´':'Y','Ỳ':'Y','Ćł':'Y','Ỷ':'Y','Ỿ':'Y','Ȳ':'Y','ÉŽ':'Y','Ỹ':'Y','Ĺą':'Z','Ĺ˝':'Z','áş':'Z','Ⱬ':'Z','Ĺ»':'Z','áş’':'Z','Ȥ':'Z','áş”':'Z','Ƶ':'Z','IJ':'IJ','Ĺ’':'OE','á´€':'A','á´':'AE','Ę™':'B','á´':'B','á´„':'C','á´…':'D','á´‡':'E','ęś°':'F','ɢ':'G','Ę›':'G','Ęś':'H','ÉŞ':'I','Ę':'R','á´Š':'J','á´‹':'K','Ęź':'L','á´Ś':'L','á´Ť':'M','É´':'N','á´Ź':'O','ɶ':'OE','á´':'O','á´•':'OU','á´':'P','Ę€':'R','á´Ž':'N','á´™':'R','ęś±':'S','á´›':'T','â±»':'E','á´š':'R','á´ś':'U','á´ ':'V','á´ˇ':'W','ĘŹ':'Y','á´˘':'Z','á':'a','Ä':'a','ắ':'a','áş·':'a','áş±':'a','áşł':'a','áşµ':'a','ÇŽ':'a','â':'a','ấ':'a','áş':'a','ầ':'a','áş©':'a','áş«':'a','ä':'a','Çź':'a','ȧ':'a','ǡ':'a','ạ':'a','Č':'a','Ă ':'a','ả':'a','Č':'a','Ä':'a','Ä…':'a','ᶏ':'a','áşš':'a','ĂĄ':'a','Ç»':'a','á¸':'a','ⱥ':'a','ĂŁ':'a','ęśł':'aa','æ':'ae','Ç˝':'ae','ÇŁ':'ae','ęśµ':'ao','ęś·':'au','ęśą':'av','ęś»':'av','ęś˝':'ay','á¸':'b','ḅ':'b','É“':'b','ḇ':'b','ᵬ':'b','ᶀ':'b','Ć€':'b','Ć':'b','ɵ':'o','ć':'c','ÄŤ':'c','ç':'c','ḉ':'c','ĉ':'c','É•':'c','Ä‹':'c','Ć':'c','ČĽ':'c','ÄŹ':'d','ḑ':'d','ḓ':'d','ȡ':'d','ḋ':'d','ḍ':'d','É—':'d','ᶑ':'d','ḏ':'d','áµ':'d','á¶':'d','Ä‘':'d','É–':'d','ĆŚ':'d','ı':'i','Č·':'j','Éź':'j','Ę„':'j','Çł':'dz','dž':'dz','Ă©':'e','Ä•':'e','Ä›':'e','Č©':'e','ḝ':'e','ĂŞ':'e','áşż':'e','ệ':'e','á»':'e','á»':'e','á»…':'e','ḙ':'e','Ă«':'e','Ä—':'e','áşą':'e','Č…':'e','è':'e','áş»':'e','ȇ':'e','Ä“':'e','ḗ':'e','ḕ':'e','ⱸ':'e','Ä™':'e','ᶒ':'e','ɇ':'e','áş˝':'e','ḛ':'e','ęť«':'et','ḟ':'f','Ć’':'f','áµ®':'f','ᶂ':'f','ǵ':'g','Äź':'g','ǧ':'g','ÄŁ':'g','Äť':'g','ġ':'g','É ':'g','ḡ':'g','á¶':'g','ÇĄ':'g','ḫ':'h','Čź':'h','ḩ':'h','ÄĄ':'h','ⱨ':'h','ḧ':'h','ḣ':'h','ḥ':'h','ɦ':'h','áş–':'h','ħ':'h','Ć•':'hv','Ă':'i','Ä':'i','Ç':'i','Ă®':'i','ĂŻ':'i','ḯ':'i','ị':'i','ȉ':'i','ì':'i','ỉ':'i','Č‹':'i','Ä«':'i','ÄŻ':'i','ᶖ':'i','ɨ':'i','Ä©':'i','á¸':'i','ęťş':'d','ꝼ':'f','ᵹ':'g','ęž':'r','ęž…':'s','ꞇ':'t','ęť':'is','Ç°':'j','ĵ':'j','Ęť':'j','ɉ':'j','ḱ':'k','Ç©':'k','Ä·':'k','ⱪ':'k','ęť':'k','ḳ':'k','Ć™':'k','ḵ':'k','ᶄ':'k','ęť':'k','ęť…':'k','Äş':'l','Ćš':'l','ɬ':'l','Äľ':'l','ÄĽ':'l','ḽ':'l','Č´':'l','ḷ':'l','ḹ':'l','ⱡ':'l','ꝉ':'l','ḻ':'l','Ĺ€':'l','É«':'l','ᶅ':'l','É':'l','Ĺ‚':'l','lj':'lj','Ĺż':'s','áşś':'s','áş›':'s','áşť':'s','ḿ':'m','áą':'m','áą':'m','ɱ':'m','ᵯ':'m','ᶆ':'m','Ĺ„':'n','Ĺ':'n','ņ':'n','áą‹':'n','ȵ':'n','áą…':'n','ṇ':'n','Çą':'n','ɲ':'n','ṉ':'n','Ćž':'n','áµ°':'n','ᶇ':'n','Éł':'n','ñ':'n','ÇŚ':'nj','Ăł':'o','ĹŹ':'o','Ç’':'o','Ă´':'o','ố':'o','á»™':'o','ồ':'o','ổ':'o','á»—':'o','ö':'o','Č«':'o','ČŻ':'o','ȱ':'o','ọ':'o','Ĺ‘':'o','ČŤ':'o','ò':'o','ỏ':'o','ơ':'o','á»›':'o','ợ':'o','ờ':'o','ở':'o','ỡ':'o','ČŹ':'o','ęť‹':'o','ꝍ':'o','ⱺ':'o','ĹŤ':'o','áą“':'o','áą‘':'o','Ç«':'o','Ç':'o','ø':'o','Çż':'o','õ':'o','ṍ':'o','ṏ':'o','Č':'o','ĆŁ':'oi','ꝏ':'oo','É›':'e','ᶓ':'e','É”':'o','ᶗ':'o','ČŁ':'ou','áą•':'p','áą—':'p','ęť“':'p','ĆĄ':'p','áµ±':'p','á¶':'p','ęť•':'p','áµ˝':'p','ęť‘':'p','ęť™':'q','Ę ':'q','É‹':'q','ęť—':'q','Ĺ•':'r','Ĺ™':'r','Ĺ—':'r','áą™':'r','áą›':'r','áąť':'r','Č‘':'r','Éľ':'r','ᵳ':'r','Č“':'r','áąź':'r','ÉĽ':'r','ᵲ':'r','ᶉ':'r','ÉŤ':'r','É˝':'r','ↄ':'c','ęśż':'c','É':'e','Éż':'r','Ĺ›':'s','ṥ':'s','š':'s','ṧ':'s','Ĺź':'s','Ĺť':'s','Č™':'s','ṡ':'s','ṣ':'s','áą©':'s','Ę‚':'s','áµ´':'s','ᶊ':'s','Čż':'s','ɡ':'g','á´‘':'o','á´“':'o','á´ť':'u','ĹĄ':'t','ĹŁ':'t','áą±':'t','Č›':'t','ȶ':'t','áş—':'t','ⱦ':'t','áą«':'t','áą':'t','Ć':'t','ṯ':'t','áµµ':'t','Ć«':'t','Ę':'t','ŧ':'t','ᵺ':'th','É':'a','á´‚':'ae','Çť':'e','áµ·':'g','ÉĄ':'h','Ę®':'h','ĘŻ':'h','á´‰':'i','Ęž':'k','ęž':'l','ÉŻ':'m','É°':'m','á´”':'oe','Éą':'r','É»':'r','Éş':'r','ⱹ':'r','ʇ':'t','ĘŚ':'v','ĘŤ':'w','ĘŽ':'y','ęś©':'tz','Ăş':'u','Ĺ':'u','Ç”':'u','Ă»':'u','áą·':'u','ĂĽ':'u','Ç':'u','Çš':'u','Çś':'u','Ç–':'u','áął':'u','ụ':'u','ű':'u','Č•':'u','Ăą':'u','ủ':'u','Ć°':'u','ứ':'u','á»±':'u','ừ':'u','á»':'u','ữ':'u','Č—':'u','Ĺ«':'u','áą»':'u','Ĺł':'u','ᶙ':'u','ĹŻ':'u','Ĺ©':'u','áąą':'u','áąµ':'u','ᵫ':'ue','ꝸ':'um','â±´':'v','ęťź':'v','áąż':'v','Ę‹':'v','ᶌ':'v','â±±':'v','áą˝':'v','ꝡ':'vy','áş':'w','ŵ':'w','áş…':'w','ẇ':'w','ẉ':'w','áş':'w','ⱳ':'w','áş':'w','ẍ':'x','áş‹':'x','ᶍ':'x','Ă˝':'y','Ĺ·':'y','Ăż':'y','ẏ':'y','ỵ':'y','ỳ':'y','Ć´':'y','á»·':'y','ỿ':'y','Čł':'y','áş™':'y','ÉŹ':'y','ỹ':'y','Ĺş':'z','Ĺľ':'z','áş‘':'z','Ę‘':'z','ⱬ':'z','ĹĽ':'z','áş“':'z','ČĄ':'z','áş•':'z','ᵶ':'z','ᶎ':'z','Ę':'z','ƶ':'z','É€':'z','ff':'ff','ď¬':'ffi','ffl':'ffl','ď¬':'fi','fl':'fl','Äł':'ij','Ĺ“':'oe','st':'st','â‚':'a','â‚‘':'e','ᵢ':'i','ⱼ':'j','â‚’':'o','ᵣ':'r','ᵤ':'u','ᵥ':'v','â‚“':'x'}; +var latinise = function(l){return l.replace(/[^A-Za-z0-9\[\] ]/g,function(a){return Latinise.latin_map[a]||a})}; +/* jshint ignore:end */ module.exports = function(tag) { - if(tag == undefined) return undefined; - return tag.toLowerCase().latinise().replace(/ /g,"-");; + if(tag === undefined) return undefined; + return latinise(tag.toLowerCase()).replace(/ /g,'-'); } diff --git a/sitegin/writeFiles.js b/sitegin/writeFiles.js index 04a17fd0..295a6fea 100644 --- a/sitegin/writeFiles.js +++ b/sitegin/writeFiles.js @@ -9,7 +9,7 @@ module.exports = function(obj) { var todo = 0; var writeFile = function(article) { - var filename = path.join(builddir,article.file,"index.html"); + var filename = path.join(builddir,article.file,'index.html'); mkdirp(path.dirname(filename), function() { fs.writeFile(filename, article.content, function(err) { if(err) reject(err); -- GitLab