forked from unimatrix/web
Add CloudPanel Node hosting with MySQL and secure local accounts
This commit is contained in:
parent
e78b591daf
commit
fffb47531c
1 changed files with 339 additions and 2 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import {readFileSync,writeFileSync,readdirSync} from 'node:fs';
|
||||
const web=new URL('../web/',import.meta.url),posts=JSON.parse(readFileSync(new URL('prophecy-data.json',web),'utf8'));
|
||||
const extended=new URL('../content/prophecy/',import.meta.url),graphicData=JSON.parse(readFileSync(new URL('prophecy-graphics.json',web),'utf8'));
|
||||
for(const post of posts){const essay=readFileSync(new URL(post.id+'.md',extended),'utf8');const sections=essay.split(/^# /m).slice(1).map(block=>{const [heading,...lines]=block.trim().split('\n');return {heading,paragraphs:lines.join('\n').trim().split(/\n\s*\n/).filter(Boolean)}});post.sections.push(...sections);post.words=post.sections.flatMap(x=>x.paragraphs).join(' ').split(/\s+/).length;if(post.words<3000)throw Error(post.id+' has only '+post.words+' words');post.minutes=Math.ceil(post.words/200)}
|
||||
for(const post of posts){const essay=readFileSync(new URL(post.id+'.md',extended),'utf8').replace(/\r\n/g,'\n');const sections=essay.split(/^# /m).slice(1).map(block=>{const [heading,...lines]=block.trim().split('\n');return {heading,paragraphs:lines.join('\n').trim().split(/\n\s*\n/).filter(Boolean)}});post.sections.push(...sections);post.words=post.sections.flatMap(x=>x.paragraphs).join(' ').split(/\s+/).length;if(post.words<3000)throw Error(post.id+' has only '+post.words+' words');post.minutes=Math.ceil(post.words/200)}
|
||||
const escape=s=>s.replace(/[&<>"']/g,c=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c]));
|
||||
const links=[['index.html','Home','menu-6'],['manual.html','Manual/wiki','menu-5'],['prophecy.html','The Prophecy','item-28'],['exchange.html','Xchange','menu-0'],['forums.html','Forums','menu-4'],['discord.html','Discord','menu-3'],['tickets.html','Support tickets','menu-9']];
|
||||
function top(file){return '<nav aria-label="Main navigation">'+links.map(([href,label,icon])=>'<a href="'+href+'"'+((href===file||(href==='prophecy.html'&&file.startsWith('prophecy-')))?' aria-current="page"':'')+'><img src="assets/'+icon+'.webp" alt="" width="28" height="28"><span>'+label+'</span></a>').join('')+'</nav>'}
|
||||
|
|
|
|||
Loading…
Reference in a new issue

Staff