Skip to content

Commit d41afd4

Browse files
committed
Readme updates
1 parent d96a53e commit d41afd4

File tree

1 file changed

+42
-18
lines changed

1 file changed

+42
-18
lines changed

README.md

Lines changed: 42 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,53 @@
11
# LightScript
22

3-
### JavaScript, with cleaned-up syntax and a few conveniences.
4-
5-
A superset of ES7 with JSX and Flow,
6-
implemented as a fork of Babel’s parser wrapped in a Babel plugin. Built to make programmers a little more productive.
3+
*A close superset of ES7 with JSX and Flow, built with Babel. Designed to make programmers a little more productive.*
74

85
See [lightscript.org](http://lightscript.org) for example code
96
and language reference documentation. A quick taste:
107

118
```coffee
12-
fizzBuzz(n = 100) ->
13-
[for i from 1 thru n:
14-
if i % 3 == 0 and i % 5 == 0:
15-
"fizzbuzz"
16-
elif i % 3 == 0:
17-
"fizz"
18-
elif i % 5 == 0:
19-
"buzz"
9+
Item({ item, isActive, onClick }) =>
10+
className = if isActive: 'active' else: 'inactive'
11+
12+
<li onClick={onClick} className={className}>
13+
{item}
14+
</li>
15+
16+
class List extends React.Component:
17+
18+
activateItem(itemId): void =>
19+
if this.state.activeItem == itemId:
20+
this.setState({ activeItem: null })
2021
else:
21-
i
22-
]
22+
this.setState({ activeItem: itemId })
23+
24+
render() ->
25+
{ items, activeItem } = this.state
26+
27+
<div>
28+
{if activeItem:
29+
<p>You have selected: {activeItem}</p>
30+
else:
31+
<p>Click an item to select one!</p>
32+
}
33+
34+
<ul>
35+
{items.map((item, i) =>
36+
isActive = activeItem == item.id
37+
38+
if not item.hidden:
39+
<Item
40+
key={i}
41+
item={item}
42+
isActive={isActive}
43+
onClick={() => this.activateItem(item.id)}
44+
/>
45+
)}
46+
</ul>
47+
</div>
2348
```
2449

50+
Come hang out in [the gitter chatroom](https://gitter.im/lightscript/Lobby), where contributors can help you get started and answer any questions.
2551

2652
### Language Features
2753

@@ -40,7 +66,7 @@ In addition to all all ES7, JSX, and Flow features:
4066
- Array Comprehensions
4167
- Object Comprehensions
4268
- Array-based for-loops
43-
- Range-based for-loops
69+
- Object-based for-loops
4470
- a few others
4571

4672
Reference documentation is available at [lightscript.org](http://lightscript.org),
@@ -55,7 +81,6 @@ and [here](https://github.com/lightscript/babel-plugin-lightscript/tree/master/t
5581

5682
- **The Parser**: [babylon-lightscript](https://github.com/lightscript/babylon-lightscript)
5783
- The core of most of the language.
58-
- Because it is a fork, the repo would not be easily pulled into a monorepo.
5984
- **The Babel Plugin**: [babel-plugin-lightscript](https://github.com/lightscript/babel-plugin-lightscript)
6085
- Rewrites a "LightScript AST" into a "JavaScript AST".
6186
- The core of what you need to use LightScript.
@@ -71,7 +96,6 @@ and [here](https://github.com/lightscript/babel-plugin-lightscript/tree/master/t
7196
- Based on the Sublime Package.
7297
- Available now on the [VS Code Extension Marketplace](https://marketplace.visualstudio.com/items?itemName=lightscript.lsc).
7398
- **The Website**: [lightscript.org](https://github.com/lightscript/lightscript.org)
74-
- In addition to powering lightscript.org, it's also the best example of LightScript code in use.
75-
Hopefully that changes soon.
99+
- In addition to powering lightscript.org, it's also an example of LightScript code in use.
76100

77101
For now, the issue tracker on this repo should be used for bug reports and feature requests.

0 commit comments

Comments
 (0)