diff options
author | Colin Okay <okay@toyful.space> | 2022-02-08 11:20:25 -0600 |
---|---|---|
committer | Colin Okay <okay@toyful.space> | 2022-02-08 11:20:25 -0600 |
commit | ddbdb583e0cb309db5d5b03cc5bcf5216951d389 (patch) | |
tree | d6274309c514975656065a09cf7c316cecaa65b0 /lazybones.lisp | |
parent | da9f8ba322ea1de0db5fdfd04891c595e0ff91d8 (diff) |
changing route variable syntax
Diffstat (limited to 'lazybones.lisp')
-rw-r--r-- | lazybones.lisp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lazybones.lisp b/lazybones.lisp index 3345afe..148cd05 100644 --- a/lazybones.lisp +++ b/lazybones.lisp @@ -238,9 +238,9 @@ ENDPOINT's handler function." (defun parse-route-string-template (template) "Routes are of the form -/foo/bar/<<variable>>/blah +/foo/bar/:variable:/blah -/foo/bar/<<var parse-integer>>/blah +/foo/bar/:var parse-integer:/blah On success returns things like: @@ -267,20 +267,20 @@ Returns NIL on failure" collect (string-downcase field))))) (defun parse-route-variable-string (string) - "A route variable string looks like <<foo>> or <<foo bar>> + "A route variable string looks like :foo: or :foo bar: In the case of a successful parse, a list of one or two symbols is returned. These symbosl are created using read-from-string, which allows for these symbols' packages to be specified if desired. Returns NIL on failure." - (when (and (a:starts-with-subseq "<<" string) - (a:ends-with-subseq ">>" string)) + (when (and (a:starts-with-subseq ":" string) + (a:ends-with-subseq ":" string)) (destructuring-bind (var-name . decoder?) (re:split " +" (string-trim " " - (subseq string 2 (- (length string) 2)))) + (subseq string 1 (- (length string) 1)))) (if decoder? (list (string-upcase var-name) (read-from-string (first decoder?))) (list (string-upcase var-name)))))) |