hare

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

commit ede60348193bf3b40dacdb810d9aab8676c41805
parent a5ca3b13fa873f9cee894d7d135d69b03e28b559
Author: Drew DeVault <sir@cmpwn.com>
Date:   Tue, 20 Apr 2021 15:08:16 -0400

haredoc: hide undocumented members by default

Diffstat:
Mcmd/haredoc/html.ha | 23++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/cmd/haredoc/html.ha b/cmd/haredoc/html.ha @@ -164,6 +164,11 @@ fn details(ctx: *context, decl: ast::decl) (void | error) = { </span>")?; fmt::println("</h4>")?; + if (len(decl.docs) == 0) { + fmt::println("<details>"); + fmt::println("<summary>Show undocumented member</summary>"); + }; + fmt::println("<pre class='decl'>")?; unparse_html(os::stdout, decl)?; fmt::println("</pre>")?; @@ -171,6 +176,8 @@ fn details(ctx: *context, decl: ast::decl) (void | error) = { if (len(decl.docs) != 0) { const buf = strings::toutf8(decl.docs); markup_html(ctx, bufio::fixed(buf, io::mode::READ))?; + } else { + fmt::println("</details>"); }; fmt::println("</section>")?; @@ -485,7 +492,21 @@ h3 { h4:target + pre { background: #ddf; -}; +} + +details { + background: #eee; + margin: 1rem -1rem 1rem; +} + +summary { + cursor: pointer; + padding: 0.5rem 1rem; +} + +details pre { + margin: 0; +} @media(max-width: 1000px) { main {