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 head before/after stylesheet and body
14 match = data.toString().match(/^<!DOCTYPE html><html xmlns="http:\/\/www\.w3\.org\/1999\/xhtml"><head><meta charset="utf-8">([^]*)<link rel="stylesheet" href="_static\/classic\.css" type="text\/css"><link rel="stylesheet" href="_static\/pygments\.css" type="text\/css"><script id="documentation_options" data-url_root="\.\/" src="_static\/documentation_options\.js"><\/script><script src="_static\/jquery\.js"><\/script><script src="_static\/underscore\.js"><\/script><script src="_static\/doctools\.js"><\/script><script src="_static\/language_data\.js"><\/script>(<script src="_static\/searchtools\.js"><\/script>)?([^]*)<\/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, 'sphinx.dir.jst')
22 // insert head before/after stylesheet and body into our navbar
23 let navbar = await _require('/_lib/navbar.jst')
29 link(type="text/css" rel="stylesheet" href="/css/sphinx/classic.css") {}
30 link(type="text/css" rel="stylesheet" href="/css/sphinx/pygments.css") {}
31 script(id="documentation_options" data-url_root="./" src="/js/sphinx/documentation_options.js") {}
32 script(src="/js/sphinx/jquery.js") {}
33 script(src="/js/sphinx/underscore.js") {}
34 script(src="/js/sphinx/doctools.js") {}
35 script(src="/js/sphinx/language_data.js") {}
36 if (match[2] !== undefined)
37 script(src="/js/sphinx/searchtools.js") {}
52 return async (env, pathname, components) => {
54 components.length === 1 &&
55 components[0].slice(-5) === '.html' &&
56 await serve_html(env, `${pathname}/${components[0]}`)
59 return /*await*/ env.site.serve_path(env, pathname, components)