1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#!/usr/bin/env moon
require 'alv'
import render, layout, autoref, subnav from require 'docs.gen.layout'
import section, h1, h2, p, ul, li, a, code from require 'docs.gen.dom'
import get_module from require 'docs.gen.shim'
import compile from require 'discount'
export OUT
slurp = (file) ->
file = io.open file, 'r'
with file\read '*all'
file\close!
spit = (file, str) ->
file = io.open file, 'w'
file\write str
file\close!
{ OUT, file } = arg
md = slurp file
for file in *arg[3,]
if name = file\match '/module/(.*)%.html'
modname = name\gsub '/', '.'
mod = get_module "alv-lib.#{modname}"
summary = if mod.meta then ": #{mod.meta.summary}" else ''
md ..= " - [`#{modname}`](module/#{name}.html)#{summary}\n"
content = compile (autoref md), 'githubtags', 'fencedcode'
sub = subnav [a for a in *arg[3,]]
spit OUT, layout
body: table.concat { sub, content.body }, '\n\n'
|