diff options
| author | s-ol <s-ol@users.noreply.github.com> | 2018-12-01 12:12:13 +0000 |
|---|---|---|
| committer | s-ol <s-ol@users.noreply.github.com> | 2018-12-01 12:12:13 +0000 |
| commit | 691ebc3059b37ad535fa464ff285e7b925265a88 (patch) | |
| tree | e36cfa3dc0b79def0c3c3a682fe8db16d96f914a | |
| parent | more plonat atek documentation (diff) | |
| download | mmm-691ebc3059b37ad535fa464ff285e7b925265a88.tar.gz mmm-691ebc3059b37ad535fa464ff285e7b925265a88.zip | |
order games
| -rw-r--r-- | mmm/ordered.moon | 19 | ||||
| -rw-r--r-- | root/blog/text$moonscript -> fn -> mmm$dom.moon | 4 | ||||
| -rw-r--r-- | root/games/IYNX/date: time$iso8601-date | 1 | ||||
| -rw-r--r-- | root/games/channel_83/date: time$iso8601-date | 1 | ||||
| -rw-r--r-- | root/games/curved_curse/date: time$iso8601-date | 1 | ||||
| -rw-r--r-- | root/games/gtglg/date: time$iso8601-date | 1 | ||||
| -rw-r--r-- | root/games/lorem_ipsum/date: time$iso8601-date | 1 | ||||
| -rw-r--r-- | root/games/moving_out/date: time$iso8601-date | 1 | ||||
| -rw-r--r-- | root/games/plonat_atek/date: time$iso8601-date | 1 | ||||
| -rw-r--r-- | root/games/text$moonscript -> fn -> mmm$dom.moon | 16 | ||||
| -rw-r--r-- | root/games/the_monster_within/date: time$iso8601-date | 1 | ||||
| -rw-r--r-- | root/games/the_sacculi/date: time$iso8601-date | 1 | ||||
| -rw-r--r-- | root/games/two_shooting_stars/date: time$iso8601-date | 1 | ||||
| -rw-r--r-- | root/games/vision-training-kit/date: time$iso8601-date | 1 | ||||
| -rw-r--r-- | root/games/zebra_painting/date: time$iso8601-date | 1 |
15 files changed, 41 insertions, 10 deletions
diff --git a/mmm/ordered.moon b/mmm/ordered.moon index cdb0e29..c867dfd 100644 --- a/mmm/ordered.moon +++ b/mmm/ordered.moon @@ -6,7 +6,7 @@ sort = (t, order_fn, only_strings) -> -- ordered next(t) onext = (state, key) -> - state.i += 1 + state.i += state.step { :t, :index, :i } = state if key = index[i] @@ -16,13 +16,26 @@ onext = (state, key) -> -- order_fn is optional; see table.sort opairs = (t, order_fn, only_strings=false) -> state = { - :t, - i: 0, + :t + i: 0 + step: 1 index: sort t, order_fn, only_strings } onext, state, nil +-- reverse opairs(...) +ropairs = (t, order_fn, only_strings=false) -> + index = sort t, order_fn, only_strings + state = { + :t + :index + i: #index + 1 + step: -1 + } + onext, state, nil + { :onext :opairs + :ropairs } diff --git a/root/blog/text$moonscript -> fn -> mmm$dom.moon b/root/blog/text$moonscript -> fn -> mmm$dom.moon index 100a9b7..2d5902d 100644 --- a/root/blog/text$moonscript -> fn -> mmm$dom.moon +++ b/root/blog/text$moonscript -> fn -> mmm$dom.moon @@ -1,6 +1,6 @@ import div, h3, ul, li from require 'mmm.dom' -import opairs from require 'mmm.ordered' import link_to from (require 'mmm.mmmfs.util') require 'mmm.dom' +import ropairs from require 'mmm.ordered' => div { @@ -8,7 +8,7 @@ import link_to from (require 'mmm.mmmfs.util') require 'mmm.dom' ul do posts = { (p\gett 'date: time/unix'), p for p in *@children } - posts = for date, post in opairs posts + posts = for date, post in ropairs posts continue if post\get 'hidden: bool' li (link_to post, os.date '%F', date), ' - ', post\gett 'title: mmm/dom' diff --git a/root/games/IYNX/date: time$iso8601-date b/root/games/IYNX/date: time$iso8601-date new file mode 100644 index 0000000..b12bb99 --- /dev/null +++ b/root/games/IYNX/date: time$iso8601-date @@ -0,0 +1 @@ +2017-01-20 diff --git a/root/games/channel_83/date: time$iso8601-date b/root/games/channel_83/date: time$iso8601-date new file mode 100644 index 0000000..3c0b19b --- /dev/null +++ b/root/games/channel_83/date: time$iso8601-date @@ -0,0 +1 @@ +2017-08-30 diff --git a/root/games/curved_curse/date: time$iso8601-date b/root/games/curved_curse/date: time$iso8601-date new file mode 100644 index 0000000..378bfb8 --- /dev/null +++ b/root/games/curved_curse/date: time$iso8601-date @@ -0,0 +1 @@ +2015-04-20 diff --git a/root/games/gtglg/date: time$iso8601-date b/root/games/gtglg/date: time$iso8601-date new file mode 100644 index 0000000..3279291 --- /dev/null +++ b/root/games/gtglg/date: time$iso8601-date @@ -0,0 +1 @@ +2014-12-23 diff --git a/root/games/lorem_ipsum/date: time$iso8601-date b/root/games/lorem_ipsum/date: time$iso8601-date new file mode 100644 index 0000000..f83d721 --- /dev/null +++ b/root/games/lorem_ipsum/date: time$iso8601-date @@ -0,0 +1 @@ +2016-09-01 diff --git a/root/games/moving_out/date: time$iso8601-date b/root/games/moving_out/date: time$iso8601-date new file mode 100644 index 0000000..758ee06 --- /dev/null +++ b/root/games/moving_out/date: time$iso8601-date @@ -0,0 +1 @@ +2016-12-11 diff --git a/root/games/plonat_atek/date: time$iso8601-date b/root/games/plonat_atek/date: time$iso8601-date new file mode 100644 index 0000000..8bc80ba --- /dev/null +++ b/root/games/plonat_atek/date: time$iso8601-date @@ -0,0 +1 @@ +2017-04-25 diff --git a/root/games/text$moonscript -> fn -> mmm$dom.moon b/root/games/text$moonscript -> fn -> mmm$dom.moon index 81e90fa..70d2636 100644 --- a/root/games/text$moonscript -> fn -> mmm$dom.moon +++ b/root/games/text$moonscript -> fn -> mmm$dom.moon @@ -1,15 +1,21 @@ import div, span, h3, ul, li, a, h4, img, p from require 'mmm.dom' import link_to from (require 'mmm.mmmfs.util') require 'mmm.dom' +import ropairs from require 'mmm.ordered' => div { h3 link_to @ - ul for child in *@children - desc = child\gett 'description: mmm/dom' - jam = if link = child\get 'jam: mmm/dom' - span '[', link, ']', style: { float: 'right', color: 'var(--gray-dark)' } + ul do + games = { (p\gett 'date: time/unix'), p for p in *@children } - li (link_to child), ': ', desc, jam + children = for k, child in ropairs games + desc = child\gett 'description: mmm/dom' + jam = if link = child\get 'jam: mmm/dom' + span '[', link, ']', style: { float: 'right', color: 'var(--gray-dark)' } + + li (link_to child), ': ', desc, jam + + children -- ul with for child in *@children -- link_if_content = (opts) -> -- a with opts diff --git a/root/games/the_monster_within/date: time$iso8601-date b/root/games/the_monster_within/date: time$iso8601-date new file mode 100644 index 0000000..9e7bf47 --- /dev/null +++ b/root/games/the_monster_within/date: time$iso8601-date @@ -0,0 +1 @@ +2015-08-25 diff --git a/root/games/the_sacculi/date: time$iso8601-date b/root/games/the_sacculi/date: time$iso8601-date new file mode 100644 index 0000000..3e81523 --- /dev/null +++ b/root/games/the_sacculi/date: time$iso8601-date @@ -0,0 +1 @@ +2018-08-14 diff --git a/root/games/two_shooting_stars/date: time$iso8601-date b/root/games/two_shooting_stars/date: time$iso8601-date new file mode 100644 index 0000000..1da7b90 --- /dev/null +++ b/root/games/two_shooting_stars/date: time$iso8601-date @@ -0,0 +1 @@ +2016-06-01 diff --git a/root/games/vision-training-kit/date: time$iso8601-date b/root/games/vision-training-kit/date: time$iso8601-date new file mode 100644 index 0000000..9fd465a --- /dev/null +++ b/root/games/vision-training-kit/date: time$iso8601-date @@ -0,0 +1 @@ +2016-08-05 diff --git a/root/games/zebra_painting/date: time$iso8601-date b/root/games/zebra_painting/date: time$iso8601-date new file mode 100644 index 0000000..fdf764e --- /dev/null +++ b/root/games/zebra_painting/date: time$iso8601-date @@ -0,0 +1 @@ +2018-09-13 |
