From 6b830f42b6a8baec77ee0c8d12333ca2ad4a296f Mon Sep 17 00:00:00 2001 From: gingerBill Date: Mon, 17 Jan 2022 23:48:46 +0000 Subject: [PATCH] Improve stylization with collapsible directories; Fix name padding --- tools/odin-html-docs/odin_html_docs_main.odin | 75 ++++++++++++++++--- tools/odin-html-docs/style.css | 63 ++++++++++++++-- 2 files changed, 121 insertions(+), 17 deletions(-) diff --git a/tools/odin-html-docs/odin_html_docs_main.odin b/tools/odin-html-docs/odin_html_docs_main.odin index 988c54d9d..317d95a5a 100644 --- a/tools/odin-html-docs/odin_html_docs_main.odin +++ b/tools/odin-html-docs/odin_html_docs_main.odin @@ -107,6 +107,51 @@ write_html_header :: proc(w: io.Writer, title: string) { } write_html_footer :: proc(w: io.Writer) { + io.write_string(w, ` + +`) fmt.wprintf(w, "\n\n") } @@ -255,7 +300,7 @@ write_core_directory :: proc(w: io.Writer) { fmt.wprintln(w, "

Directories

") - fmt.wprintln(w, "\t") + fmt.wprintln(w, "\t
") fmt.wprintln(w, "\t\t") for dir := root.first_child; dir != nil; dir = dir.next { @@ -264,7 +309,7 @@ write_core_directory :: proc(w: io.Writer) { for child := dir.first_child; child != nil; child = child.next { fmt.wprintf(w, "pkg-%s ", str(child.pkg.name)) } - fmt.wprint(w, `" class="directory-pkg">`) + io.write_string(w, ``) } } + io.write_string(w, ``) fmt.wprintf(w, "\n") for child := dir.first_child; child != nil; child = child.next { assert(child.pkg != nil) - fmt.wprintf(w, `") + io.write_string(w, ``) line_doc, _, _ := strings.partition(str(child.pkg.docs), "\n") line_doc = strings.trim_space(line_doc) + io.write_string(w, ``) } + io.write_string(w, ``) + fmt.wprintf(w, "") fmt.wprintf(w, "\n") } } @@ -314,7 +360,7 @@ write_core_directory :: proc(w: io.Writer) { is_entity_blank :: proc(e: doc.Entity_Index) -> bool { name := str(entities[e].name) - return name == "" || name == "_" + return name == "" } write_where_clauses :: proc(w: io.Writer, where_clauses: []doc.String) { @@ -348,6 +394,12 @@ write_type :: proc(using writer: ^Type_Writer, type: doc.Type, flags: Write_Type write_param_entity :: proc(using writer: ^Type_Writer, e: ^doc.Entity, flags: Write_Type_Flags, name_width := 0) { name := str(e.name) + write_padding :: proc(w: io.Writer, name: string, name_width: int) { + for _ in 0..
") + io.write_string(w, ``) if dir.pkg != nil { line_doc, _, _ := strings.partition(str(dir.pkg.docs), "\n") line_doc = strings.trim_space(line_doc) if line_doc != "" { - io.write_string(w, ``) write_doc_line(w, line_doc) - io.write_string(w, `
`, str(child.pkg.name)) + fmt.wprintf(w, `
`, str(child.pkg.name)) fmt.wprintf(w, `%s`, child.path, child.name) - fmt.wprintf(w, "`) if line_doc != "" { - io.write_string(w, ``) write_doc_line(w, line_doc) - io.write_string(w, `