citra-emu
/
citra-web
Archived
1
0
Fork 0

Force all wiki links to lowercase, as well as incoming files.

This commit is contained in:
chris062689 2017-05-05 23:44:59 -04:00
parent 14d865ee49
commit 472d3f4375
1 changed files with 5 additions and 3 deletions

View File

@ -10,8 +10,9 @@ var exec = require('sync-exec');
var inputDirectory = './citra.wiki/'; var inputDirectory = './citra.wiki/';
var outputDirectory = '../../site/content/wiki/'; var outputDirectory = '../../site/content/wiki/';
// The URL
function url(title) { function url(title) {
return '/wiki/' + title.replace(/\s+/g, '-'); return '/wiki/' + title.replace(/\s+/g, '-').toLowerCase();
} }
if (fs.existsSync(inputDirectory)) { if (fs.existsSync(inputDirectory)) {
@ -75,9 +76,10 @@ fs.readdir(inputDirectory, function(err, items) {
// Create the new markdown header for Hugo. // Create the new markdown header for Hugo.
let newFileContents = `+++\ntitle = "${title}"\ndate = "${modified.toISOString()}"\n+++\n${cleanData}`; let newFileContents = `+++\ntitle = "${title}"\ndate = "${modified.toISOString()}"\n+++\n${cleanData}`;
fs.writeFile(`${outputDirectory}${item}`, newFileContents, function(err) { let itemOutput = item.toLowerCase();
fs.writeFile(`${outputDirectory}${itemOutput}`, newFileContents, function(err) {
if (err) return logger.error(err); if (err) return logger.error(err);
logger.info(`Wrote file ${item} to filesystem.`); logger.info(`Wrote file ${itemOutput} to filesystem.`);
}); });
} catch (ex) { } catch (ex) {
logger.error(ex); logger.error(ex);