Skip to content

Commit 3a3258f

Browse files
committed
turn revisited inline upgraded
1 parent 438ff14 commit 3a3258f

2 files changed

Lines changed: 13 additions & 7 deletions

File tree

inline/dotpipe.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5470,17 +5470,17 @@ function pipes(elem, stop = false) {
54705470
var index = optsArray.length;
54715471
if (index == 0) {
54725472
// Handle case where no elements are present
5473-
} else if (index >= 1) {
5473+
} else if (index >= 1 && optsArray[0] !== '' | undefined) {
54745474
console.log(optsArray[0])
54755475
// Handle case where only one element is present
54765476
if (document.getElementById(optsArray[0]).hasAttribute("inline")) {
54775477
dotPipe.register();
54785478
dotPipe.runInline(document.getElementById(optsArray[0]).id);
54795479
}
5480-
if (optsArray.length == 1) { }
5481-
else {
5482-
elem.setAttribute("turn", optsArray.slice(0, -1).join(";") + ";" + optsArray[0]);
5483-
}
5480+
const opt = optsArray.shift(); // take first element
5481+
optsArray.push(opt); // push it to the end
5482+
elem.setAttribute("turn", optsArray.join(";")); // re-assign rotated list
5483+
console.log("Next turn:", optsArray[0]);
54845484
}
54855485
}
54865486
if (elem.hasAttribute("x-toggle")) {

inline/index.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,19 @@
55
"></div>
66
<div id="outputDiv"></div>
77

8-
<button id="run" turn="example">Show Greeting</button>
8+
<button id="run" turn="example;example1">Show Greeting</button>
9+
<div id="example1" inline="
10+
|&greeting:Is this necessary?
11+
|$outputDiv1:!greeting
12+
|%shout:[!greeting]
13+
"></div>
14+
<div id="outputDiv1"></div>
915

1016
<script src="./inline/dotpipe.js"></script>
1117

1218
<script>
1319
function shout(text) {
14-
console.log('Shout:', text.toUpperCase());
20+
console.log('Shout:', text);
1521
return text;
1622
}
1723

0 commit comments

Comments
 (0)