Skip to content

Commit

Permalink
conscript: add ~url
Browse files Browse the repository at this point in the history
  • Loading branch information
Bogdanp committed Feb 13, 2024
1 parent d818c46 commit 26139b7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 19 additions & 0 deletions conscript/base.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
(except-in congame/components/study button form)
congame/components/for-study
congame/components/transition-graph
net/url
racket/contract/base
racket/format
racket/lazy-require
racket/list
Expand Down Expand Up @@ -222,6 +224,23 @@
(get #:root (string->symbol (format "*dynamic:~a*" uid)) k)))


;; util ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(provide
(contract-out
[~url (->* [string?]
[#:params (listof (cons/c symbol? string?))]
string?)]))

(define (~url urlish #:params [params null])
(define u
(string->url
(if (not (regexp-match? #rx"^[^:]+?://" urlish))
(string-append "https://" urlish)
urlish)))
(url->string (struct-copy url u [query params])))


;; widgets ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(provide
Expand Down
2 changes: 1 addition & 1 deletion conscript/html-element.rkt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#lang racket/base

(require (for-syntax racket/base
syntax/parse))
syntax/parse/pre))

(define (make-element id required-kwds)
(make-keyword-procedure
Expand Down

0 comments on commit 26139b7

Please sign in to comment.