aboutsummaryrefslogtreecommitdiffstats
path: root/root/articles/mmmfs/examples/language_support
diff options
context:
space:
mode:
authors-ol <s-ol@users.noreply.github.com>2019-10-26 11:30:58 +0000
committers-ol <s-ol@users.noreply.github.com>2019-10-26 11:30:58 +0000
commit6a30fbd239b31e293c0833c2bbcbb8def44707f1 (patch)
tree1c6501c3d36f4b09ac5648e44026fd224ccf19c6 /root/articles/mmmfs/examples/language_support
parentfix bug in deep_tostring (diff)
downloadmmm-6a30fbd239b31e293c0833c2bbcbb8def44707f1.tar.gz
mmm-6a30fbd239b31e293c0833c2bbcbb8def44707f1.zip
mmmfs cleanup
Diffstat (limited to 'root/articles/mmmfs/examples/language_support')
-rw-r--r--root/articles/mmmfs/examples/language_support/javascript/text$javascript -> mmm$dom.js15
-rw-r--r--root/articles/mmmfs/examples/language_support/javascript/title: text$plain1
-rw-r--r--root/articles/mmmfs/examples/language_support/lua/text$lua -> mmm$dom.lua9
-rw-r--r--root/articles/mmmfs/examples/language_support/lua/title: text$plain1
-rw-r--r--root/articles/mmmfs/examples/language_support/moonscript/text$moonscript -> mmm$dom.moon10
-rw-r--r--root/articles/mmmfs/examples/language_support/moonscript/title: text$plain1
-rw-r--r--root/articles/mmmfs/examples/language_support/preview: text$markdown6
-rw-r--r--root/articles/mmmfs/examples/language_support/text$moonscript -> fn -> mmm$dom.moon16
-rw-r--r--root/articles/mmmfs/examples/language_support/title: text$plain1
9 files changed, 60 insertions, 0 deletions
diff --git a/root/articles/mmmfs/examples/language_support/javascript/text$javascript -> mmm$dom.js b/root/articles/mmmfs/examples/language_support/javascript/text$javascript -> mmm$dom.js
new file mode 100644
index 0000000..de56531
--- /dev/null
+++ b/root/articles/mmmfs/examples/language_support/javascript/text$javascript -> mmm$dom.js
@@ -0,0 +1,15 @@
+const e = (elem, children) => {
+ const node = document.createElement(elem);
+
+ if (typeof children === 'string')
+ node.innerText = children;
+ else
+ children.forEach(child => node.appendChild(child));
+
+ return node;
+};
+
+return e('article', [
+ e('h1', 'JavaScript'),
+ e('p', 'JavaScript is supported natively in the browser but is not currently pre-rendered on the server.'),
+]);
diff --git a/root/articles/mmmfs/examples/language_support/javascript/title: text$plain b/root/articles/mmmfs/examples/language_support/javascript/title: text$plain
new file mode 100644
index 0000000..581fbc7
--- /dev/null
+++ b/root/articles/mmmfs/examples/language_support/javascript/title: text$plain
@@ -0,0 +1 @@
+JavaScript
diff --git a/root/articles/mmmfs/examples/language_support/lua/text$lua -> mmm$dom.lua b/root/articles/mmmfs/examples/language_support/lua/text$lua -> mmm$dom.lua
new file mode 100644
index 0000000..62e79f1
--- /dev/null
+++ b/root/articles/mmmfs/examples/language_support/lua/text$lua -> mmm$dom.lua
@@ -0,0 +1,9 @@
+local d = require 'mmm.dom'
+
+local lua = d.a { 'Lua', href = 'https://www.lua.org/' }
+local fengari = d.a { 'fengari.io', href = 'https://fengari.io/' }
+
+return d.article {
+ d.h1 'Lua',
+ d.p { lua, ' is fully supported using ', fengari, ' on the Client.' }
+}
diff --git a/root/articles/mmmfs/examples/language_support/lua/title: text$plain b/root/articles/mmmfs/examples/language_support/lua/title: text$plain
new file mode 100644
index 0000000..0f9d550
--- /dev/null
+++ b/root/articles/mmmfs/examples/language_support/lua/title: text$plain
@@ -0,0 +1 @@
+Lua
diff --git a/root/articles/mmmfs/examples/language_support/moonscript/text$moonscript -> mmm$dom.moon b/root/articles/mmmfs/examples/language_support/moonscript/text$moonscript -> mmm$dom.moon
new file mode 100644
index 0000000..5cc50e6
--- /dev/null
+++ b/root/articles/mmmfs/examples/language_support/moonscript/text$moonscript -> mmm$dom.moon
@@ -0,0 +1,10 @@
+import a, article, h1, p from require 'mmm.dom'
+
+moonscript = a 'MoonScript', href: 'https://moonscript.org/'
+lua = a 'Lua', href: 'https://www.lua.org/'
+fengari = a 'fengari.io', href: 'https://fengari.io/'
+
+article {
+ h1 'MoonScript',
+ p moonscript, " is compiled to ", lua, " on the server, which is then executed on the client using ", fengari, "."
+}
diff --git a/root/articles/mmmfs/examples/language_support/moonscript/title: text$plain b/root/articles/mmmfs/examples/language_support/moonscript/title: text$plain
new file mode 100644
index 0000000..f8871ac
--- /dev/null
+++ b/root/articles/mmmfs/examples/language_support/moonscript/title: text$plain
@@ -0,0 +1 @@
+MoonScript
diff --git a/root/articles/mmmfs/examples/language_support/preview: text$markdown b/root/articles/mmmfs/examples/language_support/preview: text$markdown
new file mode 100644
index 0000000..d6c2845
--- /dev/null
+++ b/root/articles/mmmfs/examples/language_support/preview: text$markdown
@@ -0,0 +1,6 @@
+this Fileder contains some minimal examples showing support for various languages `mmmfs` supports currently.
+
+Language support is mostly limited by the fact that `mmmfs` currently targets web browsers,
+on the server any scripting language that can be executed can theoretically be integrated with minimal effort.
+
+Using the inspector mode to view the source of the Fileders below is encouraged.
diff --git a/root/articles/mmmfs/examples/language_support/text$moonscript -> fn -> mmm$dom.moon b/root/articles/mmmfs/examples/language_support/text$moonscript -> fn -> mmm$dom.moon
new file mode 100644
index 0000000..4ae0679
--- /dev/null
+++ b/root/articles/mmmfs/examples/language_support/text$moonscript -> fn -> mmm$dom.moon
@@ -0,0 +1,16 @@
+import article, h1, p, ul, li, a from require 'mmm.dom'
+
+single = (a) -> a
+
+=>
+ children = for child in *@children
+ title = child\gett 'title: text/plain'
+ li a title, href: child.path, onclick: (e) =>
+ e\preventDefault!
+ BROWSER\navigate child.path
+
+ article {
+ h1 single @gett 'title: text/plain'
+ p single @gett 'preview: mmm/dom'
+ ul children
+ }
diff --git a/root/articles/mmmfs/examples/language_support/title: text$plain b/root/articles/mmmfs/examples/language_support/title: text$plain
new file mode 100644
index 0000000..ae06474
--- /dev/null
+++ b/root/articles/mmmfs/examples/language_support/title: text$plain
@@ -0,0 +1 @@
+scripting language support