-- =========================================================================
-- capture output of a system command
-- =========================================================================
-- handle = io.popen "ls"
-- result = handle\read("*a")
-- print result
-- handle\close!

-- os.execute "pandoc"

-- txt = "# hello"
-- md = "<<EOF\n#{txt}\nEOF"
-- handle = io.popen "pandoc #{md}", "r"
-- result = handle\read("*a")
-- handle\close!

n = os.tmpname!
handle = io.popen "pandoc > " .. n, "w"
handle\write "# hello"
handle\close!

f = io.open n, "r"
result = f\read("*a")
f\close!
-- output = io.input(handle)\read("*a")
-- handle\write "# hello"
-- handle\write "EOF"

-- result = handle\read "*a"
-- handle\close!



-- handle\flush!
print result
-- result\close!

-- require("moon").p handle

-- =========================================================================
-- 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'
