Skip to content

Commit 7ce5b79

Browse files
committed
Merge branch 'gh-pages' of https://github.com/LivelyKernel/lively4-core into gh-pages
2 parents b47a7db + 7314eed commit 7ce5b79

33 files changed

+774
-135
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-18.04
8+
steps:
9+
- name: Clone lively4-core repository
10+
uses: actions/checkout@v2
11+
- name: Use Node.js 0.11
12+
uses: actions/setup-node@v1
13+
with:
14+
node-version: 0.11
15+
- run: npm install
16+
- run: xvfb-run npm test

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
# An Explorative, Self-supporting, Web-based Development Environment
44

5-
[![Build Status](https://travis-ci.org/LivelyKernel/lively4-core.svg)](https://travis-ci.org/LivelyKernel/lively4-core)
5+
[![Build Status](https://travis-ci.org/LivelyKernel/lively4-core.svg)](https://travis-ci.org/LivelyKernel/lively4-core) [![Build Status Github](https://github.com/LivelyKernel/lively4-core/workflows/CI/badge.svg)](https://github.com/LivelyKernel/lively4-core/actions?query=workflow%3ACI)
6+
67

78
## Getting Started{style="clear:both"}
89

@@ -17,7 +18,7 @@ A project or branch of a project on GitHub can be checked out in multiple direct
1718
- [lively4-jens](https://lively-kernel.org/lively4/lively4-jens/start.html)
1819
- ...
1920

20-
The Livel4 server and GitHub sync tools can check out arbitrary projects, such as the code of [lively4-server](https://lively-kernel.org/lively4/lively4-server/) itself, or the source of a paper hosted by overleaf.
21+
The Lively4 server and GitHub sync tools can check out arbitrary projects, such as the code of [lively4-server](https://lively-kernel.org/lively4/lively4-server/) itself, or the source of a paper hosted by overleaf.
2122

2223
## Authors / Contributors
2324

[object Object]

213 KB
Binary file not shown.

demos/bibliographie/leoUIexample.js

Lines changed: 95 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const exampleQueries = [
2121
]
2222

2323

24-
function createUILayer(object, key) {
24+
/*function createUILayer(object, key) {
2525
var subDiv = <div id="innerDiv" style="margin: 5px; border: 1px solid gray;">{key}</div>;
2626
var valueOrObject = object[key];
2727
if (typeof(valueOrObject) == "object") {
@@ -33,6 +33,33 @@ function createUILayer(object, key) {
3333
subDiv.appendChild(input);
3434
}
3535
return subDiv;
36+
}*/
37+
38+
function parseQuery(object) {
39+
var subDiv = <div id="innerDiv" style="margin: 5px; border: 1px solid gray;"></div>;
40+
41+
switch(object.type) {
42+
case "simple":
43+
[object.attribute, object.comparator, object.value].forEach(value => {
44+
var input = <input value={value}></input>;
45+
subDiv.appendChild(input)
46+
});
47+
break;
48+
case "conjunction":
49+
var input = <input value={object.conjunction}></input>;
50+
var left = parseQuery(object.left);
51+
var right = parseQuery(object.right);
52+
[input, left, right].forEach(element => {
53+
subDiv.appendChild(element);
54+
});
55+
break;
56+
case "composite":
57+
[object.attribute, object.comparator, object.value].forEach(value => {
58+
var input = <input value={value}></input>;
59+
subDiv.appendChild(input)
60+
});
61+
}
62+
return subDiv;
3663
}
3764

3865

@@ -54,12 +81,38 @@ export default class LeoUIExample{
5481

5582
// world.addEventListener('drop', drop);
5683

57-
var g = ohm.grammar('Academic { \n Exp = \n AcademicQuery \n \n AcademicQuery = Attribute Comparator Value -- simple \n | ("And" | "Or") "(" AcademicQuery "," AcademicQuery ")" -- complex \n | "Composite(" CompositeQuery ")" -- composite \n \n CompositeQuery = Attribute "." Attribute Comparator Value -- simple \n | ("And" | "Or") "(" CompositeQuery "," CompositeQuery ")" -- complex \n \n Comparator = \n PartialComparator "="? \n PartialComparator = \n "=" | "<" | ">" \n \n Attribute (an attribute) = \n letter letter? letter? \n \n Value (a value) = \n "\'" alnum* "\'" -- string \n | Number \n | Date \n | ( "[" | "(" ) Number "," Number ( "]" | ")" ) -- numberRange \n | ( "[" | "(" ) Date "," Date ( "]" | ")" ) -- dateRange \n \n Number = \n digit+ \n Date = \n "\'" Number "-" Number "-" Number "\'" \n}');
58-
59-
/*lively.notify(g.match("Composite(And(AA.AuN='mike smith',AA.AfN='harvard university'))").succeeded(), "Composite(And(AA.AuN='mike smith',AA.AfN='harvard university'))");
60-
lively.notify(g.match("And(AA.AuN='mike smith',AA.AfN='harvard university')").succeeded(), "And(AA.AuN='mike smith',AA.AfN='harvard university')");*/
61-
62-
//var queryObject = {};
84+
var g = ohm.grammar(
85+
`Academic {
86+
Exp =
87+
AcademicQuery
88+
89+
AcademicQuery = Attribute Comparator Value -- simple
90+
| ("And" | "Or") "(" AcademicQuery "," AcademicQuery ")" -- complex
91+
| "Composite(" CompositeQuery ")" -- composite
92+
CompositeQuery = Attribute "." Attribute Comparator Value -- simple
93+
| ("And" | "Or") "(" CompositeQuery "," CompositeQuery ")" -- complex
94+
95+
Comparator =
96+
PartialComparator "="?
97+
PartialComparator =
98+
"=" | "<" | ">"
99+
100+
Attribute (an attribute) =
101+
letter letter? letter?
102+
103+
Value (a value) =
104+
"\'" alnum* "\'" -- string
105+
| Number
106+
| Date
107+
| ( "[" | "(" ) Number "," Number ( "]" | ")" ) -- numberRange
108+
| ( "[" | "(" ) Date "," Date ( "]" | ")" ) -- dateRange
109+
110+
Number =
111+
digit+
112+
Date =
113+
"\'" Number "-" Number "-" Number "\'"
114+
}`
115+
);
63116

64117
var s = g.createSemantics();
65118

@@ -70,36 +123,43 @@ export default class LeoUIExample{
70123
},
71124

72125
AcademicQuery_simple: function(attribute, comparator, value) {
73-
return { [attribute.interpret()]: {
74-
"comparator": comparator.interpret(),
75-
"value": value.interpret(),
76-
}}
126+
return {
127+
"attribute" : attribute.interpret(),
128+
"comparator" : comparator.interpret(),
129+
"value" : value.interpret(),
130+
"type" : "simple"
131+
}
77132
},
78133
AcademicQuery_complex: function(conjunction, _1, left, _2, right, _3) {
79-
return {[conjunction.sourceString]: [
80-
left.interpret(),
81-
right.interpret()
82-
]}
134+
return {
135+
"conjunction" : conjunction.sourceString,
136+
"left" : left.interpret(),
137+
"right" : right.interpret(),
138+
"type" : "conjunction"
139+
}
83140
},
84141
AcademicQuery_composite: function(_1, query, _2) {
85142
return query.interpret();
86143
},
87144

88145
CompositeQuery_simple: function(mainAttribute, _, secondaryAttribute, comparator, value) {
89-
return {[mainAttribute.interpret()]:
90-
{[secondaryAttribute.interpret()]:
91-
{
92-
"comparator": comparator.interpret(),
93-
"value": value.interpret(),
94-
}
95-
}
146+
// would it make sense to split main and secondary attribute?
147+
var main = mainAttribute.interpret();
148+
var secondary = secondaryAttribute.interpret();
149+
return {
150+
"attribute" : main + "." + secondary,
151+
"comparator" : comparator.interpret(),
152+
"value" : value.interpret(),
153+
"type" : "composite"
96154
}
97155
},
98156
CompositeQuery_complex: function(conjunction, _1, left, _2, right, _3) {
99-
return {[conjunction.sourceString]: [
100-
left.interpret(),
101-
right.interpret()
102-
]}
157+
return {
158+
"conjunction" : conjunction.sourceString,
159+
"left" : left.interpret(),
160+
"right" : right.interpret(),
161+
"type" : "conjunction"
162+
}
103163
},
104164

105165
Comparator: function(main, secondary) {
@@ -120,7 +180,6 @@ export default class LeoUIExample{
120180
return string.sourceString;
121181
},
122182
Value_numberRange: function(leftBracket, nLeft, _, nRight, rightBracket) {
123-
// TODO: refactor
124183
return "TODO";//arguments.map(a => {a.sourceString}).join('');
125184
},
126185
Value_dateRange: function(leftBracket, dLeft, _, dRight, rightBracket) {
@@ -169,60 +228,21 @@ export default class LeoUIExample{
169228
// event.target.appendChild(lively.query(this, '#'+data))
170229
// }
171230

172-
var query = "Ti='indexing by latent seman'";
231+
var query = "And(Or(Y='1985', Y='2008'), Ti='disordered electronic systems')";
173232
var match = g.match(query);
174233
var queryObject = s(match).interpret();
175234

176-
var div = <div id="outerDiv"></div>
235+
var input = <input id="queryInput" value={query} style="width: 100%"></input>
236+
var div = <div id="outerDiv" style="padding-right : 20px">
237+
{input}
238+
</div>
177239

178-
Object.keys(queryObject).forEach(key => {
240+
/*Object.keys(queryObject).forEach(key => {
179241
div.appendChild(createUILayer(queryObject, key));
180-
});
181-
//div.appendChild(<div>key</div>)
242+
});*/
182243

244+
div.appendChild(parseQuery(queryObject));
245+
183246
return div;
184-
// <div>
185-
// <table>
186-
// <tr>
187-
// <td>
188-
// Title
189-
// </td>
190-
// <td>
191-
// Author
192-
// </td>
193-
// <td>
194-
// Year
195-
// </td>
196-
// </tr>
197-
// <tr style="vertical-align:top">
198-
// <td>
199-
// <input value='something'></input>
200-
// </td>
201-
// <td>
202-
// <table>
203-
// <tr>
204-
// <td>
205-
// Name
206-
// </td>
207-
// <td>
208-
// <input value='name'></input>
209-
// </td>
210-
// </tr>
211-
// <tr>
212-
// <td>
213-
// Institution
214-
// </td>
215-
// <td>
216-
// <input value='inst'></input>
217-
// </td>
218-
// </tr>
219-
// </table>
220-
// </td>
221-
// <td>
222-
// <input value='2001'></input>
223-
// </td>
224-
// </tr>
225-
// </table>
226-
// </div>
227247
}
228248
}

demos/bibliographie/leonotes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ import ohm from "https://unpkg.com/[email protected]/dist/ohm.js"
4747

4848

4949
var myGrammar = ohm.grammar(
50-
'Academic {
50+
`Academic {
5151
Exp =
5252
AcademicQuery
5353
@@ -80,7 +80,7 @@ var myGrammar = ohm.grammar(
8080
digit+
8181
Date =
8282
"'" digit digit digit digit "-" digit digit "-" digit digit "'"
83-
}')
83+
}`)
8484

8585

8686

doc/journal/2016-03-10.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ get('tosave')
3535
```
3636
3737
38-
### Nice use case of #Livel4Chrome...
38+
### Nice use case of #Lively4Chrome...
3939
4040
I had to get the list of our mailinglist subsribers...
4141
So I went to its website. I could not find an export link, but just the list as an HTML table...

doc/journal/2016-04-27.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Getting the commit that last changed a file... e.g. the revision number of a fil
88

99
### Working on lively4-server from within lively4
1010

11-
Ok, we talked about it and thought lets wait until the livel4-services project can gives us a live view on a terminal...
11+
Ok, we talked about it and thought lets wait until the lively4-services project can gives us a live view on a terminal...
1212

1313
But then todays seminar came and here it is, the line of code that kills our lively server.
1414

471 KB
Loading

doc/journal/2020-11-25.md/index.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
## 2020-11-25 Custom #Workspace
2+
*Author: @JensLincke*
3+
4+
5+
```javascript
6+
var string = "3 + 4";
7+
8+
var id = "SpecialWorkspace"
9+
var codemirror = document.body.querySelector("#" + id);
10+
11+
(async () => {
12+
if (!codemirror) {
13+
codemirror = await lively.openWorkspace("3 + 4")
14+
codemirror.parentElement.setAttribute("title", "Special Workspace")
15+
codemirror.id = id
16+
}
17+
codemirror.boundEval = async function(s) {
18+
await lively.sleep(500)
19+
return ({ value: "I cannot evalutate: " +s})
20+
}
21+
})();
22+
```
23+
![](custom_workspace.png)

doc/journal/2020-11-30.md/index.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## 2020-11-30 #Server #Testing #Issue
2+
*Author: @JensLincke*
3+
4+
5+
## How to Automate this Test?
6+
7+
1. Setup:
8+
```javascript
9+
lively.files.saveFile("http://localhost:9006/Dropbox/Thesis/Literature/_misc/foo.md", "test content")
10+
```
11+
12+
2. Test:
13+
```javascript
14+
fetch("http://localhost:9006/Dropbox/Thesis/Literature/_misc/foo.md", {
15+
method: "MOVE",
16+
headers: {
17+
destination: "http://localhost:9006/Dropbox/Thesis/Literature/_misc/" + encodeURI("foo―é.md")
18+
}
19+
}).then(r => r.text())
20+
```
21+
22+
3. check that there is not error... and the file is there?

0 commit comments

Comments
 (0)