1 let serve_html = async (env, pathname) => {
5 data = await env.site.min_html_cache.get(pathname)
8 if (!(err instanceof Error) || err.code !== 'ENOENT')
13 // try to extract title and body
14 match = data.toString().match(/^<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><title>([^<]*)<\/title><script src="scripts\/prettify\/prettify\.js"><\/script><script src="scripts\/prettify\/lang-css\.js"><\/script><!--\[if lt IE 9\]>\n <script src="\/\/html5shiv\.googlecode\.com\/svn\/trunk\/html5\.js"><\/script>\n <!\[endif\]--><link type="text\/css" rel="stylesheet" href="styles\/prettify-tomorrow\.css"><link type="text\/css" rel="stylesheet" href="styles\/jsdoc-default\.css"><\/head><body>([^]*)<\/body><\/html>\n?$/)
15 //console.log('match', match)
17 // not found, just serve the HTML as fallback
18 env.site.serve(env, 200, data, 'jsdoc.dir.jst')
22 // insert title and body into our navbar
23 let navbar = await _require('/navbar.jst')
31 script(src="scripts/prettify/prettify.js") {}
32 script(src="scripts/prettify/lang-css.js") {}
33 link(type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css") {}
34 link(type="text/css" rel="stylesheet" href="/css/jsdoc-default.css") {}
48 return async (env, pathname, components) => {
50 components.length === 1 &&
51 components[0].slice(-5) === '.html' &&
52 await serve_html(env, `${pathname}/${components[0]}`)
55 return /*await*/ env.site.serve_path(env, pathname, components)