Skip to content

Commit 5b269c9

Browse files
authored
🚀 Add Structures Template (#27)
1 parent 0df6497 commit 5b269c9

File tree

7 files changed

+66
-20
lines changed

7 files changed

+66
-20
lines changed

‎doc-templates/css/styles.css

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ html {
119119

120120
body {
121121
font-family: "Poppins", sans-serif;
122+
overflow: hidden;
123+
}
124+
125+
#docs-body {
122126
background-color: var(--bg-color);
123127
display: grid;
124128
/*
@@ -256,6 +260,18 @@ a:visited {
256260
color: white;
257261
}
258262

263+
.type-Structure {
264+
border-left: 5px solid rgb(0, 219, 255);
265+
}
266+
267+
.type-Structure .item-type {
268+
color: rgb(0, 219, 255);
269+
}
270+
271+
.type-Structure .item-examples p {
272+
background-color: rgb(0, 219, 255);
273+
}
274+
259275
/* Pattern right section list items */
260276

261277
.item-details:nth-child(1) ul li:nth-child(odd) {
@@ -669,7 +685,7 @@ td ul {
669685

670686

671687
@media (max-width: 1200px) {
672-
body {
688+
#docs-body {
673689
grid-template-columns: 20% minmax(80%, 100%);
674690
}
675691

@@ -712,7 +728,7 @@ td ul {
712728

713729

714730
@media (max-width: 1024px) {
715-
body {
731+
#docs-body {
716732
grid-template-columns: 20% minmax(80%, 100%);
717733
}
718734

@@ -724,7 +740,7 @@ td ul {
724740
}
725741

726742
@media (max-width: 768px) {
727-
body {
743+
#docs-body {
728744
grid-template-columns: 20% minmax(80%, 100%);
729745
}
730746

@@ -751,7 +767,7 @@ td ul {
751767
}
752768

753769
@media (max-width: 550px) {
754-
body {
770+
#docs-body {
755771
grid-template-columns: 0 100%;
756772
}
757773

@@ -1168,7 +1184,7 @@ pre code { /* override styling for code blocks */
11681184

11691185
#cookies-bar {
11701186
position: sticky;
1171-
margin: 0 -8vw;
1187+
margin: 0;
11721188
bottom: 0;
11731189
background-color: #353535;
11741190
color: white;

‎doc-templates/events.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
<h1 id="nav-title">Events</h1>
22

33
<div id="content">
4+
5+
<p class="box-title-red">Note:</p>
6+
<p class="box-red" style="margin-bottom: 25px;">
7+
You can specify the event priority after each event syntax using the following syntax <code>[with priority (lowest|low|normal|high|highest|monitor)]</code> e.g. <code>on spawn with priority lowest</code>.<br>
8+
Note that not all of the events support event priority feature and they will throw an error.
9+
</p>
10+
411
${generate events desc_full.html}
512
</div>

‎doc-templates/js/main.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ document.querySelectorAll(".new-element").forEach((e) => {
9090
// <> Search Bar
9191
const versionComparePattern = /.*?(\d\.\d(?:\.\d|))(\+|-|).*/gi;
9292
const versionPattern = / ?v(?:ersion|):(\d\.\d(?:\.\d|-(?:beta|alpha|dev)\d*|))(\+|-|)/gi;
93-
const typePattern = / ?t(?:ype|):(condition|expression|type|effect|event|section|effectsection|function)/gi;
93+
const typePattern = / ?t(?:ype|):(\w+)/gi;
9494
const newPattern = / ?is:(new)/gi;
9595
const resultsFoundText = "result(s) found";
9696

@@ -241,7 +241,7 @@ function searchNow(value = "") {
241241
let regex = new RegExp(searchValue, "gi")
242242
let name = document.querySelectorAll(`#${e.id} .item-title h1`)[0].textContent // Syntax Name
243243
let desc = document.querySelectorAll(`#${e.id} .item-description`)[0].textContent // Syntax Desc
244-
let keywords = e.getAttribute("data-keywords")
244+
let keywords = e.getAttribute("data-keywords")
245245
let id = e.id // Syntax ID
246246
let filtersFound = false;
247247

@@ -285,7 +285,7 @@ function searchNow(value = "") {
285285
filtersFound = true
286286

287287
if ((regex.test(pattern.textContent.replaceAll("[ ]", " ")) || regex.test(name) ||
288-
regex.test(desc) || regex.test(keywords) || "#" + id == searchValue || searchValue == "") && filtersFound) { // Replacing '[ ]' will improve some searching cases such as 'off[ ]hand'
288+
regex.test(desc) || regex.test(keywords) || "#" + id.toLowerCase() == searchValue.toLowerCase() || searchValue == "") && filtersFound) { // Replacing '[ ]' will improve some searching cases such as 'off[ ]hand'
289289
pass = true
290290
break; // Performance
291291
}
@@ -390,7 +390,7 @@ if (examples) {
390390

391391
// <> Cookies Accecpt
392392
if (!isCookiesAccepted) {
393-
content.insertAdjacentHTML('beforeend', `<div id="cookies-bar"> <p> We use cookies and local storage to enhance your browsing experience and store github related statistics. By clicking "Accept", you consent to our use of cookies and local storage. </p><div style="padding: 10px; white-space: nowrap;"> <button id="cookies-accept">Accept</button> <button id="cookies-deny">Deny</button> </div></div>`);
393+
document.body.insertAdjacentHTML('beforeend', `<div id="cookies-bar"> <p> We use cookies and local storage to enhance your browsing experience and store github related statistics. By clicking "Accept", you consent to our use of cookies and local storage. </p><div style="padding: 10px; white-space: nowrap;"> <button id="cookies-accept">Accept</button> <button id="cookies-deny">Deny</button> </div></div>`);
394394
}
395395

396396
let cookiesBar = document.querySelector("#cookies-bar");;

‎doc-templates/structures.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<h1 id="nav-title">Structures</h1>
2+
3+
<div id="content">
4+
5+
${generate structures desc_full.html}
6+
</div>

‎doc-templates/template.html

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,20 @@
3535

3636
</head>
3737
<body>
38-
<!-- loaded inside body without defer to fix theme flicker -->
39-
<script src="./js/theme-switcher.js"></script>
40-
41-
${include navbar.html}
42-
<nav id="side-nav">
43-
<div id="nav-contents">
44-
${generate ${pagename} desc_nav.html}
45-
</div>
46-
</nav>
47-
48-
${content}
38+
<div id="docs-body">
39+
<!-- loaded inside body without defer to fix theme flicker -->
40+
<script src="./js/theme-switcher.js"></script>
41+
42+
${include navbar.html}
43+
<nav id="side-nav">
44+
<div id="nav-contents">
45+
${generate ${pagename} desc_nav.html}
46+
</div>
47+
</nav>
48+
49+
${content}
4950

51+
52+
</div>
5053
</body>
5154
</html>

‎doc-templates/templates/desc_full.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,19 @@ <h1 style="display: inline-block">${element.name}</h1> <a href="#${element.id}"
1414
</td>
1515
</tr>
1616

17+
${if structure-required-entrydata}
18+
<tr class="item-details">
19+
<td class="item-table-label">Required Entries:</td>
20+
<td>${element.structure-required-entrydata}</td>
21+
</tr>
22+
23+
${end} ${if structure-optional-entrydata}
24+
<tr class="item-details">
25+
<td class="item-table-label">Optional Entries:</td>
26+
<td>${element.structure-optional-entrydata}</td>
27+
</tr>
28+
29+
${end}
1730
<tr class="item-details">
1831
<td class="item-table-label">Since:</td>
1932
<td>${element.since}</td>

‎doc-templates/templates/navbar.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<a href="effects.html">Effects</a>
1111
<a href="expressions.html">Expressions</a>
1212
<a href="classes.html">Types</a>
13+
<a href="structures.html">Structures</a>
1314
<a href="functions.html">Functions</a>
1415
</div>
1516
</div>

0 commit comments

Comments
 (0)