(define-module (calp html view small-calendar)
:use-module ((calp html components) :select (xhtml-doc include-css))
:use-module ((calp html vcomponent) :select (calendar-styles))
:use-module ((calp html caltable) :select (cal-table))
:use-module ((datetime) :select (month- month+ remove-day date->string))
:use-module ((vcomponent instance methods)
:select (get-event-set get-calendars))
:use-module ((vcomponent instance) :select (global-event-object))
)
(define-public (render-small-calendar month standalone)
(define table (cal-table
start-date: month
end-date: (remove-day (month+ month))
next-start: month+
prev-start: month-
;; TODO proper subset
event-stream: (get-event-set global-event-object)
))
(if standalone
(xhtml-doc
(head (title ,(date->string month "~1"))
,(include-css "/static/smallcal.css")
,(calendar-styles (get-calendars global-event-object))
)
(body ,table))
table))