Skip to content

Commit

Permalink
updates for version 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
learnbyexample committed Aug 22, 2023
1 parent c03a96b commit d4c661b
Show file tree
Hide file tree
Showing 33 changed files with 1,685 additions and 1,336 deletions.
24 changes: 6 additions & 18 deletions 404.html

Large diffs are not rendered by default.

569 changes: 404 additions & 165 deletions Exercise_solutions.html

Large diffs are not rendered by default.

97 changes: 46 additions & 51 deletions awk-introduction.html

Large diffs are not rendered by default.

50 changes: 19 additions & 31 deletions awk-scripts.html

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion ayu-highlight.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ Original by Dempfi (https://github.com/dempfi/ayu)
overflow-x: auto;
background: #191f26;
color: #e6e1cf;
padding: 0.5em;
}

.hljs-comment,
Expand Down
35 changes: 27 additions & 8 deletions book.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,12 @@ function playground_text(playground) {

let text = playground_text(code_block);
let classes = code_block.querySelector('code').classList;
let has_2018 = classes.contains("edition2018");
let edition = has_2018 ? "2018" : "2015";

let edition = "2015";
if(classes.contains("edition2018")) {
edition = "2018";
} else if(classes.contains("edition2021")) {
edition = "2021";
}
var params = {
version: "stable",
optimize: "0",
Expand All @@ -133,7 +136,15 @@ function playground_text(playground) {
body: JSON.stringify(params)
})
.then(response => response.json())
.then(response => result_block.innerText = response.result)
.then(response => {
if (response.result.trim() === '') {
result_block.innerText = "No output";
result_block.classList.add("result-no-output");
} else {
result_block.innerText = response.result;
result_block.classList.remove("result-no-output");
}
})
.catch(error => result_block.innerText = "Playground Communication: " + error.message);
}

Expand All @@ -151,12 +162,13 @@ function playground_text(playground) {
if (window.ace) {
// language-rust class needs to be removed for editable
// blocks or highlightjs will capture events
Array
.from(document.querySelectorAll('code.editable'))
code_nodes
.filter(function (node) {return node.classList.contains("editable"); })
.forEach(function (block) { block.classList.remove('language-rust'); });

Array
.from(document.querySelectorAll('code:not(.editable)'))
code_nodes
.filter(function (node) {return !node.classList.contains("editable"); })
.forEach(function (block) { hljs.highlightBlock(block); });
} else {
code_nodes.forEach(function (block) { hljs.highlightBlock(block); });
Expand Down Expand Up @@ -359,7 +371,14 @@ function playground_text(playground) {
});

themePopup.addEventListener('click', function (e) {
var theme = e.target.id || e.target.parentElement.id;
var theme;
if (e.target.className === "theme") {
theme = e.target.id;
} else if (e.target.parentElement.className === "theme") {
theme = e.target.parentElement.id;
} else {
return;
}
set_theme(theme);
});

Expand Down
215 changes: 117 additions & 98 deletions built-in-functions.html

Large diffs are not rendered by default.

24 changes: 6 additions & 18 deletions buy.html

Large diffs are not rendered by default.

78 changes: 35 additions & 43 deletions control-structures.html

Large diffs are not rendered by default.

24 changes: 6 additions & 18 deletions cover.html

Large diffs are not rendered by default.

49 changes: 44 additions & 5 deletions css/chrome.css
Original file line number Diff line number Diff line change
Expand Up @@ -208,24 +208,63 @@ pre {
pre > .buttons {
position: absolute;
z-index: 100;
right: 5px;
top: 5px;
right: 0px;
top: 2px;
margin: 0px;
padding: 2px 0px;

color: var(--sidebar-fg);
cursor: pointer;
visibility: hidden;
opacity: 0;
transition: visibility 0.1s linear, opacity 0.1s linear;
}
pre:hover > .buttons {
visibility: visible;
opacity: 1
}
pre > .buttons :hover {
color: var(--sidebar-active);
border-color: var(--icons-hover);
background-color: var(--theme-hover);
}
pre > .buttons i {
margin-left: 8px;
}
pre > .buttons button {
color: inherit;
background: transparent;
border: none;
cursor: inherit;
margin: 0px 5px;
padding: 3px 5px;
font-size: 14px;

border-style: solid;
border-width: 1px;
border-radius: 4px;
border-color: var(--icons);
background-color: var(--theme-popup-bg);
transition: 100ms;
transition-property: color,border-color,background-color;
color: var(--icons);
}
@media (pointer: coarse) {
pre > .buttons button {
/* On mobile, make it easier to tap buttons. */
padding: 0.3rem 1rem;
}
}
pre > code {
padding: 1rem;
}

/* FIXME: ACE editors overlap their buttons because ACE does absolute
positioning within the code block which breaks padding. The only solution I
can think of is to move the padding to the outer pre tag (or insert a div
wrapper), but that would require fixing a whole bunch of CSS rules.
*/
.hljs.ace_editor {
padding: 0rem 0rem;
}

pre > .result {
margin-top: 10px;
}
Expand Down
20 changes: 17 additions & 3 deletions css/general.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ html {
color: var(--fg);
background-color: var(--bg);
text-size-adjust: none;
-webkit-text-size-adjust: none;
}

body {
Expand All @@ -25,6 +26,16 @@ code {
font-size: 0.875em; /* please adjust the ace font size accordingly in editor.js */
}

/* make long words/inline code not x overflow */
main {
overflow-wrap: break-word;
}

/* make wide tables scroll if they overflow */
.table-wrapper {
overflow-x: auto;
}

/* Don't change font size in headers. */
h1 code, h2 code, h3 code, h4 code, h5 code, h6 code {
font-size: unset;
Expand Down Expand Up @@ -79,8 +90,7 @@ h6:target::before {

.content {
overflow-y: auto;
padding: 0 15px;
padding-bottom: 50px;
padding: 0 5px 50px 5px;
}
.content main {
margin-left: auto;
Expand All @@ -92,7 +102,7 @@ h6:target::before {
.content ul { line-height: 1.45em; }
.content a { text-decoration: none; }
.content a:hover { text-decoration: underline; }
.content img { max-width: 100%; }
.content img, .content video { max-width: 100%; }
.content .header:link,
.content .header:visited {
color: var(--fg);
Expand Down Expand Up @@ -175,3 +185,7 @@ blockquote {
margin: 5px 0px;
font-weight: bold;
}

.result-no-output {
font-style: italic;
}
6 changes: 3 additions & 3 deletions css/variables.css
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@

--links: #2b79a2;

--inline-code-color: #c5c8c6;;
--inline-code-color: #c5c8c6;

--theme-popup-bg: #141617;
--theme-popup-border: #43484d;
Expand Down Expand Up @@ -147,7 +147,7 @@

--links: #2b79a2;

--inline-code-color: #c5c8c6;;
--inline-code-color: #c5c8c6;

--theme-popup-bg: #161923;
--theme-popup-border: #737480;
Expand Down Expand Up @@ -228,7 +228,7 @@

--links: #2b79a2;

--inline-code-color: #c5c8c6;;
--inline-code-color: #c5c8c6;

--theme-popup-bg: #141617;
--theme-popup-border: #43484d;
Expand Down
Loading

0 comments on commit d4c661b

Please sign in to comment.