hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 8d044c7753f9ab996610a1239ad207310a5d2d6e
parent 3673c72dae8317c20b725b0cff63ecb6d4803e13
Author: Drew DeVault <sir@cmpwn.com>
Date:   Mon, 19 Apr 2021 19:04:50 -0400

haredoc: fill out <title> with module ident

Diffstat:
Mcmd/haredoc/html.ha | 18++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/cmd/haredoc/html.ha b/cmd/haredoc/html.ha @@ -12,9 +12,11 @@ use strio; // Formats output as HTML fn emit_html(ctx: *context) (void | error) = { const decls = ctx.summary; - if (ctx.template) head()?; - const ident = unparse::identstr(ctx.ident); + defer free(ident); + + if (ctx.template) head(ctx.ident)?; + fmt::printf("<h2>{} <span class='heading-extra'>", ident); for (let i = 0z; i < len(ctx.tags); i += 1) { const mode = switch (ctx.tags[i].mode) { @@ -243,13 +245,17 @@ fn prototype_html( return n; }; -fn head() (void | error) = { - // TODO: Get title from module name +fn head(ident: ast::ident) (void | error) = { + const ident = unparse::identstr(ident); + defer free(ident); + + // TODO: Fix up breadcrumb // TODO: Move me to +embed? - fmt::println("<!doctype html> + fmt::printfln("<!doctype html> <html lang='en'> <meta charset='utf-8' /> -<title>Hare documentation</title> +<title>{} — Hare documentation", ident)?; + fmt::println("</title> <style> body { font-family: sans-serif;