File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed
Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import dotenv from "dotenv";
77import { JSDOM } from "jsdom" ;
88import * as FileSystem from "node:fs/promises" ;
99import { Marked } from "marked" ;
10+ import YAML from "yaml" ;
1011
1112dotenv . config ( ) ;
1213
@@ -39,13 +40,10 @@ const template = {
3940 } ,
4041 header : {
4142 splash :
42- FileSystem . readFile ( "./content/splash.txt " , "utf8" )
43+ FileSystem . readFile ( "./content/splash.yaml " , "utf8" )
4344 . then ( string => {
44- const array = string
45- . replace ( / \s + \/ \/ .* / g, "" ) // remove comments
46- . replace ( / \n (? ! \S + ) / g, "" ) // remove empty lines
47- . split ( "\n" ) ;
48- const splash = array [ Math . floor ( Math . random ( ) * array . length ) ] ;
45+ const array = YAML . parse ( string ) ;
46+ const { splash } = array [ Math . floor ( Math . random ( ) * array . length ) ] ;
4947 return splash
5048 . replace ( / < ( (? ! \/ > ) .+ ?) > / g, "<span class=\"splash-$1\">" )
5149 . replace ( / < \/ > / g, "</span>" )
You can’t perform that action at this time.
0 commit comments