aboutsummaryrefslogtreecommitdiffstats
path: root/docs/gen/index
diff options
context:
space:
mode:
authors-ol <s-ol@users.noreply.github.com>2020-06-03 10:50:20 +0000
committers-ol <s-ol@users.noreply.github.com>2020-06-03 11:04:00 +0000
commit4b8a0f024606ca8c602a4e886767d414995ca0a2 (patch)
tree0477d875efed4bc495827ccf265c1bb44397ce4e /docs/gen/index
parentadd loop/recur (diff)
downloadalive-4b8a0f024606ca8c602a4e886767d414995ca0a2.tar.gz
alive-4b8a0f024606ca8c602a4e886767d414995ca0a2.zip
split guide into guide and reference
Diffstat (limited to 'docs/gen/index')
-rwxr-xr-xdocs/gen/index43
1 files changed, 12 insertions, 31 deletions
diff --git a/docs/gen/index b/docs/gen/index
index dff601a..20fb3bd 100755
--- a/docs/gen/index
+++ b/docs/gen/index
@@ -1,8 +1,8 @@
#!/usr/bin/env moon
require 'alv'
-import render, layout, autoref from require 'docs.gen.layout'
+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 opairs from require 'alv.util'
+import compile from require 'discount'
export OUT
@@ -16,34 +16,15 @@ spit = (file, str) ->
file\write str
file\close!
-{ OUT } = arg
+{ OUT, file } = arg
+md = slurp file
+for file in *arg[3,]
+ if mod = file\match '/module/(.*)%.html'
+ name = mod\gsub '/', '.'
+ md ..= " - [`#{name}`](module/#{mod}.html)\n"
+
+content = compile (autoref md), 'githubtags', 'fencedcode'
+sub = subnav [a for a in *arg[3,]]
spit OUT, layout
- title: 'reference'
- body: {
- h1 (code 'alive'), " language reference"
- p "This section documents all builtins and modules that are currently
- available in the alive programming language."
- p autoref "If you are new to alive, the [getting started guide][:../guide/:] is
- the recommended place to start. If you are looking for
- information on adding your own module or contributing to alive, check
- out the [developer documentation][:../internals/index/:]."
- section {
- id: 'modules'
- h2 a "module index", href: '#modules'
- p autoref "These modules can be imported using [require][], " ..
- "[import][] and [import*][]."
- ul for file in *arg[2,]
- path = file\match '^alv%-lib/(.*)%.moon$'
- name = path\gsub '/', '.'
- li a (code name), href: "#{path}.html"
- }
- section {
- id: 'builtins'
- h2 a "builtins", href: '#builtins'
- p "These definitions are automatically loaded into the global Scope of
- every alive session."
- ul for key, val in opairs (require 'alv.builtins').values
- li render key, val.result
- }
- }
+ body: table.concat { sub, content.body }, '\n\n'