mirror of
https://github.com/sayanarijit/xplr
synced 2024-11-18 09:26:05 +00:00
Automated deployment: Thu Jul 29 17:58:49 UTC 2021 af5a99328f
This commit is contained in:
parent
f64ede2a1a
commit
4d1b21588f
30
en/book.js
30
en/book.js
@ -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",
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -151,15 +162,16 @@ 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)'))
|
||||
.forEach(function (block) { hljs.highlightBlock(block); });
|
||||
code_nodes
|
||||
.filter(function (node) {return !node.classList.contains("editable"); })
|
||||
.forEach(function (block) { hljs.highlightElement(block); });
|
||||
} else {
|
||||
code_nodes.forEach(function (block) { hljs.highlightBlock(block); });
|
||||
code_nodes.forEach(function (block) { hljs.highlightElement(block); });
|
||||
}
|
||||
|
||||
// Adding the hljs class gives code blocks the color css
|
||||
|
@ -175,3 +175,7 @@ blockquote {
|
||||
margin: 5px 0px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.result-no-output {
|
||||
font-style: italic;
|
||||
}
|
||||
|
1337
en/highlight.js
1337
en/highlight.js
File diff suppressed because one or more lines are too long
@ -2435,7 +2435,7 @@ e.g. <code>app-1.0.0</code> with <code>config-1.1.0</code>. But vice versa is fi
|
||||
compatibility.</p>
|
||||
</details>
|
||||
<h3 id="instructions"><a class="header" href="#instructions">Instructions</a></h3>
|
||||
<h4 id="a-hrefhttpsgithubcomsayanarijitxplrreleasestagv0137v0137a---a-hrefhttpsgithubcomsayanarijitxplrreleasestagv0144v0144a"><a class="header" href="#a-hrefhttpsgithubcomsayanarijitxplrreleasestagv0137v0137a---a-hrefhttpsgithubcomsayanarijitxplrreleasestagv0144v0144a"><a href="https://github.com/sayanarijit/xplr/releases/tag/v0.13.7">v0.13.7</a> -> <a href="https://github.com/sayanarijit/xplr/releases/tag/v0.14.4">v0.14.4</a></a></h4>
|
||||
<h4 id="a-hrefhttpsgithubcomsayanarijitxplrreleasestagv0137v0137a---a-hrefhttpsgithubcomsayanarijitxplrreleasestagv0145v0145a"><a class="header" href="#a-hrefhttpsgithubcomsayanarijitxplrreleasestagv0137v0137a---a-hrefhttpsgithubcomsayanarijitxplrreleasestagv0145v0145a"><a href="https://github.com/sayanarijit/xplr/releases/tag/v0.13.7">v0.13.7</a> -> <a href="https://github.com/sayanarijit/xplr/releases/tag/v0.14.5">v0.14.5</a></a></h4>
|
||||
<ul>
|
||||
<li>macOS users need to place their config file (<code>init.lua</code>) in
|
||||
<code>$HOME/.config/xplr/</code> or <code>/etc/xplr/</code>.</li>
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -186,7 +186,7 @@ e.g. <code>app-1.0.0</code> with <code>config-1.1.0</code>. But vice versa is fi
|
||||
compatibility.</p>
|
||||
</details>
|
||||
<h3 id="instructions"><a class="header" href="#instructions">Instructions</a></h3>
|
||||
<h4 id="a-hrefhttpsgithubcomsayanarijitxplrreleasestagv0137v0137a---a-hrefhttpsgithubcomsayanarijitxplrreleasestagv0144v0144a"><a class="header" href="#a-hrefhttpsgithubcomsayanarijitxplrreleasestagv0137v0137a---a-hrefhttpsgithubcomsayanarijitxplrreleasestagv0144v0144a"><a href="https://github.com/sayanarijit/xplr/releases/tag/v0.13.7">v0.13.7</a> -> <a href="https://github.com/sayanarijit/xplr/releases/tag/v0.14.4">v0.14.4</a></a></h4>
|
||||
<h4 id="a-hrefhttpsgithubcomsayanarijitxplrreleasestagv0137v0137a---a-hrefhttpsgithubcomsayanarijitxplrreleasestagv0145v0145a"><a class="header" href="#a-hrefhttpsgithubcomsayanarijitxplrreleasestagv0137v0137a---a-hrefhttpsgithubcomsayanarijitxplrreleasestagv0145v0145a"><a href="https://github.com/sayanarijit/xplr/releases/tag/v0.13.7">v0.13.7</a> -> <a href="https://github.com/sayanarijit/xplr/releases/tag/v0.14.5">v0.14.5</a></a></h4>
|
||||
<ul>
|
||||
<li>macOS users need to place their config file (<code>init.lua</code>) in
|
||||
<code>$HOME/.config/xplr/</code> or <code>/etc/xplr/</code>.</li>
|
||||
|
Loading…
Reference in New Issue
Block a user