mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
spaces instead of tabs
This commit is contained in:
parent
e06d831d97
commit
0ccf16d589
2 changed files with 168 additions and 168 deletions
|
@ -1,73 +1,73 @@
|
||||||
{% capture logo_path %}{{ site.logo }}{% endcapture %}
|
{% capture logo_path %}{{ site.logo }}{% endcapture %}
|
||||||
|
|
||||||
<div class="masthead">
|
<div class="masthead">
|
||||||
<div class="masthead__inner-wrap">
|
<div class="masthead__inner-wrap">
|
||||||
<div class="masthead__menu">
|
<div class="masthead__menu">
|
||||||
<nav id="site-nav" class="greedy-nav">
|
<nav id="site-nav" class="greedy-nav">
|
||||||
{% unless logo_path == empty %}
|
{% unless logo_path == empty %}
|
||||||
<a class="site-logo" href="{{ '/' | relative_url }}"><img src="{{ logo_path | relative_url }}"
|
<a class="site-logo" href="{{ '/' | relative_url }}"><img src="{{ logo_path | relative_url }}"
|
||||||
alt="{{ site.masthead_title | default: site.title }}"></a>
|
alt="{{ site.masthead_title | default: site.title }}"></a>
|
||||||
{% endunless %}
|
{% endunless %}
|
||||||
<a class="site-title" href="{{ '/' | relative_url }}">
|
<a class="site-title" href="{{ '/' | relative_url }}">
|
||||||
{{ site.masthead_title | default: site.title }}
|
{{ site.masthead_title | default: site.title }}
|
||||||
{% if site.subtitle %}<span class="site-subtitle">{{ site.subtitle }}</span>{% endif %}
|
{% if site.subtitle %}<span class="site-subtitle">{{ site.subtitle }}</span>{% endif %}
|
||||||
</a>
|
</a>
|
||||||
<ul class="visible-links">
|
<ul class="visible-links">
|
||||||
{%- for link in site.data.navigation.main -%}
|
{%- for link in site.data.navigation.main -%}
|
||||||
<li class="masthead__menu-item">
|
<li class="masthead__menu-item">
|
||||||
<a href="{{ link.url | relative_url }}" {% if link.description %} title="{{ link.description }}"
|
<a href="{{ link.url | relative_url }}" {% if link.description %} title="{{ link.description }}"
|
||||||
{% endif %}>{{ link.title }}</a>
|
{% endif %}>{{ link.title }}</a>
|
||||||
</li>
|
</li>
|
||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
</ul>
|
</ul>
|
||||||
<i class="fas fa-fw fa-adjust" aria-hidden="true" onclick="toggleTheme()"></i>
|
<i class="fas fa-fw fa-adjust" aria-hidden="true" onclick="toggleTheme()"></i>
|
||||||
{% if site.search == true %}
|
{% if site.search == true %}
|
||||||
<button class="search__toggle" type="button">
|
<button class="search__toggle" type="button">
|
||||||
<span class="visually-hidden">{{ site.data.ui-text[site.locale].search_label | default: "Toggle
|
<span class="visually-hidden">{{ site.data.ui-text[site.locale].search_label | default: "Toggle
|
||||||
search" }}</span>
|
search" }}</span>
|
||||||
<i class="fas fa-search"></i>
|
<i class="fas fa-search"></i>
|
||||||
</button>
|
</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<button class="greedy-nav__toggle hidden" type="button">
|
<button class="greedy-nav__toggle hidden" type="button">
|
||||||
<span class="visually-hidden">{{ site.data.ui-text[site.locale].menu_label | default: "Toggle menu"
|
<span class="visually-hidden">{{ site.data.ui-text[site.locale].menu_label | default: "Toggle menu"
|
||||||
}}</span>
|
}}</span>
|
||||||
<div class="navicon"></div>
|
<div class="navicon"></div>
|
||||||
</button>
|
</button>
|
||||||
<ul class="hidden-links hidden"></ul>
|
<ul class="hidden-links hidden"></ul>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<link rel="stylesheet" href="{{ '/assets/css/main.css' | relative_url }}" id="theme_source">
|
<link rel="stylesheet" href="{{ '/assets/css/main.css' | relative_url }}" id="theme_source">
|
||||||
<link rel="stylesheet alternate" href="{{ '/assets/css/theme2.css' | relative_url }}" id="theme_source_2">
|
<link rel="stylesheet alternate" href="{{ '/assets/css/theme2.css' | relative_url }}" id="theme_source_2">
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
let theme = localStorage.getItem('theme');
|
let theme = localStorage.getItem('theme');
|
||||||
if (theme === "dark") {
|
if (theme === "dark") {
|
||||||
localStorage.setItem('theme', 'dark');
|
localStorage.setItem('theme', 'dark');
|
||||||
node1 = document.getElementById('theme_source');
|
node1 = document.getElementById('theme_source');
|
||||||
node2 = document.getElementById('theme_source_2');
|
node2 = document.getElementById('theme_source_2');
|
||||||
node1.setAttribute('rel', 'stylesheet alternate');
|
node1.setAttribute('rel', 'stylesheet alternate');
|
||||||
node2.setAttribute('rel', 'stylesheet');
|
node2.setAttribute('rel', 'stylesheet');
|
||||||
} else {
|
} else {
|
||||||
localStorage.setItem('theme', 'light');
|
localStorage.setItem('theme', 'light');
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleTheme() {
|
function toggleTheme() {
|
||||||
node1 = document.getElementById("theme_source");
|
node1 = document.getElementById("theme_source");
|
||||||
node2 = document.getElementById("theme_source_2");
|
node2 = document.getElementById("theme_source_2");
|
||||||
if (node1.getAttribute("rel") == "stylesheet") {
|
if (node1.getAttribute("rel") == "stylesheet") {
|
||||||
node1.setAttribute("rel", "stylesheet alternate");
|
node1.setAttribute("rel", "stylesheet alternate");
|
||||||
node2.setAttribute("rel", "stylesheet");
|
node2.setAttribute("rel", "stylesheet");
|
||||||
try { editor.setOption("theme", "dark") } catch { };
|
try { editor.setOption("theme", "dark") } catch { };
|
||||||
localStorage.setItem("theme", "dark");
|
localStorage.setItem("theme", "dark");
|
||||||
} else {
|
} else {
|
||||||
node2.setAttribute("rel", "stylesheet alternate");
|
node2.setAttribute("rel", "stylesheet alternate");
|
||||||
node1.setAttribute("rel", "stylesheet");
|
node1.setAttribute("rel", "stylesheet");
|
||||||
try { editor.setOption("theme", "light") } catch { };
|
try { editor.setOption("theme", "light") } catch { };
|
||||||
localStorage.setItem("theme", "light");
|
localStorage.setItem("theme", "light");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
|
@ -1,35 +1,35 @@
|
||||||
<form>
|
<form>
|
||||||
<div>
|
<div>
|
||||||
<label class="header-center"><b>Input</b></label>
|
<label class="header-center"><b>Input</b></label>
|
||||||
<br>
|
<br>
|
||||||
<textarea rows="10" cols="80" id="script"></textarea>
|
<textarea rows="10" cols="80" id="script"></textarea>
|
||||||
<div class="button-group">
|
<div class="button-group">
|
||||||
<button onclick="executeScript(); return false;" class="demo-button">Run</button>
|
<button onclick="executeScript(); return false;" class="demo-button">Run</button>
|
||||||
<label for="output-clear">Clear Output</label>
|
<label for="output-clear">Clear Output</label>
|
||||||
<input type="checkbox" checked="true" id="output-clear" />
|
<input type="checkbox" checked="true" id="output-clear" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label class="header-center"><b>Output</b></label>
|
<label class="header-center"><b>Output</b></label>
|
||||||
<br>
|
<br>
|
||||||
<textarea readonly rows="10" cols="70" id="output"></textarea>
|
<textarea readonly rows="10" cols="70" id="output"></textarea>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<!-- Styles for editor -->
|
<!-- Styles for editor -->
|
||||||
<style>
|
<style>
|
||||||
.header-center {
|
.header-center {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.demo-button {
|
.demo-button {
|
||||||
padding: 7px 7px;
|
padding: 7px 7px;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
.line-error {
|
.line-error {
|
||||||
background: #e65f55;
|
background: #e65f55;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<!-- CodeMirror -->
|
<!-- CodeMirror -->
|
||||||
|
@ -39,49 +39,49 @@
|
||||||
|
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.cm-s-dark.CodeMirror {background: rgb(37, 37, 37); color: rgb(204, 204, 204);}
|
.cm-s-dark.CodeMirror {background: rgb(37, 37, 37); color: rgb(204, 204, 204);}
|
||||||
.cm-s-dark div.CodeMirror-selected {background: rgb(11, 90, 175) !important;}
|
.cm-s-dark div.CodeMirror-selected {background: rgb(11, 90, 175) !important;}
|
||||||
.cm-s-dark .CodeMirror-gutters {background: rgb(50, 50, 50); border-right: 0px;}
|
.cm-s-dark .CodeMirror-gutters {background: rgb(50, 50, 50); border-right: 0px;}
|
||||||
.cm-s-dark .CodeMirror-linenumber {color: rgb(204, 204, 204);}
|
.cm-s-dark .CodeMirror-linenumber {color: rgb(204, 204, 204);}
|
||||||
.cm-s-dark .CodeMirror-cursor {border-left: 1px solid rgb(204, 204, 204) !important;}
|
.cm-s-dark .CodeMirror-cursor {border-left: 1px solid rgb(204, 204, 204) !important;}
|
||||||
|
|
||||||
.cm-s-dark span.cm-comment {color: rgb(102, 102, 102);}
|
.cm-s-dark span.cm-comment {color: rgb(102, 102, 102);}
|
||||||
.cm-s-dark span.cm-atom {color: rgb(255, 198, 0);}
|
.cm-s-dark span.cm-atom {color: rgb(255, 198, 0);}
|
||||||
.cm-s-dark span.cm-number {color: rgb(255, 198, 0);}
|
.cm-s-dark span.cm-number {color: rgb(255, 198, 0);}
|
||||||
|
|
||||||
.cm-s-dark span.cm-keyword {color: rgb(248, 109, 124);}
|
.cm-s-dark span.cm-keyword {color: rgb(248, 109, 124);}
|
||||||
.cm-s-dark span.cm-string {color: rgb(173, 241, 149);}
|
.cm-s-dark span.cm-string {color: rgb(173, 241, 149);}
|
||||||
|
|
||||||
.cm-s-dark span.cm-variable {color: rgb(204, 204, 204);}
|
.cm-s-dark span.cm-variable {color: rgb(204, 204, 204);}
|
||||||
.cm-s-dark span.cm-builtin {color:rgb(132, 214, 247);}
|
.cm-s-dark span.cm-builtin {color:rgb(132, 214, 247);}
|
||||||
.cm-s-dark span.cm-bracket {color: rgb(204, 204, 204);}
|
.cm-s-dark span.cm-bracket {color: rgb(204, 204, 204);}
|
||||||
.cm-s-dark span.cm-tag {color: rgb(255, 0, 0);}
|
.cm-s-dark span.cm-tag {color: rgb(255, 0, 0);}
|
||||||
|
|
||||||
.cm-s-dark .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;}
|
.cm-s-dark .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;}
|
||||||
.cm-s-dark .CodeMirror-activeline-background { background: #202020; }
|
.cm-s-dark .CodeMirror-activeline-background { background: #202020; }
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.cm-s-light.CodeMirror {background: white; color: black;}
|
.cm-s-light.CodeMirror {background: white; color: black;}
|
||||||
.cm-s-light div.CodeMirror-selected {background: rgb(110, 161, 241) !important;}
|
.cm-s-light div.CodeMirror-selected {background: rgb(110, 161, 241) !important;}
|
||||||
.cm-s-light .CodeMirror-gutters {background: rgb(221, 221, 221); border-right: 0px;}
|
.cm-s-light .CodeMirror-gutters {background: rgb(221, 221, 221); border-right: 0px;}
|
||||||
.cm-s-light .CodeMirror-linenumber {color: black;}
|
.cm-s-light .CodeMirror-linenumber {color: black;}
|
||||||
.cm-s-light .CodeMirror-cursor {border-left: 1px solid black !important;}
|
.cm-s-light .CodeMirror-cursor {border-left: 1px solid black !important;}
|
||||||
|
|
||||||
.cm-s-light span.cm-comment {color: rgb(0, 127, 9);}
|
.cm-s-light span.cm-comment {color: rgb(0, 127, 9);}
|
||||||
.cm-s-light span.cm-atom {color: rgb(0, 127, 127);}
|
.cm-s-light span.cm-atom {color: rgb(0, 127, 127);}
|
||||||
.cm-s-light span.cm-number {color: rgb(0, 127, 127);}
|
.cm-s-light span.cm-number {color: rgb(0, 127, 127);}
|
||||||
|
|
||||||
.cm-s-light span.cm-keyword {color: rgb(0, 0, 127);}
|
.cm-s-light span.cm-keyword {color: rgb(0, 0, 127);}
|
||||||
.cm-s-light span.cm-string {color: rgb(127, 0, 127);}
|
.cm-s-light span.cm-string {color: rgb(127, 0, 127);}
|
||||||
|
|
||||||
.cm-s-light span.cm-variable {color: black;}
|
.cm-s-light span.cm-variable {color: black;}
|
||||||
.cm-s-light span.cm-builtin {color:rgb(127, 0, 0);}
|
.cm-s-light span.cm-builtin {color:rgb(127, 0, 0);}
|
||||||
.cm-s-light span.cm-bracket {color: rgb(127, 127, 0);}
|
.cm-s-light span.cm-bracket {color: rgb(127, 127, 0);}
|
||||||
.cm-s-light span.cm-tag {color: rgb(255, 0, 0);}
|
.cm-s-light span.cm-tag {color: rgb(255, 0, 0);}
|
||||||
|
|
||||||
.cm-s-light .CodeMirror-matchingbracket { text-decoration: underline; color: black !important;}
|
.cm-s-light .CodeMirror-matchingbracket { text-decoration: underline; color: black !important;}
|
||||||
.cm-s-light .CodeMirror-activeline-background { background: #202020; }
|
.cm-s-light .CodeMirror-activeline-background { background: #202020; }
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<!-- Luau Parser for CodeMirror -->
|
<!-- Luau Parser for CodeMirror -->
|
||||||
|
@ -89,62 +89,62 @@
|
||||||
<!-- CodeMirror Luau Editor (MUST BE LOADED AFTER CODEMIRROR!) -->
|
<!-- CodeMirror Luau Editor (MUST BE LOADED AFTER CODEMIRROR!) -->
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
var editor = CodeMirror.fromTextArea(document.getElementById("script"), {
|
var editor = CodeMirror.fromTextArea(document.getElementById("script"), {
|
||||||
theme: localStorage.getItem('theme'),
|
theme: localStorage.getItem('theme'),
|
||||||
mode: "luau",
|
mode: "luau",
|
||||||
matchBrackets: true,
|
matchBrackets: true,
|
||||||
lineNumbers: true,
|
lineNumbers: true,
|
||||||
smartIndent: true,
|
smartIndent: true,
|
||||||
indentWithTabs: true,
|
indentWithTabs: true,
|
||||||
indentUnit: 4
|
indentUnit: 4
|
||||||
});
|
});
|
||||||
editor.setValue("print(\"Hello World!\")\n");
|
editor.setValue("print(\"Hello World!\")\n");
|
||||||
editor.addKeyMap({
|
editor.addKeyMap({
|
||||||
"Ctrl-Enter": function (cm) {
|
"Ctrl-Enter": function (cm) {
|
||||||
executeScript();
|
executeScript();
|
||||||
},
|
},
|
||||||
"Shift-Tab": function (cm) {
|
"Shift-Tab": function (cm) {
|
||||||
// dedent functionality
|
// dedent functionality
|
||||||
cm.execCommand("indentLess");
|
cm.execCommand("indentLess");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var lastError = undefined;
|
var lastError = undefined;
|
||||||
|
|
||||||
function output(text) {
|
function output(text) {
|
||||||
var output_box = document.getElementById("output");
|
var output_box = document.getElementById("output");
|
||||||
output_box.value += text + "\n";
|
output_box.value += text + "\n";
|
||||||
// scroll to bottom
|
// scroll to bottom
|
||||||
output_box.scrollTop = output_box.scrollHeight;
|
output_box.scrollTop = output_box.scrollHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
var Module = {
|
var Module = {
|
||||||
'print': function (msg) { output(msg) }
|
'print': function (msg) { output(msg) }
|
||||||
};
|
};
|
||||||
|
|
||||||
function executeScript() {
|
function executeScript() {
|
||||||
if (lastError) {
|
if (lastError) {
|
||||||
editor.removeLineClass(lastError, "background", "line-error");
|
editor.removeLineClass(lastError, "background", "line-error");
|
||||||
lastError = undefined;
|
lastError = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
var output_clear = document.getElementById("output-clear");
|
var output_clear = document.getElementById("output-clear");
|
||||||
if (output_clear.checked) {
|
if (output_clear.checked) {
|
||||||
var output_box = document.getElementById("output");
|
var output_box = document.getElementById("output");
|
||||||
output_box.value = '';
|
output_box.value = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
var err = Module.ccall('executeScript', 'string', ['string'], [editor.getValue()]);
|
var err = Module.ccall('executeScript', 'string', ['string'], [editor.getValue()]);
|
||||||
if (err) {
|
if (err) {
|
||||||
var err_text = err.replace('stdin:', '');
|
var err_text = err.replace('stdin:', '');
|
||||||
output('Error:' + err_text);
|
output('Error:' + err_text);
|
||||||
|
|
||||||
var err_line = parseInt(err_text);
|
var err_line = parseInt(err_text);
|
||||||
if (err_line) {
|
if (err_line) {
|
||||||
lastError = editor.addLineClass(err_line - 1, "background", "line-error");
|
lastError = editor.addLineClass(err_line - 1, "background", "line-error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<!-- Luau WASM (async fetch; should be the last line) -->
|
<!-- Luau WASM (async fetch; should be the last line) -->
|
||||||
|
|
Loading…
Add table
Reference in a new issue