From 9f26cbce9144b8a266d078cdc3fcb6fa50e5abfe Mon Sep 17 00:00:00 2001 From: Ciprian Dorin Craciun Date: Fri, 13 Jul 2018 19:30:08 +0300 Subject: [PATCH] [documentation] Update CSS formatting, add JavaScript code, minor other changes [#95] --- documentation/libraries.css | 48 ++++++++++++++++++---------------- documentation/libraries.js | 23 ++++++++++++++++ sources/tools_documentation.rs | 22 +++++++++++----- 3 files changed, 64 insertions(+), 29 deletions(-) create mode 100644 documentation/libraries.js diff --git a/documentation/libraries.css b/documentation/libraries.css index 7e0e8970..248b6660 100644 --- a/documentation/libraries.css +++ b/documentation/libraries.css @@ -21,15 +21,15 @@ -html:root > *, html:root style { +html:root > *, html:root style, html:root script { display : none; } html:root, html:root > body { display : block; } html:root { - font-family : "Fira Sans"; - font-size : 1.00em; + font-family : "Fira Sans", "Droid Sans", "Verdana", "Trebuchet MS", sans-serif; + font-size : 11pt; line-height : normal; } @@ -39,7 +39,9 @@ html:root { html:root > body { margin-left : auto; margin-right : auto; - max-width : 100ch; + width : 100ch; + min-width : 20ch; + max-width : 95vw; cursor : default; } @@ -102,9 +104,9 @@ html:root > body > blockquote { padding-right : 1.00rem; border-color : hsl(0, 0%, 75%); border-left-style : dashed; - border-left-width : 0.10em; + border-left-width : 0.10rem; border-right-style : dashed; - border-right-width : 0.10em; + border-right-width : 0.10rem; } html:root > body > blockquote > * { padding-left : 1.00rem; @@ -117,14 +119,14 @@ blockquote blockquote { padding-bottom : 0.50rem; border-color : hsl(0, 0%, 75%); border-left-style : solid; - border-left-width : 0.20em; + border-left-width : 0.20rem; border-right-style : solid; - border-right-width : 0.20em; + border-right-width : 0.20rem; } code, pre { - font-family : "Fira Mono"; - background : hsla(0, 0%, 50%, 0.1); + font-family : "Fira Mono", "Droid Sans Mono", "Andale Mono", "Courier New", "Courier", monospace; + background : hsla(0, 0%, 50%, 0.10); } code { display : inline-block; @@ -160,16 +162,14 @@ ol > li { } a { - color : hsl(210, 100%, 40%); + color : hsl(210, 100%, 25%); + border-bottom-style : dotted; + border-bottom-width : 0.10rem; + border-color : hsl(210, 100%, 25%); cursor : pointer; } a:hover { - background : hsla(210, 100%, 50%, 0.05); - border-color : hsla(210, 100%, 50%, 0.20); - border-top-style : solid; - border-top-width : 0.1rem; - border-bottom-style : solid; - border-bottom-width : 0.1rem; + background : hsla(210, 100%, 50%, 0.10); } em { @@ -199,14 +199,17 @@ div.navigator:hover { } div.heading-anchor { - margin-left : 1.00ch; - font-size : 0.75em; - vertical-align : middle; + margin-left : 0.25ch; opacity : 0.25; } div.heading-anchor:hover { opacity : 1.00; } +div.heading-anchor a { + color : inherit; + background : transparent; + border : none; +} div.anchor { display : block; @@ -215,10 +218,9 @@ div.anchor { - *::-moz-selection { - color : hsl(30, 100%, 40%); - background : hsla(30, 100%, 50%, 0.05); + color : hsl(30, 100%, 25%); + background : hsla(30, 100%, 50%, 0.10); } diff --git a/documentation/libraries.js b/documentation/libraries.js new file mode 100644 index 00000000..b52bfded --- /dev/null +++ b/documentation/libraries.js @@ -0,0 +1,23 @@ + +"use strict"; + + +(function () { + + function _apply () { + $("html:root > body pre") .dblclick (_selectAll); + $("html:root > body code") .dblclick (_selectAll); + } + + function _selectAll (_event) { + var _selection = window.getSelection (); + _selection.removeAllRanges (); + var _range = document.createRange (); + _range.selectNodeContents (this); + _selection.addRange (_range); + } + + $(window) .on ("load", _apply); + +}) (); + diff --git a/sources/tools_documentation.rs b/sources/tools_documentation.rs index 1e2bc6d2..cb9b4b02 100644 --- a/sources/tools_documentation.rs +++ b/sources/tools_documentation.rs @@ -872,14 +872,22 @@ fn dump_html_header_write (title : &str, stream : &mut StdVec) -> (Outcome<( let title = title.replace ("\"", """); let prefix = DUMP_HTML_PREFIX.replace ("@{title}", &title); try_or_fail! (stream.write_all (prefix.as_bytes ()), 0xd730a725); - try_or_fail! (stream.write_all (b"\n"), 0x108d0302); + if true { + try_or_fail! (stream.write_all (b"\n"), 0x108d0302); + } succeed! (()); } #[ cfg_attr ( feature = "vonuvoli_inline", inline ) ] fn dump_html_trailer_write (stream : &mut StdVec) -> (Outcome<()>) { + if true { + try_or_fail! (stream.write_all (b"\n"), 0xa38f09a1); + try_or_fail! (stream.write_all (b"\n"), 0x0372c56d); + } try_or_fail! (stream.write_all (DUMP_HTML_SUFFIX.as_bytes ()), 0x17a2e8ae); succeed! (()); } @@ -3080,7 +3088,7 @@ fn dump_cmark_header_write (header_depth : usize, header_caption : &str, kind : }; if configuration.anchors && configuration.html { let anchor = try! (dump_cmark_anchor_generate (kind, library, entity, section)); - try_writeln! (stream, "{} {} ", prefix, header_caption, anchor, anchor); + try_writeln! (stream, "{} {} ", prefix, header_caption, anchor, anchor); } else { try! (dump_cmark_anchor_write (kind, library, entity, section, configuration, stream)); try_writeln! (stream, "{} {}", prefix, header_caption); @@ -3240,7 +3248,7 @@ fn dump_cmark_linked_exports_write <'a> (library : &Library, exports_direct : im if exports_configuration.direct_compact { try_writeln! (stream, "{}[`{}`]({}){};", fixes, export.identifier (), export_anchor, fixes); } else { - try_writeln! (stream, " * {}[`{}`]({}){};", fixes, export.identifier (), export_anchor, fixes); + try_writeln! (stream, " * {}[`{}`]({}){} -- `{}`;", fixes, export.identifier (), export_anchor, fixes, dump_cmark_value_format (& export.descriptor_format ())); } } } @@ -3262,7 +3270,7 @@ fn dump_cmark_linked_exports_write <'a> (library : &Library, exports_direct : im if exports_configuration.recursive_compact { try_writeln! (stream, "{}[`{}`]({}){};", fixes, export.identifier (), export_anchor, fixes); } else { - try_writeln! (stream, " * {}[`{}`]({}){};", fixes, export.identifier (), export_anchor, fixes); + try_writeln! (stream, " * {}[`{}`]({}){} -- `{}`;", fixes, export.identifier (), export_anchor, fixes, dump_cmark_value_format (& export.descriptor_format ())); } } } @@ -3854,6 +3862,7 @@ r####" + @{title} @@ -3867,4 +3876,5 @@ r####" static DUMP_HTML_CSS : &str = include_str! ("../documentation/libraries.css"); +static DUMP_HTML_JS : &str = include_str! ("../documentation/libraries.js");