From d00fea566004e67161ee45246b239fff5d416b0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Tue, 21 Dec 2021 16:17:28 +0100 Subject: Cleanup modules. Primarly this moves all vcompenent input and output code to clearly labeled modules, instead of being spread out. At the same time it also removes a handfull of unused procedures. --- doc/ref/guile.texi | 103 +++++++++++++++++++++++++++++++++++++ doc/ref/guile/vcomponent.texi | 117 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 220 insertions(+) create mode 100644 doc/ref/guile/vcomponent.texi (limited to 'doc') diff --git a/doc/ref/guile.texi b/doc/ref/guile.texi index b21850bd..f7373767 100644 --- a/doc/ref/guile.texi +++ b/doc/ref/guile.texi @@ -2,6 +2,109 @@ @chapter Guile @include guile/util.texi +@include guile/vcomponent.texi + + +@node Other +@section Other + +@defun get-parser type +@example +get-parser ∷ type-name → hash-table x string → any +type = 'BINARY | 'BOOLEAN | 'CAL-ADDRES | 'DATE | 'DATE-TIME + | 'DURATION | 'FLOAT | 'INTEGER | 'PERIOD | 'RECUR + | 'TEXT | 'TIME | 'URI | 'UTC-OFFSET +@end example + +@ref{ical-get-writer} +@end defun + +@subsection formats ical +@subsubsection output + +@defun component->ical-string component +@end defun + +@defun print-components-with-fake-parent events +@end defun + +@defun print-all-events +@end defun + +@defun print-events-in-interval start end +@end defun + +@subsubsection parse + +@defun parse-calendar port +@end defun + +@subsubsection types + +@defun escape-chars str +Escape ``@verb{|,|}'', ``@verb{|;|}'' and ``@verb{|\|}'' with a +backslash, and encode newlines as ``@verb{|\n|}''. +@end defun + +@defun get-writer type +@anchor{ical-get-writer} +@example +get-writer ∷ type-name → hash-table x value → string +type = 'BINARY | 'BOOLEAN | 'CAL-ADDRES | 'DATE | 'DATE-TIME + | 'DURATION | 'FLOAT | 'INTEGER | 'PERIOD | 'RECUR + | 'TEXT | 'TIME | 'URI | 'UTC-OFFSET +@end example +@end defun + +@subsection formats vdir +@subsubsection parse + +@defun parse-vdir path +@end defun + +@subsubsection save-delete + +@defun save-event event +@end defun + +@defun remove-event event +@end defun + +@subsection formats xcal +@subsubsection output + +@defun vcomponent->sxcal component +@end defun + +@defun ns-wrap +@lisp +(define (ns-wrap sxml) + `(icalendar (@ (xmlns "urn:ietf:params:xml:ns:icalendar-2.0")) + ,sxml)) +@end lisp +Where @var{sxml} is expected to be the output of @var{vcomponent->sxcal}. +@end defun + +@subsubsection parse +@defun sxcal->vcomponent sxcal +Parses a vcomponent in sxcal format. Requires that the vcomponent is +the root of the document (fragment), so wrapping icalendar-tags or +similar @emph{must} be removed. + +@example +(vcalendar + (properties ...) + (components ...)) +@end example +@end defun + +@subsubsection types +@defun get-writer type +@ref{ical-get-writer} +@end defun + + +@c -------------------------------------------------- @c TODO This chapter will probably in the future be replaced by a proper diff --git a/doc/ref/guile/vcomponent.texi b/doc/ref/guile/vcomponent.texi new file mode 100644 index 00000000..299ae1da --- /dev/null +++ b/doc/ref/guile/vcomponent.texi @@ -0,0 +1,117 @@ +@node VComponent +@section (vcomponent) + +@defvr {Configuration Variable} calendar-files +List of filepaths +@end defvr + +@defvr {Configuration Variable} default-calendar +@end defvr + +@c ===== Concepts ===== + +@c - internal fields +@c DATA layout +@c how does multiple value work? + +@c ===== BASE ===== + +@deftp {Record Type} + +@c - key +@c - value +@c - parameters +@c - source + +@defun make-vline key value [ht=(make-hash-table)] +@var{ht} is the hash table storing the parameters, can be explicitly +given if need for optimizations arrises. +@end defun + +@defun vline? x +@end defun + +@defun vline-key vline +@end defun + +@deffn {Slot} vline-source vline +@end deffn + +@deffn {Slot} value vline +@end deffn + +@deffn {Slot} param vline key +@end deffn + +@defun delete-parameter! vline key +@end defun + +@defun parameters vline +Key a list of all parameters +@example +((key value) ...) +@end example +@end defun + +@end deftp + + +@deftp {Record Type} + +@defun vcomponent? x +@end defun + +@defun make-vcomponent [type='VIRTUAL] +@end defun + +@defun children vcomponent +Returns all direct children of vcomponent, as a list of vcomponents. +@end defun + +@deffn {Slot} parent vcomonent +@end deffn + +@defun type vcomponent +Returns the type of this vcomponent, as a symbol. Probably one of +@code{VCALENDAR}, @code{VEVENT}, ... +@end defun + +@defun add-child! parent child +Adds child to the parents child list, but also updates the child to +have parent in its parent slot +@end defun + +@deffn {Prop} prop* vcomponent key +@deffnx {Prop} prop vcomponent key +@var{prop*} return the vline object, while @var{prop} is equivalent to +@lisp +(value (prop* vcomponent key)) +@end lisp +@end deffn + +@deffn (extract field) vcomponent +@deffnx (extract* field) vcomponent +Curried version of @var{prop}. +@end deffn + +@defun delete-property! component key +@end defun + +@defun properties comopnent +@example +((key . value) ...) +@end example +@end defun + +@end deftp + +@defun copy-vcomponent vcomponent +@end defun + + +@defun x-property? symb +Does symbol start with ``X-''? +@end defun + +@defun internal-field? symb [prefix="-"] +@end defun -- cgit v1.2.3