1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-28 11:09:54 +00:00

Fix gendoc.

This commit is contained in:
Calvin Rose 2019-02-16 18:35:29 -05:00
parent c6f032340a
commit 53cc7ebd29

View File

@ -1,7 +1,5 @@
# Generate documentation # Generate documentation
# TODO - make tool reusable
(def- prelude (def- prelude
``` ```
<!doctype html> <!doctype html>
@ -57,13 +55,28 @@
(buffer/push-byte buf byte))) (buffer/push-byte buf byte)))
buf) buf)
(def- months '("January" "February" "March" "April" "May" "June" "July" "August" "September"
"October" "November" "December"))
(defn nice-date
"Get the current date nicely formatted"
[]
(let [date (os/date)
M (months (date :month))
D (+ (date :month-day) 1)
Y (date :year)
HH (date :hours)
MM (date :minutes)
SS (date :seconds)]
(string/format "%s %d, %d at %.2d:%.2d:%.2d"
M D Y HH MM SS)))
(defn- make-title (defn- make-title
"Generate title" "Generate title"
[] []
(string "<h1>Janet Core API</h1>" (string "<h1>Janet Core API</h1>"
"<p>Version " janet/version "-" janet/build "</p>" "<p>Version " janet/version "-" janet/build "</p>"
"<p>Generated " "<p>Generated at "
(string/number (os/time) :f 0 20) (nice-date)
" seconds after epoch</p>" " seconds after epoch</p>"
"<hr>")) "<hr>"))