commit 7017a4e5f023bc2d569b7f838b7df74aaaf1c046
parent fe6332b75cc8cf3d013da357f340552a7c0cc13c
Author: Drew DeVault <sir@cmpwn.com>
Date: Mon, 19 Apr 2021 17:37:26 -0400
haredoc: move toc into <pre>
Diffstat:
1 file changed, 8 insertions(+), 19 deletions(-)
diff --git a/cmd/haredoc/html.ha b/cmd/haredoc/html.ha
@@ -38,31 +38,30 @@ fn emit_html(ctx: *context) (void | error) = {
if (len(decls.types) != 0) {
fmt::println("<h4>Types</h4>")?;
- fmt::println("<ol>")?;
+ fmt::println("<pre>")?;
for (let i = 0z; i < len(decls.types); i += 1) {
tocentry(decls.types[i])?;
};
- fmt::println("</ol>")?;
+ fmt::print("</pre>")?;
};
if (len(decls.globals) != 0) {
fmt::println("<h4>Globals</h4>")?;
- fmt::println("<ol>")?;
+ fmt::print("<pre>")?;
for (let i = 0z; i < len(decls.globals); i += 1) {
tocentry(decls.globals[i])?;
};
- fmt::println("</ol>")?;
+ fmt::print("</pre>")?;
};
if (len(decls.funcs) != 0) {
fmt::println("<h4>Functions</h4>")?;
- fmt::println("<ol>")?;
+ fmt::print("<pre>")?;
for (let i = 0z; i < len(decls.funcs); i += 1) {
tocentry(decls.funcs[i])?;
};
- fmt::println("</ol>")?;
+ fmt::println("</pre>")?;
};
- fmt::println("</ol>")?;
fmt::println("<hr />")?;
for (let i = 0z; i < len(decls.types); i += 1) {
@@ -77,7 +76,6 @@ fn emit_html(ctx: *context) (void | error) = {
};
fn tocentry(decl: ast::decl) (void | error) = {
- fmt::println("<li>");
fmt::printf("{} ",
match (decl.decl) {
_: ast::decl_func => "fn",
@@ -96,18 +94,12 @@ fn tocentry(decl: ast::decl) (void | error) = {
fmt::fprint(os::stdout, ": ")?;
type_html(os::stdout, 0, g._type, true)?;
},
- t: []ast::decl_type => {
- let t = t[0];
- fmt::fprint(os::stdout, " = ")?;
- type_html(os::stdout, 0, t._type, true)?;
- },
+ t: []ast::decl_type => void,
f: ast::decl_func => prototype_html(os::stdout, 0,
f.prototype._type as ast::func_type,
true)?,
};
fmt::println(";");
-
- fmt::println("</li>");
return;
};
@@ -324,6 +316,7 @@ pre {
background-color: #eee;
padding: 0.25rem 1rem;
margin: 0 -1rem 1rem;
+ font-size: 1.2rem;
}
pre .keyword {
@@ -334,10 +327,6 @@ pre .type {
color: #44F;
}
-pre.decl {
- font-size: 1.2rem;
-}
-
ol {
padding-left: 0;
list-style: none;