diff --git a/lib/hyperscript/parser.sx b/lib/hyperscript/parser.sx index 3e07187c..036ef73b 100644 --- a/lib/hyperscript/parser.sx +++ b/lib/hyperscript/parser.sx @@ -1270,8 +1270,19 @@ (let ((url (if (nil? url-atom) url-atom (parse-arith (parse-poss url-atom))))) (let - ((fmt (if (match-kw "as") (let ((f (tp-val))) (adv!) f) "text"))) - (list (quote fetch) url fmt))))))) + ((fmt-before (if (match-kw "as") (let ((f (tp-val))) (adv!) f) nil))) + (when (= (tp-type) "brace-open") (parse-expr)) + (when + (match-kw "with") + (if + (= (tp-type) "brace-open") + (parse-expr) + (parse-expr))) + (let + ((fmt-after (if (and (not fmt-before) (match-kw "as")) (let ((f (tp-val))) (adv!) f) nil))) + (let + ((fmt (or fmt-before fmt-after "text"))) + (list (quote fetch) url fmt))))))))) (define parse-call-args (fn diff --git a/shared/static/wasm/sx/hs-parser.sx b/shared/static/wasm/sx/hs-parser.sx index 3e07187c..036ef73b 100644 --- a/shared/static/wasm/sx/hs-parser.sx +++ b/shared/static/wasm/sx/hs-parser.sx @@ -1270,8 +1270,19 @@ (let ((url (if (nil? url-atom) url-atom (parse-arith (parse-poss url-atom))))) (let - ((fmt (if (match-kw "as") (let ((f (tp-val))) (adv!) f) "text"))) - (list (quote fetch) url fmt))))))) + ((fmt-before (if (match-kw "as") (let ((f (tp-val))) (adv!) f) nil))) + (when (= (tp-type) "brace-open") (parse-expr)) + (when + (match-kw "with") + (if + (= (tp-type) "brace-open") + (parse-expr) + (parse-expr))) + (let + ((fmt-after (if (and (not fmt-before) (match-kw "as")) (let ((f (tp-val))) (adv!) f) nil))) + (let + ((fmt (or fmt-before fmt-after "text"))) + (list (quote fetch) url fmt))))))))) (define parse-call-args (fn diff --git a/tests/hs-run-fast.js b/tests/hs-run-fast.js index d9f287ae..04a2f567 100644 --- a/tests/hs-run-fast.js +++ b/tests/hs-run-fast.js @@ -189,7 +189,7 @@ K.registerNative('load-library!',()=>false); let _testDeadline = 0; // Mock fetch routes const _fetchRoutes = { - '/test': { status: 200, body: 'yay', json: '{"foo":1}', html: '