aboutsummaryrefslogtreecommitdiffstats
path: root/root/articles/mmmfs/examples
diff options
context:
space:
mode:
authors-ol <s-ol@users.noreply.github.com>2019-12-22 15:01:47 +0000
committers-ol <s-ol@users.noreply.github.com>2019-12-22 15:09:53 +0000
commitaab83d4f51ede07cad4152fa9d7b73db054a5963 (patch)
treebec3b46add73e75e7ac07a6588336c1f8c81cea7 /root/articles/mmmfs/examples
parentadd ba_log 2019-12-20 (diff)
downloadmmm-aab83d4f51ede07cad4152fa9d7b73db054a5963.tar.gz
mmm-aab83d4f51ede07cad4152fa9d7b73db054a5963.zip
lots more writing
Diffstat (limited to 'root/articles/mmmfs/examples')
-rw-r--r--root/articles/mmmfs/examples/text$moonscript -> fn -> mmm$dom.moon38
1 files changed, 21 insertions, 17 deletions
diff --git a/root/articles/mmmfs/examples/text$moonscript -> fn -> mmm$dom.moon b/root/articles/mmmfs/examples/text$moonscript -> fn -> mmm$dom.moon
index a553f8d..c79ffcf 100644
--- a/root/articles/mmmfs/examples/text$moonscript -> fn -> mmm$dom.moon
+++ b/root/articles/mmmfs/examples/text$moonscript -> fn -> mmm$dom.moon
@@ -4,7 +4,8 @@
-- resolves to a value of type mmm/dom
=>
html = require 'mmm.dom'
- import h4, div, a, span from html
+ import h4, div, a, span, ul, li from html
+ import link_to from (require 'mmm.mmmfs.util') html
-- render a preview block
preview = (child) ->
@@ -14,23 +15,26 @@
-- get 'preview' as a DOM description (nil if no value or conversion possible)
content = child\get 'preview', 'mmm/dom'
- div {
- h4 title, style: { margin: 0, cursor: 'pointer' }, onclick: -> BROWSER\navigate child.path
- content or span '(no renderable content)', style: { color: 'red' },
- style: {
- display: 'inline-block',
- width: '300px',
- height: '200px',
- padding: '4px',
- margin: '8px',
- border: '4px solid #eeeeee',
- overflow: 'hidden',
- },
- }
+ -- div {
+ -- h4 title, style: { margin: 0, cursor: 'pointer' }, onclick: -> BROWSER\navigate child.path
+ -- content or span '(no renderable content)', style: { color: 'red' },
+ -- style: {
+ -- display: 'inline-block',
+ -- width: '300px',
+ -- height: '200px',
+ -- padding: '4px',
+ -- margin: '8px',
+ -- border: '4px solid #eeeeee',
+ -- overflow: 'hidden',
+ -- },
+ -- }
- content = for child in *@children
+ li link_to child
+
+ content = ul for child in *@children
preview child
- table.insert content, 1, (@gett 'intro: mmm/dom')
+ -- table.insert content, 1, (@gett 'intro: mmm/dom')
+ -- div content
- div content
+ div (@gett 'intro: mmm/dom'), content