aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-03-08 00:24:17 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2022-03-15 01:43:12 +0100
commitcf43fc7699a079ae18c494608ff38f868f2046cf (patch)
tree1681b79de868dbdb846a90473dd32eec1cb55a31
parentRespecificy return value of with-atomic-output-to-file. (diff)
downloadcalp-cf43fc7699a079ae18c494608ff38f868f2046cf.tar.gz
calp-cf43fc7699a079ae18c494608ff38f868f2046cf.tar.xz
Move summary-filter and description-filter configs to more sensible place.
-rw-r--r--module/calp/html/vcomponent.scm24
-rw-r--r--module/calp/html/view/calendar/shared.scm4
-rw-r--r--module/vcomponent/datetime/output.scm17
3 files changed, 22 insertions, 23 deletions
diff --git a/module/calp/html/vcomponent.scm b/module/calp/html/vcomponent.scm
index 28024af2..87b22eaf 100644
--- a/module/calp/html/vcomponent.scm
+++ b/module/calp/html/vcomponent.scm
@@ -3,6 +3,7 @@
;; TODO should we really use path-append here? Path append is
;; system-dependant, while URL-paths aren't.
:use-module ((hnh util path) :select (path-append))
+ :use-module ((hnh util exceptions) :select (warning))
:use-module (srfi srfi-1)
:use-module (srfi srfi-41)
:use-module ((rnrs io ports) :select (put-bytevector))
@@ -18,15 +19,32 @@
:use-module ((vcomponent recurrence) :select (repeating?))
:use-module ((vcomponent datetime output)
:select (fmt-time-span
- format-description
- format-summary
format-recurrence-rule
))
- :use-module ((calp util config) :select (get-config))
+ :use-module (calp util config)
:use-module ((base64) :select (base64encode))
:use-module (ice-9 format)
)
+
+(define-config summary-filter (lambda (_ a) a)
+ pre: (ensure procedure?))
+
+(define-config description-filter (lambda (_ a) a)
+ pre: (ensure procedure?))
+
+
+(define-public (format-summary ev str)
+ ((get-config 'summary-filter) ev str))
+
+;; NOTE this should have information about context (html/term/...)
+;; And then be moved somewhere else.
+(define-public (format-description ev str)
+ (catch #t (lambda () ((get-config 'description-filter) ev str))
+ (lambda (err . args)
+ (warning "~a on formatting description, ~s" err args)
+ str)))
+
;; used by search view
(define-public (compact-event-list list)
diff --git a/module/calp/html/view/calendar/shared.scm b/module/calp/html/view/calendar/shared.scm
index b00888a9..3e6ff105 100644
--- a/module/calp/html/view/calendar/shared.scm
+++ b/module/calp/html/view/calendar/shared.scm
@@ -7,15 +7,13 @@
:select (event-length
overlapping?
event-length/clamped))
- :use-module ((vcomponent datetime output)
- :select (format-summary))
:use-module (hnh util tree)
:use-module (datetime)
:use-module (calp html config)
:use-module ((calp html components)
:select (btn tabset))
:use-module ((calp html vcomponent)
- :select (make-block) )
+ :select (make-block format-summary))
:use-module (ice-9 format)
)
diff --git a/module/vcomponent/datetime/output.scm b/module/vcomponent/datetime/output.scm
index fa662286..2b528423 100644
--- a/module/vcomponent/datetime/output.scm
+++ b/module/vcomponent/datetime/output.scm
@@ -1,18 +1,10 @@
(define-module (vcomponent datetime output)
:use-module (hnh util)
- :use-module (calp util config)
- :use-module (hnh util exceptions)
:use-module (datetime)
:use-module (vcomponent base)
:use-module (text util)
)
-(define-config summary-filter (lambda (_ a) a)
- pre: (ensure procedure?))
-
-(define-config description-filter (lambda (_ a) a)
- pre: (ensure procedure?))
-
;; ev → sxml
(define-public (format-recurrence-rule ev)
`("Upprepas "
@@ -36,15 +28,6 @@
(map value it)))))
"."))
-(define-public (format-summary ev str)
- ((get-config 'summary-filter) ev str))
-
-;; NOTE this should have information about context (html/term/...)
-(define-public (format-description ev str)
- (catch #t (lambda () ((get-config 'description-filter) ev str))
- (lambda (err . args)
- (warning "~a on formatting description, ~s" err args)
- str)))
;; Takes an event, and returns a pretty string for the time interval
;; the event occupies.