all repos — min @ 7ef2d91c7b8db4156313d3fd7484aecdb6cbac7a

A small but practical concatenative programming language.

Site updates + dict improvements
h3rald h3rald@h3rald.com
Fri, 29 Jan 2021 19:47:50 +0100
commit

7ef2d91c7b8db4156313d3fd7484aecdb6cbac7a

parent

af73f53cdf2b31962defff0a09c820712636a9e1

M minpkg/lib/min_http.nimminpkg/lib/min_http.nim

@@ -53,6 +53,7 @@ meth = i.dget(req, "method")

url = i.dget(req, "url") let resp = cli.request(url = url.getString, httpMethod = meth.getString, body = body.getString, headers = headers) var res = newDict(i.scope) + res.objType = "http-response" res = i.dset(res, "version", resp.version.newVal) res = i.dset(res, "status", resp.status[0..2].parseInt.newVal) res = i.dset(res, "headers", i.newVal(resp.headers))

@@ -96,6 +97,7 @@ var i {.threadvar.}: MinInterpreter

i = ii.copy(ii.filename) proc handler(req: Request) {.async, gcsafe.} = var qreq = newDict(i.scope) + qreq.objType = "http-request" qreq = i.dset(qreq, "url", newVal($req.url)) qreq = i.dset(qreq, "headers", i.newVal(req.headers)) qreq = i.dset(qreq, "method", newVal($req.reqMethod))
M minpkg/lib/min_str.nimminpkg/lib/min_str.nim

@@ -136,6 +136,7 @@ let vals = i.expect("str")

let s = vals[0].strVal let u = s.parseUri var d = newDict(i.scope) + d.objType = "url" i.dset(d, "scheme", u.scheme.newVal) i.dset(d, "username", u.username.newVal) i.dset(d, "password", u.password.newVal)
M next-release.mdnext-release.md

@@ -1,7 +1,10 @@

* Implemented "auto-popping" by adding **!** at the end of any symbol. * Removed all symbols ending with **!** as auto-popping will work instead. * Improved contrast and readability of the min web site. -* Removed **typeclass** and extended **operator** to create tupe classes as well. +* Now using **dict:http-response** and **dict:http-response** for HTTP requests/responses. +* Now using **dict:timeinfo** for time info. +* Changed **parse-url** to push a **dict:url** on the stack. +* Removed **typeclass** and extended **operator** to create type classes as well. * Renamed **string** and **float** type names (used in operator signatures) to **str** and **flt** respectively. * Removed **define-sigil**, use **operator** instead. * Removed **module** and **+** (sigil); use **require** to create modules.
M site/assets/styles/min-lang.csssite/assets/styles/min-lang.css

@@ -23,7 +23,7 @@ input,

select, textarea, .pure-g [class *= "pure-u"] { - font-family: 'Lato', sans-serif; + font-family: 'Source Sans Pro', sans-serif; } .donate-content-area {

@@ -123,7 +123,8 @@ margin-top: 1em;

} code, pre, .kwd, .cmd, .file, .dir, kbd, .kbd, .ext, .min-terminal { - font-family: 'Inconsolata', monospace; + font-family: 'Source Code Pro', monospace; + font-size: 90%; } .kwd, .kwd, .cmd, .file, .dir, .ext, kbd, .kbd {
M site/contents/_defs_.mdsite/contents/_defs_.md

@@ -51,9 +51,9 @@ {{none => ∅}}

{{no-win => (not supported on Windows systems)}} {{help => [dict:help](class:kwd)}} {{sock => [dict:socket](class:kwd)}} -{{url => [url](class:kwd)}} -{{req => [request](class:kwd)}} -{{res => [response](class:kwd)}} +{{url => [dict:url](class:kwd)}} +{{req => [dict:http-request](class:kwd)}} +{{res => [dict:http-response](class:kwd)}} {{sock1 => [dict:socket<sub>1</sub>](class:kwd)}} {{sock2 => [dict:socket<sub>2</sub>](class:kwd)}} {{m => _min_}}
M site/contents/reference-http.mdsite/contents/reference-http.md

@@ -10,13 +10,13 @@

{#op||get-content||{{s1}}||{{s2}}|| Retrieves the contents of URL {{s1}} as {{s2}}.#} -{#op||request||{{req}}||{{res}}|| -> Performs an HTTP request. -> +{#op||request||{{d}}||{{res}}|| +> Performs an HTTP request. Note that {{d}} is can be a standard (untyped) dictionary but its fields will be validated like if it was a {{req}}. +> > > %sidebar% > > Example > > -> > The following code constructs a {{req}} dictionary and passes it to the **request** operator to perform an HTTP GET request to <http://httpbin.org/ip>: +> > The following code constructs {{d}} and passes it to the **request** operator to perform an HTTP GET request to <http://httpbin.org/ip>: > > > > {} > > "GET" %method
M site/contents/reference.mdsite/contents/reference.md

@@ -90,6 +90,7 @@ "" :password

"/min" :path "" :anchor "" :query + ;url } {{tinfo}} : A timeinfo dictionary:

@@ -161,10 +162,6 @@ "application/json" :Content-Type

} :headers ;optional "{\"test\": \"This is a test\"}" :body } -{{t}} -: true (boolean type). -{{f}} -: false (boolean type) ### Suffixes
M site/templates/_head.mustachesite/templates/_head.mustache

@@ -7,7 +7,7 @@ <title>{{site}} - {{title}}</title>

<link rel="stylesheet" href="//cdn.jsdelivr.net/g/pure@0.6.2(base-min.css+grids-min.css+grids-responsive-min.css+buttons-min.css)"> <link rel="stylesheet" href="https://cdn.rawgit.com/balzss/luxbar/ae5835e2/build/luxbar.min.css"> <link rel="preconnect" href="https://fonts.gstatic.com"> - <link href="https://fonts.googleapis.com/css2?family=Inconsolata:wght@300;400&family=Lato:ital,wght@0,300;0,400;1,300;1,400&display=swap" rel="stylesheet"> + <link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@300;400&family=Source+Sans+Pro:ital,wght@0,300;0,400;1,300;1,400&display=swap" rel="stylesheet"> <link rel="stylesheet" href="/styles/themify-icons.css"> <link rel="stylesheet" href="/styles/min-lang.css"> </head>
M tasks/data/doc-snippets.jsontasks/data/doc-snippets.json

@@ -51,9 +51,9 @@ "null": "null",

"none": "", "help": "dict:help", "sock": "dict:socket", - "url": "url", - "req": "request", - "res": "response", + "url": "dict:url", + "req": "dict:http-request", + "res": "dict:http-response", "sock1": "dict:socket1", "sock2": "dict:socket2", "m": "min",