wiki-plugin-mech 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ReadMe.md +13 -0
- package/client/mech.js +120 -0
- package/factory.json +5 -0
- package/package.json +42 -0
- package/pages/about-mech-plugin +325 -0
- package/pages/catalog-of-mech-blocks +55 -0
- package/server/server.js +17 -0
package/ReadMe.md
ADDED
package/client/mech.js
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
|
|
2
|
+
(function() {
|
|
3
|
+
|
|
4
|
+
function expand(text) {
|
|
5
|
+
return text
|
|
6
|
+
.replace(/&/g, '&')
|
|
7
|
+
.replace(/</g, '<')
|
|
8
|
+
.replace(/>/g, '>')
|
|
9
|
+
.replace(/\*(.+?)\*/g, '<i>$1</i>')
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// https://github.com/dobbs/wiki-plugin-graphviz/blob/main/client/graphviz.js#L86-L103
|
|
13
|
+
function tree(lines, here, indent) {
|
|
14
|
+
while (lines.length) {
|
|
15
|
+
let m = lines[0].match(/( *)(.*)/)
|
|
16
|
+
let spaces = m[1].length
|
|
17
|
+
let command = m[2]
|
|
18
|
+
if (spaces == indent) {
|
|
19
|
+
here.push({command})
|
|
20
|
+
lines.shift()
|
|
21
|
+
} else if (spaces > indent) {
|
|
22
|
+
var more = []
|
|
23
|
+
here.push(more)
|
|
24
|
+
tree(lines, more, spaces)
|
|
25
|
+
} else {
|
|
26
|
+
return here
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return here
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function format(nest,index) {
|
|
33
|
+
const unique = Math.floor(Math.random()*1000000)
|
|
34
|
+
const block = (more,path) => {
|
|
35
|
+
const html = []
|
|
36
|
+
for (part of more) {
|
|
37
|
+
const key = `${unique}.${path.join('.')}`
|
|
38
|
+
index[key] = part
|
|
39
|
+
part.key = key
|
|
40
|
+
if(part.command)
|
|
41
|
+
html.push(`<span id=${key}>${expand(part.command)}</span>`)
|
|
42
|
+
else
|
|
43
|
+
html.push(`<div id=${key} style="padding-left:15px">${block(part,[...path,0])}</div> `)
|
|
44
|
+
path[path.length-1]++
|
|
45
|
+
}
|
|
46
|
+
return html.join("<br>\n")
|
|
47
|
+
}
|
|
48
|
+
return block(nest,[0])
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function click_emit (elem) {
|
|
52
|
+
const body = this
|
|
53
|
+
console.log({body,elem})
|
|
54
|
+
if (!body.length && !elem.innerHTML.match(/button/)) {
|
|
55
|
+
console.log('trouble')
|
|
56
|
+
elem.innerHTML += '<button style="border-width:0;color:red;" title="nothing to run">✖︎</button>'
|
|
57
|
+
} else
|
|
58
|
+
if (!elem.innerHTML.match(/button/)) {
|
|
59
|
+
elem.innerHTML += '<button style="border-width:0;">◉</button>'
|
|
60
|
+
elem.querySelector('button').addEventListener('click',event => run(this))
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function click_bind (elem) {
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function hello_emit (elem,what) {
|
|
68
|
+
const want = what == 'world' ? ' 🌎' : ' 😀'
|
|
69
|
+
elem.innerHTML += want
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function hello_bind (elem) {
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const blocks = {
|
|
76
|
+
CLICK: {emit:click_emit, bind:click_bind},
|
|
77
|
+
HELLO: {emit:hello_emit, bind:hello_bind}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function run (nest) {
|
|
81
|
+
console.log({nest})
|
|
82
|
+
const scope = nest.slice()
|
|
83
|
+
while (scope.length) {
|
|
84
|
+
const code = scope.shift()
|
|
85
|
+
if (code.command) {
|
|
86
|
+
const elem = document.getElementById(code.key)
|
|
87
|
+
const [op, ...args] = code.command.split(/ +/)
|
|
88
|
+
const more = scope[0]?.command ? null : scope.shift()
|
|
89
|
+
console.log({op,args,more})
|
|
90
|
+
blocks[op].emit.apply(more||[],[elem,...args])
|
|
91
|
+
} else {
|
|
92
|
+
run(code)
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function emit($item, item) {
|
|
98
|
+
const lines = item.text.split(/\n/)
|
|
99
|
+
const nest = tree(lines,[],0)
|
|
100
|
+
const index = {}
|
|
101
|
+
const html = format(nest,index)
|
|
102
|
+
$item.append(`<div style="background-color:#eee;padding:15px;border-top:8px;">${html}</div>`)
|
|
103
|
+
run(nest,index)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function bind($item, item) {
|
|
107
|
+
return $item.dblclick(() => {
|
|
108
|
+
return wiki.textEditor($item, item);
|
|
109
|
+
})
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (typeof window !== "undefined" && window !== null) {
|
|
113
|
+
window.plugins.mech = {emit, bind}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (typeof module !== "undefined" && module !== null) {
|
|
117
|
+
module.exports = {expand}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
}).call(this)
|
package/factory.json
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "wiki-plugin-mech",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Federated Wiki - Mechanism Scripting Plugin",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"mech",
|
|
7
|
+
"mechansim",
|
|
8
|
+
"scripting",
|
|
9
|
+
"wiki",
|
|
10
|
+
"federated wiki",
|
|
11
|
+
"plugin"
|
|
12
|
+
],
|
|
13
|
+
"author": {
|
|
14
|
+
"name": "Ward Cunningham",
|
|
15
|
+
"email": "ward@c2.com",
|
|
16
|
+
"url": "https://c2.com/ward"
|
|
17
|
+
},
|
|
18
|
+
"contributors": [],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"test": "mocha"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"expect.js": "^0.3.1",
|
|
24
|
+
"grunt": "^1.0.1",
|
|
25
|
+
"grunt-contrib-coffee": "^2.0.0",
|
|
26
|
+
"grunt-contrib-watch": "^1.0.0",
|
|
27
|
+
"grunt-git-authors": "^3.2.0",
|
|
28
|
+
"grunt-mocha-test": "^0.13.2",
|
|
29
|
+
"mocha": "^5.2.0"
|
|
30
|
+
},
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "https://github.com/wardcunningham/wiki-plugin-mech.git"
|
|
35
|
+
},
|
|
36
|
+
"bugs": {
|
|
37
|
+
"url": "https://github.com/wardcunningham/wiki-plugin-mech/issues"
|
|
38
|
+
},
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=0.10"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "About Mech Plugin",
|
|
3
|
+
"story": [
|
|
4
|
+
{
|
|
5
|
+
"type": "paragraph",
|
|
6
|
+
"id": "�3���82�962�����",
|
|
7
|
+
"text": "The Mech plugin allows one to script interactive mechanisms in the style of block languages like Squeak. We use capitalized keywords for blocks and indent them with spaces to show where blocks nest within others."
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"type": "paragraph",
|
|
11
|
+
"id": "aadc413ae00c5c37",
|
|
12
|
+
"text": "Say \"HELLO\" for a friendly greating."
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"type": "mech",
|
|
16
|
+
"id": "7d0dcd7919c2f899",
|
|
17
|
+
"text": "HELLO",
|
|
18
|
+
"alias": "7�b2����ef9�27ac"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"type": "paragraph",
|
|
22
|
+
"id": "567acaf3531aa3ea",
|
|
23
|
+
"text": "Say \"HELLO world\" to great the whole world."
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"type": "mech",
|
|
27
|
+
"id": "7�b2����ef9�27ac",
|
|
28
|
+
"text": "HELLO world"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"type": "paragraph",
|
|
32
|
+
"id": "9e56be61e4552e9a",
|
|
33
|
+
"text": "Say \"CLICK\" to run indented commands only when clicked."
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"type": "mech",
|
|
37
|
+
"id": "0223ec356575839a",
|
|
38
|
+
"text": "CLICK\n HELLO\n HELLO world",
|
|
39
|
+
"alias": "7�b2����ef9�27ac"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"type": "paragraph",
|
|
43
|
+
"id": "0da4de7b855c9a0d",
|
|
44
|
+
"text": "CLICK expects to be followed with indented commands and will complain if it doesn't find any."
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"type": "mech",
|
|
48
|
+
"id": "9a40751dd94dfb43",
|
|
49
|
+
"text": "CLICK\nHELLO",
|
|
50
|
+
"alias": "7�b2����ef9�27ac"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"type": "paragraph",
|
|
54
|
+
"id": "d22aa70fbdde7da0",
|
|
55
|
+
"text": "See the [[Catalog of Mech Blocks]] for more ideas."
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
"journal": [
|
|
59
|
+
{
|
|
60
|
+
"type": "create",
|
|
61
|
+
"item": {
|
|
62
|
+
"title": "About Mech Plugin",
|
|
63
|
+
"story": [
|
|
64
|
+
{
|
|
65
|
+
"type": "paragraph",
|
|
66
|
+
"id": "�3���82�962�����",
|
|
67
|
+
"text": "Here we describe the purpose of the plugin and include a sample."
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"type": "mech",
|
|
71
|
+
"id": "7�b2����ef9�27ac",
|
|
72
|
+
"text": "This is text in the new plugin. You can *double-click* to edit it too."
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
},
|
|
76
|
+
"date": 1716488666000,
|
|
77
|
+
"certificate": "from mkplugin.sh"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"type": "edit",
|
|
81
|
+
"id": "7�b2����ef9�27ac",
|
|
82
|
+
"item": {
|
|
83
|
+
"type": "mech",
|
|
84
|
+
"id": "7�b2����ef9�27ac",
|
|
85
|
+
"text": "HELLO"
|
|
86
|
+
},
|
|
87
|
+
"date": 1716683838652
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"type": "edit",
|
|
91
|
+
"id": "�3���82�962�����",
|
|
92
|
+
"item": {
|
|
93
|
+
"type": "paragraph",
|
|
94
|
+
"id": "�3���82�962�����",
|
|
95
|
+
"text": "The Mech plugin allows one to script interactive mechanisms in the style of block languages like Squeak. We use capitalized keywords for blocks and indent them with spaces to show where blocks nest within others."
|
|
96
|
+
},
|
|
97
|
+
"date": 1716684272077
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"type": "add",
|
|
101
|
+
"id": "d22aa70fbdde7da0",
|
|
102
|
+
"item": {
|
|
103
|
+
"type": "paragraph",
|
|
104
|
+
"id": "d22aa70fbdde7da0",
|
|
105
|
+
"text": "See the [[Catalog of Mech Blocks]]"
|
|
106
|
+
},
|
|
107
|
+
"after": "�3���82�962�����",
|
|
108
|
+
"date": 1716684321178
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"type": "edit",
|
|
112
|
+
"id": "d22aa70fbdde7da0",
|
|
113
|
+
"item": {
|
|
114
|
+
"type": "paragraph",
|
|
115
|
+
"id": "d22aa70fbdde7da0",
|
|
116
|
+
"text": "See the [[Catalog of Mech Blocks]] for more ideas."
|
|
117
|
+
},
|
|
118
|
+
"date": 1716684349332
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"type": "add",
|
|
122
|
+
"id": "aadc413ae00c5c37",
|
|
123
|
+
"item": {
|
|
124
|
+
"type": "paragraph",
|
|
125
|
+
"id": "aadc413ae00c5c37",
|
|
126
|
+
"text": "Say HELLO for a friendly greating."
|
|
127
|
+
},
|
|
128
|
+
"after": "�3���82�962�����",
|
|
129
|
+
"date": 1716684398273
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"id": "7d0dcd7919c2f899",
|
|
133
|
+
"type": "add",
|
|
134
|
+
"item": {
|
|
135
|
+
"type": "mech",
|
|
136
|
+
"id": "7d0dcd7919c2f899",
|
|
137
|
+
"text": "HELLO",
|
|
138
|
+
"alias": "7�b2����ef9�27ac"
|
|
139
|
+
},
|
|
140
|
+
"after": "aadc413ae00c5c37",
|
|
141
|
+
"date": 1716684414784
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"item": {
|
|
145
|
+
"type": "factory",
|
|
146
|
+
"id": "567acaf3531aa3ea"
|
|
147
|
+
},
|
|
148
|
+
"id": "567acaf3531aa3ea",
|
|
149
|
+
"type": "add",
|
|
150
|
+
"after": "7�b2����ef9�27ac",
|
|
151
|
+
"date": 1716684474280
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"type": "edit",
|
|
155
|
+
"id": "567acaf3531aa3ea",
|
|
156
|
+
"item": {
|
|
157
|
+
"type": "paragraph",
|
|
158
|
+
"id": "567acaf3531aa3ea",
|
|
159
|
+
"text": "Say HELLO world to great the whole world."
|
|
160
|
+
},
|
|
161
|
+
"date": 1716684507788
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
"id": "7�b2����ef9�27ac",
|
|
165
|
+
"type": "move",
|
|
166
|
+
"order": [
|
|
167
|
+
"�3���82�962�����",
|
|
168
|
+
"aadc413ae00c5c37",
|
|
169
|
+
"7d0dcd7919c2f899",
|
|
170
|
+
"d22aa70fbdde7da0",
|
|
171
|
+
"567acaf3531aa3ea",
|
|
172
|
+
"7�b2����ef9�27ac"
|
|
173
|
+
],
|
|
174
|
+
"date": 1716684514976
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"type": "edit",
|
|
178
|
+
"id": "7�b2����ef9�27ac",
|
|
179
|
+
"item": {
|
|
180
|
+
"type": "mech",
|
|
181
|
+
"id": "7�b2����ef9�27ac",
|
|
182
|
+
"text": "HELLO world"
|
|
183
|
+
},
|
|
184
|
+
"date": 1716684519493
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"type": "edit",
|
|
188
|
+
"id": "aadc413ae00c5c37",
|
|
189
|
+
"item": {
|
|
190
|
+
"type": "paragraph",
|
|
191
|
+
"id": "aadc413ae00c5c37",
|
|
192
|
+
"text": "Say \"HELLO\" for a friendly greating."
|
|
193
|
+
},
|
|
194
|
+
"date": 1716684535093
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"type": "edit",
|
|
198
|
+
"id": "567acaf3531aa3ea",
|
|
199
|
+
"item": {
|
|
200
|
+
"type": "paragraph",
|
|
201
|
+
"id": "567acaf3531aa3ea",
|
|
202
|
+
"text": "Say \"HELLO world\" to great the whole world."
|
|
203
|
+
},
|
|
204
|
+
"date": 1716684544028
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
"item": {
|
|
208
|
+
"type": "factory",
|
|
209
|
+
"id": "9e56be61e4552e9a"
|
|
210
|
+
},
|
|
211
|
+
"id": "9e56be61e4552e9a",
|
|
212
|
+
"type": "add",
|
|
213
|
+
"after": "7�b2����ef9�27ac",
|
|
214
|
+
"date": 1716684568232
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"type": "edit",
|
|
218
|
+
"id": "9e56be61e4552e9a",
|
|
219
|
+
"item": {
|
|
220
|
+
"type": "paragraph",
|
|
221
|
+
"id": "9e56be61e4552e9a",
|
|
222
|
+
"text": "Say \"CLICK\" to run indented commands only when clicked."
|
|
223
|
+
},
|
|
224
|
+
"date": 1716684595412
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
"id": "0223ec356575839a",
|
|
228
|
+
"type": "add",
|
|
229
|
+
"item": {
|
|
230
|
+
"type": "mech",
|
|
231
|
+
"id": "0223ec356575839a",
|
|
232
|
+
"text": "HELLO",
|
|
233
|
+
"alias": "7�b2����ef9�27ac"
|
|
234
|
+
},
|
|
235
|
+
"after": "9e56be61e4552e9a",
|
|
236
|
+
"date": 1716684601922
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"type": "edit",
|
|
240
|
+
"id": "0223ec356575839a",
|
|
241
|
+
"item": {
|
|
242
|
+
"type": "mech",
|
|
243
|
+
"id": "0223ec356575839a",
|
|
244
|
+
"text": "CLICK\n HELLO\n HELLO world",
|
|
245
|
+
"alias": "7�b2����ef9�27ac"
|
|
246
|
+
},
|
|
247
|
+
"date": 1716684627691
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
"id": "d22aa70fbdde7da0",
|
|
251
|
+
"type": "move",
|
|
252
|
+
"order": [
|
|
253
|
+
"�3���82�962�����",
|
|
254
|
+
"aadc413ae00c5c37",
|
|
255
|
+
"7d0dcd7919c2f899",
|
|
256
|
+
"567acaf3531aa3ea",
|
|
257
|
+
"7�b2����ef9�27ac",
|
|
258
|
+
"9e56be61e4552e9a",
|
|
259
|
+
"0223ec356575839a",
|
|
260
|
+
"d22aa70fbdde7da0"
|
|
261
|
+
],
|
|
262
|
+
"date": 1716684663443
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
"type": "add",
|
|
266
|
+
"id": "0da4de7b855c9a0d",
|
|
267
|
+
"item": {
|
|
268
|
+
"type": "paragraph",
|
|
269
|
+
"id": "0da4de7b855c9a0d",
|
|
270
|
+
"text": "CLICK expects to be followed with indented commands and will complain if it doesn't find any. Hover for the error message."
|
|
271
|
+
},
|
|
272
|
+
"after": "9e56be61e4552e9a",
|
|
273
|
+
"date": 1716684726522
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
"type": "edit",
|
|
277
|
+
"id": "0da4de7b855c9a0d",
|
|
278
|
+
"item": {
|
|
279
|
+
"type": "paragraph",
|
|
280
|
+
"id": "0da4de7b855c9a0d",
|
|
281
|
+
"text": "CLICK expects to be followed with indented commands and will complain if it doesn't find any."
|
|
282
|
+
},
|
|
283
|
+
"date": 1716684736166
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
"id": "0da4de7b855c9a0d",
|
|
287
|
+
"type": "move",
|
|
288
|
+
"order": [
|
|
289
|
+
"�3���82�962�����",
|
|
290
|
+
"aadc413ae00c5c37",
|
|
291
|
+
"7d0dcd7919c2f899",
|
|
292
|
+
"567acaf3531aa3ea",
|
|
293
|
+
"7�b2����ef9�27ac",
|
|
294
|
+
"9e56be61e4552e9a",
|
|
295
|
+
"0223ec356575839a",
|
|
296
|
+
"0da4de7b855c9a0d",
|
|
297
|
+
"d22aa70fbdde7da0"
|
|
298
|
+
],
|
|
299
|
+
"date": 1716684740993
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
"id": "9a40751dd94dfb43",
|
|
303
|
+
"type": "add",
|
|
304
|
+
"item": {
|
|
305
|
+
"type": "mech",
|
|
306
|
+
"id": "9a40751dd94dfb43",
|
|
307
|
+
"text": "HELLO",
|
|
308
|
+
"alias": "7�b2����ef9�27ac"
|
|
309
|
+
},
|
|
310
|
+
"after": "0da4de7b855c9a0d",
|
|
311
|
+
"date": 1716684744388
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
"type": "edit",
|
|
315
|
+
"id": "9a40751dd94dfb43",
|
|
316
|
+
"item": {
|
|
317
|
+
"type": "mech",
|
|
318
|
+
"id": "9a40751dd94dfb43",
|
|
319
|
+
"text": "CLICK\nHELLO",
|
|
320
|
+
"alias": "7�b2����ef9�27ac"
|
|
321
|
+
},
|
|
322
|
+
"date": 1716684753588
|
|
323
|
+
}
|
|
324
|
+
]
|
|
325
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "Catalog of Mech Blocks",
|
|
3
|
+
"story": [
|
|
4
|
+
{
|
|
5
|
+
"type": "paragraph",
|
|
6
|
+
"id": "2802ed0bdf73bd98",
|
|
7
|
+
"text": "Our work here is just beginning."
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"type": "paragraph",
|
|
11
|
+
"id": "fc6c61ba9968734b",
|
|
12
|
+
"text": "There are no more blocks yet other than CLICK and HELLO."
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
"journal": [
|
|
16
|
+
{
|
|
17
|
+
"type": "create",
|
|
18
|
+
"item": {
|
|
19
|
+
"title": "Catalog of Mech Blocks",
|
|
20
|
+
"story": []
|
|
21
|
+
},
|
|
22
|
+
"date": 1716684800514
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"item": {
|
|
26
|
+
"type": "factory",
|
|
27
|
+
"id": "2802ed0bdf73bd98"
|
|
28
|
+
},
|
|
29
|
+
"id": "2802ed0bdf73bd98",
|
|
30
|
+
"type": "add",
|
|
31
|
+
"date": 1716684802651
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"type": "edit",
|
|
35
|
+
"id": "2802ed0bdf73bd98",
|
|
36
|
+
"item": {
|
|
37
|
+
"type": "paragraph",
|
|
38
|
+
"id": "2802ed0bdf73bd98",
|
|
39
|
+
"text": "Our work here is just beginning."
|
|
40
|
+
},
|
|
41
|
+
"date": 1716684821373
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"type": "add",
|
|
45
|
+
"id": "fc6c61ba9968734b",
|
|
46
|
+
"item": {
|
|
47
|
+
"type": "paragraph",
|
|
48
|
+
"id": "fc6c61ba9968734b",
|
|
49
|
+
"text": "There are no more blocks yet other than CLICK and HELLO."
|
|
50
|
+
},
|
|
51
|
+
"after": "2802ed0bdf73bd98",
|
|
52
|
+
"date": 1716684839583
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
}
|
package/server/server.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// mech plugin, server-side component
|
|
2
|
+
// These handlers are launched with the wiki server.
|
|
3
|
+
|
|
4
|
+
(function() {
|
|
5
|
+
function startServer(params) {
|
|
6
|
+
var app = params.app,
|
|
7
|
+
argv = params.argv
|
|
8
|
+
|
|
9
|
+
return app.get('/plugin/mech/:thing', (req, res) => {
|
|
10
|
+
var thing = req.params.thing;
|
|
11
|
+
return res.json({thing});
|
|
12
|
+
})
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
module.exports = {startServer}
|
|
16
|
+
|
|
17
|
+
}).call(this)
|