Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge file structure with overview section #739

Merged
merged 10 commits into from
Nov 21, 2024
Merged
47 changes: 19 additions & 28 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,69 +25,60 @@ We do not claim compatibility to the following RFCs. They might work though.
- :rfc:`9073` - Event Publishing Extensions to iCalendar
- :rfc:`9253` - Support for iCalendar Relationships

File structure
iCalendar File structure
--------------
natashamm marked this conversation as resolved.
Show resolved Hide resolved

An iCalendar file is a text file (utf-8) with a special format. Basically it
consists of content lines.
An iCalendar file is a text file (utf-8) with a special format.
natashamm marked this conversation as resolved.
Show resolved Hide resolved

Each content line defines a property that has 3 parts (name, parameters,
values). Parameters are optional.
It consists of **content lines**,
with each content line defining a property that has 3 parts: name, parameters and value. Parameters are optional.
natashamm marked this conversation as resolved.
Show resolved Hide resolved

A simple content line with only name and value could look like this::
Example 1: a simple content line (with only name and value)::
natashamm marked this conversation as resolved.
Show resolved Hide resolved

BEGIN:VCALENDAR
natashamm marked this conversation as resolved.
Show resolved Hide resolved

A content line with parameters can look like this::
Example 2: a content line with parameters::

ATTENDEE;CN=Max Rasmussen;ROLE=REQ-PARTICIPANT:MAILTO:[email protected]

And the parts are::
The parts in this example are::

Name: ATTENDEE
Params: CN=Max Rasmussen;ROLE=REQ-PARTICIPANT
Value: MAILTO:[email protected]

Long content lines are usually "folded" to less than 75 character, but the
package takes care of that.
Note: Long content lines are usually "folded" to less than 75 characters (the
natashamm marked this conversation as resolved.
Show resolved Hide resolved
package takes care of this).
natashamm marked this conversation as resolved.
Show resolved Hide resolved

On a higher level, you can think of iCalendar files structured as having components and sub components.
natashamm marked this conversation as resolved.
Show resolved Hide resolved

Overview
--------
A component will have properties with values. The values
have special types, like integer, text, and datetime. These values are
encoded in a special text format in an iCalendar file. This package contains methods for converting to and from these encodings.
stevepiercy marked this conversation as resolved.
Show resolved Hide resolved

On a higher level iCalendar files consists of components. Components can have
sub components.

The root component is the VCALENDAR::
Example 1: this is a VCALENDAR component representing a calendar::

BEGIN:VCALENDAR
... vcalendar properties ...
END:VCALENDAR

The most frequent subcomponent to a VCALENDAR is a VEVENT. They are
nested like this::
Example 2: The most frequent subcomponent to a VCALENDAR component is a VEVENT. This is a VCALENDAR component with a nested VEVENT subcomponent::

BEGIN:VCALENDAR
... vcalendar properties ...
BEGIN:VEVENT
... vevent properties ...
END:VEVENT
END:VCALENDAR
END:VCALENDAR

Inside the components there are properties with values. The values
have special types. Like integer, text, datetime etc. these values are
encoded in a special text format in an iCalendar file.

There are methods for converting to and from these encodings in the package.
Components
----------

These are the most important imports::
Note: The code snippets remainder of the docs will use these important imports::
natashamm marked this conversation as resolved.
Show resolved Hide resolved

>>> from icalendar import Calendar, Event


Components
----------

Components are like (Case Insensitive) dicts. So if you want to set a property
you do it like this. The calendar is a component::

Expand Down
Loading