Skip to content

Commit d01a5ae

Browse files
committed
Codex bug fixes
1 parent 4c1fd2b commit d01a5ae

File tree

2 files changed

+32
-21
lines changed

2 files changed

+32
-21
lines changed

resources/ecs/codex

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
variable Data
6767
variable Payload
6868
variable ECPayload
69+
variable Size
6970
variable A
7071
variable B
7172
variable V
@@ -784,7 +785,7 @@ SHP4:
784785
end
785786
return
786787

787-
ProcessMarkdown:
788+
ProcessMarkdown: ! TODO Count the links & set up listeners
788789
on DecoratorCallback go to Decorate
789790
put 0 into LinkCount
790791
set the content of HelpPanel to showdown decode Script with DecoratorCallback
@@ -798,8 +799,8 @@ ProcessMarkdown:
798799
end
799800
on click Link
800801
begin
801-
put attribute `data-id` of Link into Data
802-
end
802+
put attribute `data-id` of Link into Step
803+
goto ShowHelpPage
803804
end
804805
return
805806

@@ -831,6 +832,32 @@ Decorate:
831832
begin
832833
put `<button id="copy">Copy to editor</button>` into Payload
833834
end
835+
else if left 5 of Payload is `icon:`
836+
begin
837+
put from 5 of Payload into Payload
838+
put the position of `:` in Payload into N
839+
put left N of Payload into Name
840+
add 1 to N
841+
put from N of Payload into Payload
842+
put the position of `:` in Payload into N
843+
put left N of Payload into Size
844+
add 1 to N
845+
put from N of Payload into Payload
846+
put `<img src="resources/icon/` cat Name
847+
cat `.png" style="width:` cat Size cat `;height:` cat Size
848+
cat `" title="` cat Payload cat `" />` into Payload
849+
end
850+
else if left 5 of Payload is `link:`
851+
begin
852+
put from 5 of Payload into Payload
853+
put the position of `:` in Payload into N
854+
put left N of Payload into Data
855+
add 1 to N
856+
put from N of Payload into Payload
857+
put `<b><a href="" id="ec-link-` cat LinkCount cat `" data-id="` cat Data cat `">`
858+
cat Payload cat `</a></b>` into Payload
859+
add 1 to LinkCount
860+
end
834861
else if left 5 of Payload is `next:`
835862
begin
836863
put `<h2>Next: <a href="#" id="next">` cat from 5 of Payload into Payload

resources/ecs/showdown

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
script Showdown
1+
script Showdown
22

33
import div Container
44

55
callback DecoratorCallback
66
a Link
77
variable Markup
88
variable Payload
9-
variable LinkCount
10-
variable Index
119
variable Data
1210
variable ECPayload
1311

@@ -19,21 +17,7 @@
1917
on message
2018
begin
2119
put the message into Markup
22-
put 0 into LinkCount
2320
set the content of Container to showdown decode Markup with DecoratorCallback
24-
set the elements of Link to LinkCount
25-
put 0 into Index
26-
while Index is less than LinkCount
27-
begin
28-
index Link to Index
29-
attach Link to `ec-link-` cat Index
30-
add 1 to Index
31-
end
32-
on click Link
33-
begin
34-
put attribute `data-id` of Link into Data
35-
send Data to parent
36-
end
3721
end
3822
set ready
3923
stop
@@ -42,4 +26,4 @@ Decorate:
4226
put the payload of DecoratorCallback into Payload
4327
if Payload is `ec` put ECPayload into Payload
4428
set the payload of DecoratorCallback to Payload
45-
stop
29+
stop

0 commit comments

Comments
 (0)