|
|
|
@ -4,17 +4,15 @@
|
|
|
|
|
|
|
|
|
|
var getContents = require('../lib/fileio').getContents;
|
|
|
|
|
var convert = require('../lib/fileio').convert;
|
|
|
|
|
var processMd = require('../lib/fileio').processMd;
|
|
|
|
|
var narrowDown = require('../lib/find').narrowDown;
|
|
|
|
|
var selectArticle = require('../lib/find').selectArticle;
|
|
|
|
|
var getArticlePath = require('../lib/util').getArticlePath;
|
|
|
|
|
var tmpSave = require('../lib/fileio').tmpSave;
|
|
|
|
|
var removeTmp = require('../lib/fileio').removeTmp;
|
|
|
|
|
|
|
|
|
|
var lastUpdate = require('arch-wiki-md-repo').updated;
|
|
|
|
|
var articles = require('arch-wiki-md-repo').doneList;
|
|
|
|
|
|
|
|
|
|
// var kexec = require('kexec');
|
|
|
|
|
// var spawn = require('child_process').spawnSync;
|
|
|
|
|
var spawn = require('child_process').spawn;
|
|
|
|
|
|
|
|
|
|
var yargs = require('yargs')
|
|
|
|
@ -41,15 +39,15 @@ var options = {
|
|
|
|
|
Promise.resolve(narrowDown(articles, searchTerms, isDeep)).then(function select(filteredArticles) {
|
|
|
|
|
return selectArticle(filteredArticles);
|
|
|
|
|
}).then(function makeRoff(selectedArticle) {
|
|
|
|
|
// selectedArticle = articles[1747];
|
|
|
|
|
selectedArticle.path = getArticlePath(selectedArticle.path);
|
|
|
|
|
return getContents(selectedArticle);
|
|
|
|
|
}).then(function passToRemark(data) {
|
|
|
|
|
options.name = data.title;
|
|
|
|
|
options.manual = data.url;
|
|
|
|
|
options.description = data.description;
|
|
|
|
|
|
|
|
|
|
return Promise.resolve(convert(data.contents, options));
|
|
|
|
|
}).then(function passToRemarkMd(article) {
|
|
|
|
|
return processMd(article);
|
|
|
|
|
}).then(function passToRemarkMan(article) {
|
|
|
|
|
options.name = article.title;
|
|
|
|
|
options.manual = article.url;
|
|
|
|
|
options.description = article.description;
|
|
|
|
|
|
|
|
|
|
return convert(article.contents, options);
|
|
|
|
|
}).then(function saveTmpFile(roff) {
|
|
|
|
|
return tmpSave(roff);
|
|
|
|
|
}).then(function displayRoff(tmpFile) {
|
|
|
|
@ -59,7 +57,6 @@ Promise.resolve(narrowDown(articles, searchTerms, isDeep)).then(function select(
|
|
|
|
|
console.log('All done');
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}).catch(function catchAll(err) {
|
|
|
|
|
console.log(err);
|
|
|
|
|
});
|
|
|
|
|
// TODO: remove the description from the main text
|
|
|
|
|
// TODO: reformat links and delete images
|
|
|
|
|
|
|
|
|
|