janet-lang / spork

Various Janet utility modules - the official "Contrib" library.
MIT License
122 stars 35 forks source link

Fix broken multi-line docstrings in `spork/http` #197

Closed CFiggers closed 1 month ago

CFiggers commented 1 month ago

http contains a number of docstrings that look like they should be long strings but aren't. For example, http/request.

Current output of (doc http/request) at the REPL:

Janet 1.36.0-dev-c82fd106 linux/x64/gcc - '(doc)' for help
repl:1:> (import spork/http)
@{_ @{:value <cycle 0>} http/cookie-grammar @{:private true} http/cookies @{:private true} http/logger @{:private true} http/middleware @{:private true} http/query-string-grammar @{:private true} http/read-body @{:private true} http/read-request @{:private true} http/read-response @{:private true} http/request @{:private true} http/request-peg @{:private true} http/response-peg @{:private true} http/router @{:private true} http/send-response @{:private true} http/server @{:private true} http/server-handler @{:private true} http/status-messages @{:private true} http/url-grammar @{:private true}}
repl:2:> (doc http/request)

    function
    /usr/local/lib/janet/spork/http.janet on line 463, column 1

    (request method url &keys {:headers headers :body body})

    Make an HTTP request to a server. Returns a table containing
    response information.  :head-size - number of bytes in the http
    header  :headers - table mapping header names to header values.
    Header names are lowercase.  :connection - the connection stream
    for the header.  :buffer - the buffer instance that may contain
    extra bytes.  :status - HTTP status code as an integer.  :message -
    HTTP status message.  :body - Bytes of the response body.

nil

Fixed:

Janet 1.36.0-dev-c82fd106 linux/x64/gcc - '(doc)' for help
repl:1:> (import ./spork/http)
@{_ @{:value <cycle 0>} http/cookie-grammar @{:private true} http/cookies @{:private true} http/logger @{:private true} http/middleware @{:private true} http/query-string-grammar @{:private true} http/read-body @{:private true} http/read-request @{:private true} http/read-response @{:private true} http/request @{:private true} http/request-peg @{:private true} http/response-peg @{:private true} http/router @{:private true} http/send-response @{:private true} http/server @{:private true} http/server-handler @{:private true} http/status-messages @{:private true} http/url-grammar @{:private true}}
repl:2:> (doc http/request)

    function
    spork/http.janet on line 463, column 1

    (request method url &keys {:headers headers :body body})

    Make an HTTP request to a server. Returns a table containing
    response information.

    * :head-size - number of bytes in the http header
    * :headers - table mapping header names to header values. Header
      names are lowercase.
    * :connection - the connection stream for the header.
    * :buffer - the buffer instance that may contain extra bytes.
    * :status - HTTP status code as an integer.
    * :message - HTTP status message.
    * :body - Bytes of the response body.

nil

All tests continue to pass.

sogaiu commented 1 month ago

LGTM -- much nicer.

Thanks!