diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-05-01 13:10:19 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-05-01 13:10:19 +0200 |
commit | b0f51a25df76316c1cd6aa8ea97d3eb213c72cb3 (patch) | |
tree | f3efafe4bb0a80075d4bc2915a6d25586b6a28ea /module/server | |
parent | Note in README about TippedJS. (diff) | |
parent | Merge branch 'app'. (diff) | |
download | calp-b0f51a25df76316c1cd6aa8ea97d3eb213c72cb3.tar.gz calp-b0f51a25df76316c1cd6aa8ea97d3eb213c72cb3.tar.xz |
Merge branch 'master' into tooltip
Diffstat (limited to '')
-rw-r--r-- | module/server/macro.scm | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/module/server/macro.scm b/module/server/macro.scm index b9ce94bb..28565c3b 100644 --- a/module/server/macro.scm +++ b/module/server/macro.scm @@ -9,15 +9,28 @@ (define-public (parse-endpoint-string str) - (let ((rx (make-regexp ":([^/.]+)"))) + (let ((rx (make-regexp ":([^/.]+)(\\{([^}]+)\\})?([.])?"))) (let loop ((str str) (string "") (tokens '())) (let ((m (regexp-exec rx str 0))) (if (not m) + ;; done (values (string-append string str) (reverse tokens)) + (loop (match:suffix m) - (string-append string (match:prefix m) "([^/.]+)") + (string-append string (match:prefix m) + (aif (match:substring m 3) + (string-append "(" it ")") + "([^/.]+)") + ;; period directly following matched variable. + ;; since many variables break on period, we often + ;; want to match a literal period directly after them. + ;; Ideally all periods outside of pattern should be + ;; matched literally, but that's harder to implement. + (regexp-quote + (aif (match:substring m 4) + "." ""))) (cons (string->symbol (match:substring m 1)) tokens))))))) |