import nunjucks from "nunjucks" ; const env = nunjucks . configure ( { autoescape : true } ) ; import { readFile } from "fs/promises" ; import { Feeds , JSONValue } from "./@types/bubo" ; /**
 * Global filters for my Nunjucks templates
 */ env . addFilter ( "formatDate" , function ( dateString ) : string { const date = new Date ( parseInt ( dateString ) ) ; return ! isNaN ( date . getTime ( ) ) ? date . toLocaleDateString ( ) : dateString ; } ) ; env . addGlobal ( "now" , new Date ( ) . toUTCString ( ) ) ; const template = ( await readFile ( new URL ( "../config/template.html" , import . meta . url ) ) ) . toString ( ) ; const render = ( { data , errors , info } ) => { return env . renderString ( template , { data , errors , info } ) ; } ; export { render } ;