io.stdin, io.stdout, io.stderr added to docs (there's no section for these in the manual)
This commit is contained in:
parent
1a21ee623d
commit
fd40c31cd9
@ -29,9 +29,12 @@
|
||||
(table.insert fields section)))
|
||||
(when header (loop header))))
|
||||
|
||||
|
||||
(fn make-title [name]
|
||||
(.. "<hr><h3><a name=\"pdf-" name "\"><code>" name "</code></a></h3>\n"))
|
||||
;; Artificially insert the `arg` docs.
|
||||
;; This isn't present in the "Basic Functions" part of the manual, but is still useful to be included in the docs.
|
||||
(let [arg-signature "<hr><h3><a name=\"pdf-arg\"><code>arg</code></a></h3>\n"
|
||||
(let [arg-signature (make-title :arg)
|
||||
arg-description (-> html
|
||||
;; The goal here is to extract the smallest string which:
|
||||
;; 1) contains the string "global table called <code>arg</code>"
|
||||
@ -46,6 +49,9 @@
|
||||
(: :match "(.-)>p<\n")
|
||||
(: :reverse))]
|
||||
(table.insert fields (.. arg-signature arg-description)))
|
||||
(table.insert fields (.. (make-title "io.stdin") "stdin file"))
|
||||
(table.insert fields (.. (make-title "io.stdout") "stdout file"))
|
||||
(table.insert fields (.. (make-title "io.stderr") "stderr file"))
|
||||
(loop (stdlib:find "<hr><h3>.-\n"))
|
||||
(values modules fields last-update)))
|
||||
|
||||
@ -205,6 +211,9 @@
|
||||
(view (list (sym :local) (sym :docs) docs))
|
||||
"\n"
|
||||
"(set docs._G.fields docs)\n"
|
||||
"(set docs.io.fields.stdin.fields docs.io.fields)\n"
|
||||
"(set docs.io.fields.stdout.fields docs.io.fields)\n"
|
||||
"(set docs.io.fields.stderr.fields docs.io.fields)\n"
|
||||
"docs\n"))
|
||||
(print (.. "Emitted docs for lua" version)))))
|
||||
|
||||
|
||||
@ -418,6 +418,12 @@ on all platforms."}}
|
||||
:read {:binding "io.read"
|
||||
:metadata {:fnl/arglist ["..."]
|
||||
:fnl/docstring "Equivalent to `io.input():read`."}}
|
||||
:stderr {:binding "io.stderr"
|
||||
:metadata {:fnl/docstring "stderr file"}}
|
||||
:stdin {:binding "io.stdin"
|
||||
:metadata {:fnl/docstring "stdin file"}}
|
||||
:stdout {:binding "io.stdout"
|
||||
:metadata {:fnl/docstring "stdout file"}}
|
||||
:tmpfile {:binding "io.tmpfile"
|
||||
:metadata {:fnl/arglist {}
|
||||
:fnl/docstring "Returns a handle for a temporary file.
|
||||
@ -1401,4 +1407,7 @@ after this first result.
|
||||
In case of any error,
|
||||
`xpcall` returns **false** plus the result from `err`."}}})
|
||||
(set docs._G.fields docs)
|
||||
(set docs.io.fields.stdin.fields docs.io.fields)
|
||||
(set docs.io.fields.stdout.fields docs.io.fields)
|
||||
(set docs.io.fields.stderr.fields docs.io.fields)
|
||||
docs
|
||||
|
||||
@ -577,6 +577,12 @@ or to write data to this program
|
||||
:read {:binding "io.read"
|
||||
:metadata {:fnl/arglist ["..."]
|
||||
:fnl/docstring "Equivalent to `io.input():read(...)`."}}
|
||||
:stderr {:binding "io.stderr"
|
||||
:metadata {:fnl/docstring "stderr file"}}
|
||||
:stdin {:binding "io.stdin"
|
||||
:metadata {:fnl/docstring "stdin file"}}
|
||||
:stdout {:binding "io.stdout"
|
||||
:metadata {:fnl/docstring "stdout file"}}
|
||||
:tmpfile {:binding "io.tmpfile"
|
||||
:metadata {:fnl/arglist {}
|
||||
:fnl/docstring "Returns a handle for a temporary file.
|
||||
@ -1656,4 +1662,7 @@ and `\"userdata\"`."}}
|
||||
:fnl/docstring "This function is similar to `pcall`,
|
||||
except that it sets a new message handler `msgh`."}}})
|
||||
(set docs._G.fields docs)
|
||||
(set docs.io.fields.stdin.fields docs.io.fields)
|
||||
(set docs.io.fields.stdout.fields docs.io.fields)
|
||||
(set docs.io.fields.stderr.fields docs.io.fields)
|
||||
docs
|
||||
|
||||
@ -464,6 +464,12 @@ or to write data to this program
|
||||
:read {:binding "io.read"
|
||||
:metadata {:fnl/arglist ["..."]
|
||||
:fnl/docstring "Equivalent to `io.input():read(...)`."}}
|
||||
:stderr {:binding "io.stderr"
|
||||
:metadata {:fnl/docstring "stderr file"}}
|
||||
:stdin {:binding "io.stdin"
|
||||
:metadata {:fnl/docstring "stdin file"}}
|
||||
:stdout {:binding "io.stdout"
|
||||
:metadata {:fnl/docstring "stdout file"}}
|
||||
:tmpfile {:binding "io.tmpfile"
|
||||
:metadata {:fnl/arglist {}
|
||||
:fnl/docstring "In case of success,
|
||||
@ -1687,4 +1693,7 @@ negative indices count from the end of the string."}}
|
||||
:fnl/docstring "This function is similar to `pcall`,
|
||||
except that it sets a new message handler `msgh`."}}})
|
||||
(set docs._G.fields docs)
|
||||
(set docs.io.fields.stdin.fields docs.io.fields)
|
||||
(set docs.io.fields.stdout.fields docs.io.fields)
|
||||
(set docs.io.fields.stderr.fields docs.io.fields)
|
||||
docs
|
||||
|
||||
@ -508,6 +508,12 @@ or to write data to this program
|
||||
:read {:binding "io.read"
|
||||
:metadata {:fnl/arglist ["..."]
|
||||
:fnl/docstring "Equivalent to `io.input():read(...)`."}}
|
||||
:stderr {:binding "io.stderr"
|
||||
:metadata {:fnl/docstring "stderr file"}}
|
||||
:stdin {:binding "io.stdin"
|
||||
:metadata {:fnl/docstring "stdin file"}}
|
||||
:stdout {:binding "io.stdout"
|
||||
:metadata {:fnl/docstring "stdout file"}}
|
||||
:tmpfile {:binding "io.tmpfile"
|
||||
:metadata {:fnl/arglist {}
|
||||
:fnl/docstring "In case of success,
|
||||
@ -1868,4 +1874,7 @@ it ignores unknown control messages."}}
|
||||
:fnl/docstring "This function is similar to `pcall`,
|
||||
except that it sets a new message handler `msgh`."}}})
|
||||
(set docs._G.fields docs)
|
||||
(set docs.io.fields.stdin.fields docs.io.fields)
|
||||
(set docs.io.fields.stdout.fields docs.io.fields)
|
||||
(set docs.io.fields.stderr.fields docs.io.fields)
|
||||
docs
|
||||
|
||||
Loading…
Reference in New Issue
Block a user