Skip to content

Commit

Permalink
[documentation] Update CSS formatting, add JavaScript code, minor oth…
Browse files Browse the repository at this point in the history
…er changes [#95]
  • Loading branch information
cipriancraciun committed Jul 13, 2018
1 parent 007d9c1 commit 9f26cbc
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 29 deletions.
48 changes: 25 additions & 23 deletions documentation/libraries.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand All @@ -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);
}


Expand Down
23 changes: 23 additions & 0 deletions documentation/libraries.js
Original file line number Diff line number Diff line change
@@ -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);

}) ();

22 changes: 16 additions & 6 deletions sources/tools_documentation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -872,14 +872,22 @@ fn dump_html_header_write (title : &str, stream : &mut StdVec<u8>) -> (Outcome<(
let title = title.replace ("\"", "&quot;");
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"<style type='text/css'>\n"), 0x64138904);
try_or_fail! (stream.write_all (DUMP_HTML_CSS.as_bytes ()), 0xe8153313);
try_or_fail! (stream.write_all (b"</style>\n"), 0x108d0302);
if true {
try_or_fail! (stream.write_all (b"<style type='text/css'>\n"), 0x64138904);
try_or_fail! (stream.write_all (DUMP_HTML_CSS.as_bytes ()), 0xe8153313);
try_or_fail! (stream.write_all (b"</style>\n"), 0x108d0302);
}
succeed! (());
}

#[ cfg_attr ( feature = "vonuvoli_inline", inline ) ]
fn dump_html_trailer_write (stream : &mut StdVec<u8>) -> (Outcome<()>) {
if true {
try_or_fail! (stream.write_all (b"<script type='text/javascript' src='https://code.jquery.com/jquery-3.3.1.slim.min.js'></script>\n"), 0xa38f09a1);
try_or_fail! (stream.write_all (b"<script type='text/javascript'>\n"), 0xec1427db);
try_or_fail! (stream.write_all (DUMP_HTML_JS.as_bytes ()), 0x577b234f);
try_or_fail! (stream.write_all (b"</script>\n"), 0x0372c56d);
}
try_or_fail! (stream.write_all (DUMP_HTML_SUFFIX.as_bytes ()), 0x17a2e8ae);
succeed! (());
}
Expand Down Expand Up @@ -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, "{} {} <div class='heading-anchor'><a id='{}' href='#{}'>[#]</a></div>", prefix, header_caption, anchor, anchor);
try_writeln! (stream, "{} {} <div class='heading-anchor'><a id='{}' href='#{}'>&sect;</a></div>", prefix, header_caption, anchor, anchor);
} else {
try! (dump_cmark_anchor_write (kind, library, entity, section, configuration, stream));
try_writeln! (stream, "{} {}", prefix, header_caption);
Expand Down Expand Up @@ -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 ()));
}
}
}
Expand All @@ -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 ()));
}
}
}
Expand Down Expand Up @@ -3854,6 +3862,7 @@ r####"<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, minimum-scale=0.5, maximum-scale=4.0, user-scalable=yes">
<title>@{title}</title>
</head>
<body>
Expand All @@ -3867,4 +3876,5 @@ r####"</body>


static DUMP_HTML_CSS : &str = include_str! ("../documentation/libraries.css");
static DUMP_HTML_JS : &str = include_str! ("../documentation/libraries.js");

0 comments on commit 9f26cbc

Please sign in to comment.