diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2021-07-19 16:04:06 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2021-07-19 16:04:06 +0200 |
commit | b7705c8cd70b9a00dfa58f3fc096000da2a42208 (patch) | |
tree | 595161a48490ebc86305db1c6396b44d31c775d4 | |
parent | Fix bug where 'base' of event repeated through multiple VEVENT:s would be "lo... (diff) | |
download | calp-b7705c8cd70b9a00dfa58f3fc096000da2a42208.tar.gz calp-b7705c8cd70b9a00dfa58f3fc096000da2a42208.tar.xz |
Add parser for Microsoft Teams generated events in sample config.
Diffstat (limited to '')
-rw-r--r-- | config.scm | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -57,6 +57,32 @@ (a (match:substring m)) (recur (match:suffix m))))))) +(define (parse-teams-description str) + (map (lambda (line) + (let loop ((line line)) + (cond [(string-match "^_+$" line) + '((hr) (br))] + ;; hyperlinks go from start of line, + ;; or from last pipe character + [(string-match "([^|<]*)<([^>]*)>" line) + => (lambda (m) + (cons* + (match:prefix m) + `(a (@ (href ,(match:substring m 2))) + ,(match:substring m 1)) + (loop (match:suffix m))))] + ;; square brackets are images + [(string-match "\\[([^]]+)\\]" line) + => (lambda (m) + (cons* + (match:prefix m) + `(img (@ (src ,(match:substring m 1)))) + (loop (match:suffix m))))] + ;; Either the full line, or the remainder + ;; after hyperlink and img match. + [else (list line '(br))]))) + (string-split str #\newline))) + (define html-cals '("D-sektionens officiella kalender" "LiTHe kod" @@ -70,6 +96,8 @@ (parse-html (regexp-substitute/global #f "<br>" str 'pre "<br/>" 'post))] + [(prop ev 'X-MICROSOFT-SKYPETEAMSMEETINGURL) + (parse-teams-description str)] [else (parse-links str)]))) (set-config! 'week-start mon) |