1
0
mirror of https://github.com/janet-lang/janet synced 2024-06-25 22:53:16 +00:00

Update documentation.

This commit is contained in:
Calvin Rose 2018-12-17 01:57:09 -05:00
parent 131ee29190
commit 003472354d
2 changed files with 21 additions and 2 deletions

View File

@ -55,7 +55,12 @@ Documentation can be found in the doc directory of
the repository. There is an introduction
section contains a good overview of the language.
For individual bindings, use the `(doc symbol-name)` macro to get API
API documentation for all bindings can also be generated
with `make docs`, which will create `build/doc.html`, which
can be viewed with any web browser. This
includes all forms in the core library except special forms.
For individual bindings from within the REPL, use the `(doc symbol-name)` macro to get API
documentation for the core library. For example,
```
(doc doc)

View File

@ -48,6 +48,16 @@ p {
(buffer/push-byte buf byte)))
buf)
(defn- make-title
"Generate title"
[]
(string "<h1>Janet Core API</h1>"
"<p>Version " janet/version "-" janet/build "</p>"
"<p>Generated "
(string/number (os/time) :f 0 20)
" seconds after epoch</p>"
"<hr>"))
(defn- emit-item
"Generate documentation for one entry."
[key env-entry]
@ -68,4 +78,8 @@ p {
:in (sort (pairs (table/getproto _env)))
:when (and entry:doc (not entry:private))]
(emit-item k entry)))
(print prelude ;(interpose "<hr>" parts) postlude)
(print
prelude
(make-title)
;(interpose "<hr>" parts)
postlude)