aboutsummaryrefslogtreecommitdiff
path: root/module/output/common.scm
blob: f572a2828947fe6d7b15f9f8f805dfd6e4128753 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
;;; Commentary:
;; Common code between all serializers.
;; (ical and xcal). Not for graphical output stuff.
;;; Code:

(define-module (output common)
  :use-module (util)
  :use-module (srfi srfi-1)
  :use-module (vcomponent)
  )


(define*-public (internal-field? symbol optional: (prefix "X-HNH-"))
  (string=? prefix
            (string-take-to (symbol->string symbol)
                            (string-length prefix))))

(define-public (->string a)
  (with-output-to-string (lambda () (display a))))

(define-public (get-tz-names events)
  (lset-difference
   equal? (lset-union
           equal? '("dummy")
           (filter-map
            (lambda (vline) (and=> (param vline 'TZID) car))
            (filter-map (extract* 'DTSTART)
                        events)))
   '("dummy" "local")))

(define-public (downcase-symbol symb)
  (-> symb
      symbol->string
      string-downcase
      string->symbol))