miti.sh/command.moon
2025-05-17 11:43:36 -07:00

70 lines
1.8 KiB
Plaintext

-- =========================================================================
-- capture output of a system command
-- =========================================================================
-- handle = io.popen "ls"
-- result = handle\read("*a")
-- print result
-- handle\close!
-- =========================================================================
-- how changing the config in the Site class works
-- =========================================================================
-- f = class Site, config: { "one" } -- simulate `f = require "sitegen.site"`
-- f.config = { "two" }
-- simulate `n = require "sitegen.site"`
-- n = f -- because it has already been required, it returns the existing `f`
-- n!
-- { v } = n.config
-- print v
-- =========================================================================
-- markdown link pseudo-protocols
-- =========================================================================
-- [what-is-this](class:asdf)
--
-- [reference link][blah]
--
-- [blah]: <https://example.com> "titlehere"
--
-- [App Platform](id:doesthiswork><https://example.com>)
--
-- > %class-one%
-- >
-- > Lorem ipsum...
--
-- [postoffice](class:caps "asdf")
--
-- [postoffice][caps]
--
-- [caps]: class:caps 'ALL UPPER CASE, ALL THE TIME'
-- md = require "sitegen.renderers.markdown"
-- require("moon").p md
-- file = "docs/2023-08-03-recursively-list-all-files-in-a-directory-with-elixir.md"
--
-- Path = require "sitegen.path"
-- result = Path.join("/two", "one")
--
-- require("moon").p result
-- some_instance_method = (...) => @@ ...
--
-- blah = => @@var1
--
-- class Blah
-- @var1: "var1"
-- @var2 = "var2"
-- var3: "var3"
-- var4 = "var4"
--
-- meth1: =>
-- -- @var1
-- blah!
--
-- b = Blah!
-- -- require("moon").p Blah.meth1!
-- require("moon").p b\meth1!