diff options
| author | s-ol <s-ol@users.noreply.github.com> | 2018-10-19 14:12:16 +0000 |
|---|---|---|
| committer | s-ol <s-ol@users.noreply.github.com> | 2018-10-19 14:12:16 +0000 |
| commit | 87c165036718abc9b94ca69ea7144c356dd45e3b (patch) | |
| tree | a5c7b7b9519045b007e9758c4facecb343c9b710 /app | |
| parent | small cleaning (diff) | |
| download | mmm-87c165036718abc9b94ca69ea7144c356dd45e3b.tar.gz mmm-87c165036718abc9b94ca69ea7144c356dd45e3b.zip | |
build fixes
Diffstat (limited to 'app')
| -rw-r--r-- | app/index.moon | 4 | ||||
| -rw-r--r-- | app/init.moon | 94 |
2 files changed, 96 insertions, 2 deletions
diff --git a/app/index.moon b/app/index.moon index 44df8bc..6c68dbe 100644 --- a/app/index.moon +++ b/app/index.moon @@ -19,7 +19,7 @@ on_client -> { :location } = window if location.search and #location.search > 1 name = location.search\sub 2 - location.href = "#{redirs[name] or name}.html" + location.href = redirs[name] or name append h1 'mmm' append p { @@ -36,7 +36,7 @@ append p { } append p 'current demos:' append ul for name, desc in opairs demos - li (a name, href: "/#{name}.html"), ': ', desc + li (a name, href: name), ': ', desc append p { "made with #{moon} by " diff --git a/app/init.moon b/app/init.moon new file mode 100644 index 0000000..6895782 --- /dev/null +++ b/app/init.moon @@ -0,0 +1,94 @@ +require = relative ... +import opairs from require 'lib.ordered' + +merge = (tables) -> + first = table.remove tables, 1 + for tbl in *tables + for k,v in pairs tbl + first[k] = v + first + +experiments = + twisted: { + desc: 'canvas animation' + render: -> require '.twisted' + }, + todo: { + desc: 'Todo demo of a simple reactive UI framework' + render: -> require '.todo' + }, + realities: { + desc: 'draft of a paper on virtual and other realities' + render: -> require '.realities' + }, + center_of_mass: { + desc: 'aligning characters by their centers of mass' + render: -> require '.center_of_mass' + }, + test_component: { + desc: 'Test suite for the UI framework' + render: -> require '.test_component' + }, + tags: { + desc: 'Playground for Functional Tags' + render: -> require '.tags' + }, + +destify = (name, route) -> + name, with route + .route = name + .dest = "#{name}/index.html" + +routes = { destify k,v for k,v in pairs experiments } + +patch_redirs = -> + redirs = + 'center-of-mass': 'center_of_mass', + 'test-component': 'test_component', + 'play-tags': 'tags', + + { :location } = window + if location.search and #location.search > 1 + name = location.search\sub 2 + location.href = redirs[name] or name + +routes.index = { + route: '' + dest: 'index.html' + render: => + import h1, p, a, br, ul, tt, li from require 'lib.html' + import opairs from require 'lib.ordered' + + moon = '\xe2\x98\xbd' + + -- redirects for old-style URIs + on_client patch_redirs + + -- menu + append h1 'mmm' + append p { + tt 'mmm' + ' is not the ' + tt 'www' + ', because it runs on ' + a { 'MoonScript', href: 'https://moonscript.org' } + '.' + br! + 'You can find the source code of everything ' + a { 'here', href: 'https://github.com/s-ol/mmm' } + '.' + } + append p 'current demos:' + append ul for name, { :desc, :route } in opairs experiments + li (a name, href: route), ': ', desc + + append p { + "made with #{moon} by " + a { 's-ol', href: 'https://twitter.com/S0lll0s' } + } +} + +{ + :routes, + render: (name) -> require ".#{name}" +} |
