#!/usr/bin/env moon import layout from require 'docs.gen.layout' export OUT, BASE spit = (file, str) -> file = io.open file, 'w' file\write str file\close! { OUT } = arg BASE = '$(base)' spit OUT, layout style: '$(base)style.css' title: '$(ldoc.title)' class: 'ldoc' preamble: ' # local iter = ldoc.modules.iter # local M = ldoc.markup # local function display_name(item) # if item.type == "function" then # return item.name:gsub(":new$", "")..item.args # else return item.name end # end # local function use_li(ls) # if #ls > 1 then return "
  • ","
  • " else return "","" end # end # local base = module and "../../" or "../"' body: { class: 'ldoc' ' # if ldoc.body then $(ldoc.body) # elseif not module then # if ldoc.description then

    $(M(ldoc.description))

    # end # if ldoc.full_description then

    $(M(ldoc.full_description))

    #end # for kind, mods in ldoc.kinds() do # kind = kind:lower()

    $(kind)

    # end # else

    $(ldoc.module_typename(module):lower()) $(module.name)

    $(M(module.summary, module))

    $(M(module.description, module))

    # if module.see then # local li,il = use_li(module.see)

    see also:

    # end # if module.kinds()() then

    index

    # for kind, items in module.kinds() do # kind = kind:lower()

    $(kind)

    # end

    details

    # for kind, items in module.kinds() do # kind = kind:lower()

    $(kind)

    # end # end # end ' }