Source

Modified ago
include ../../utils/functions.pug mixin source-contained(info) - const ignore = require("ignore"); .columns .columns__column.columns__column_xs_12.columns__column_centered-content div.title.title_source Source .source //- Current path ("/" if root) div.source__path.breadcrumbs //- Create breadcrumbs | / span.link.link_source.breadcrumb(href='/source') aya.waifu.ist div //- If path is a directory - //- Get files let files = fs.readdirSync(__dirname); //- Sort by directories first files.sort((a, b) => { isA = fs.statSync(`${__dirname}/${a}`).isDirectory(); isB = fs.statSync(`${__dirname}/${b}`).isDirectory(); if (isA && !isB) { return -1 } else if (!isA && isB) { return 1 } return 0 }); //- Read .gitignore let gitignore = fs.readFileSync(`${__dirname}/.gitignore`, 'utf-8').split('\n'); //- Add filters let ig = ignore(); for (let i = 0; i < gitignore.length; i++) { ig.add(gitignore[i]); } //- Filter files ig.filter(files); ul.source__files each file in files if !ig.ignores(file) li - //- Use empty file icon by default let icon = 'empty'; let modified; let stats = fs.statSync(`${__dirname}/${file}`); //- If is directory if (stats.isDirectory()) { icon = 'folder'; modified = directoryModified(file, ig); } else { //- Get the respective icon for (let name in exts) { if (file.endsWith(name)) { icon = exts[name].icon; } } modified = stats.mtime } span.source__file.icon(class!=`icon_${icon}`, href=`/source/${file}`)= file.split('/').pop() span.source__bump.timeago(title=modified, data-bump=modified.getTime()) canvas.matrix#matrix