Skip to content

Commit

Permalink
deploy: b055f44
Browse files Browse the repository at this point in the history
  • Loading branch information
avindra committed Aug 8, 2021
1 parent 1f69c35 commit 076f558
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 19 deletions.
26 changes: 19 additions & 7 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
4 changes: 4 additions & 0 deletions css/general.css
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,7 @@ blockquote {
margin: 5px 0px;
font-weight: bold;
}

.result-no-output {
font-style: italic;
}
2 changes: 1 addition & 1 deletion lang/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ <h2 id="programming-languages"><a class="header" href="#programming-languages">P
<h3 id="general"><a class="header" href="#general">General</a></h3>
<p>The code samples from Kernighan's talks tend to use <a href="./C.html">C</a> and <a href="./awk.html">AWK</a>.</p>
<ul>
<li>1974: <a href="https://archive.org/details/elementsofprogra00kernrich/mode/2up">The Elements of Programming Style</a>
<li>1974: <a href="https://archive.org/details/elementsofprogra00kernrich/mode/2up">The Elements of Programming Style</a> (<a href="http://www2.ing.unipi.it/%7Ea009435/issw/extra/kp_elems_of_pgmng_sty.pdf">PDF</a>) (<a href="https://seriouscomputerist.atariverse.com/media/pdf/book/Elements%20of%20Programming%20Style.pdf">2e PDF</a>)
<ul>
<li>by Brian W. Kernighan and <a href="https://www.plauger.com/">Phillip James Plaugher</a></li>
<li>title refers to William Strunk's <a href="https://www.gutenberg.org/ebooks/37134">The Elements of Style</a> (1918)</li>
Expand Down
12 changes: 8 additions & 4 deletions lang/regex.html
Original file line number Diff line number Diff line change
Expand Up @@ -165,16 +165,20 @@ <h3 id="regular-expressions"><a class="header" href="#regular-expressions">Regul
<li>by Rob Pike</li>
</ul>
</li>
<li>2003: <a href="https://www.regular-expressions.info/quickstart.html">Regular-Expressions.info</a>
<li>2007: <a href="https://swtch.com/%7Ersc/regexp/">Implementing Regular Expressions</a> (<a href="https://swtch.com/%7Ersc/talks/regexp.pdf">lecture</a>)
<ul>
<li>by <a href="https://www.just-great-software.com/aboutjg.html">Jan Goyvaerts</a></li>
<li>by <a href="https://swtch.com/%7Ersc/">Russ Cox</a></li>
</ul>
</li>
<li>2007: <a href="https://swtch.com/%7Ersc/regexp/">Implementing Regular Expressions</a> (<a href="https://swtch.com/%7Ersc/talks/regexp.pdf">lecture</a>)
</ul>
<h4 id="other-resources"><a class="header" href="#other-resources">Other resources</a></h4>
<ul>
<li>by <a href="https://swtch.com/%7Ersc/">Russ Cox</a></li>
<li>2003: <a href="https://www.regular-expressions.info/quickstart.html">Regular-Expressions.info</a>
<ul>
<li>by <a href="https://www.just-great-software.com/aboutjg.html">Jan Goyvaerts</a></li>
</ul>
</li>
<li><a href="https://en.wikipedia.org/wiki/Wikipedia:AutoWikiBrowser/Regular_expression">Regular expression tables on Wikipedia</a></li>
</ul>

</main>
Expand Down
14 changes: 9 additions & 5 deletions print.html
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ <h1 id="awards"><a class="header" href="#awards">Awards</a></h1>
<h3 id="general"><a class="header" href="#general">General</a></h3>
<p>The code samples from Kernighan's talks tend to use <a href="lang/./C.html">C</a> and <a href="lang/./awk.html">AWK</a>.</p>
<ul>
<li>1974: <a href="https://archive.org/details/elementsofprogra00kernrich/mode/2up">The Elements of Programming Style</a>
<li>1974: <a href="https://archive.org/details/elementsofprogra00kernrich/mode/2up">The Elements of Programming Style</a> (<a href="http://www2.ing.unipi.it/%7Ea009435/issw/extra/kp_elems_of_pgmng_sty.pdf">PDF</a>) (<a href="https://seriouscomputerist.atariverse.com/media/pdf/book/Elements%20of%20Programming%20Style.pdf">2e PDF</a>)
<ul>
<li>by Brian W. Kernighan and <a href="https://www.plauger.com/">Phillip James Plaugher</a></li>
<li>title refers to William Strunk's <a href="https://www.gutenberg.org/ebooks/37134">The Elements of Style</a> (1918)</li>
Expand Down Expand Up @@ -952,16 +952,20 @@ <h2 id="b"><a class="header" href="#b">B</a></h2>
<li>by Rob Pike</li>
</ul>
</li>
<li>2003: <a href="https://www.regular-expressions.info/quickstart.html">Regular-Expressions.info</a>
<li>2007: <a href="https://swtch.com/%7Ersc/regexp/">Implementing Regular Expressions</a> (<a href="https://swtch.com/%7Ersc/talks/regexp.pdf">lecture</a>)
<ul>
<li>by <a href="https://www.just-great-software.com/aboutjg.html">Jan Goyvaerts</a></li>
<li>by <a href="https://swtch.com/%7Ersc/">Russ Cox</a></li>
</ul>
</li>
<li>2007: <a href="https://swtch.com/%7Ersc/regexp/">Implementing Regular Expressions</a> (<a href="https://swtch.com/%7Ersc/talks/regexp.pdf">lecture</a>)
</ul>
<h4 id="other-resources"><a class="header" href="#other-resources">Other resources</a></h4>
<ul>
<li>by <a href="https://swtch.com/%7Ersc/">Russ Cox</a></li>
<li>2003: <a href="https://www.regular-expressions.info/quickstart.html">Regular-Expressions.info</a>
<ul>
<li>by <a href="https://www.just-great-software.com/aboutjg.html">Jan Goyvaerts</a></li>
</ul>
</li>
<li><a href="https://en.wikipedia.org/wiki/Wikipedia:AutoWikiBrowser/Regular_expression">Regular expression tables on Wikipedia</a></li>
</ul>
<div style="break-before: page; page-break-before: always;"></div><h3 id="go"><a class="header" href="#go">Go</a></h3>
<p>Go is a new programming language designed by many people, some of whom are the UNIX author(s). It is sponsored and developed at Google.</p>
Expand Down
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion searchindex.json

Large diffs are not rendered by default.

0 comments on commit 076f558

Please sign in to comment.