UNPKG

4.11 kBPlain TextView Raw
1//
2// Adapted from:
3// https://validator.w3.org/feed/docs/atom.html
4//
5
6/** representation of <category> element */
7export interface AtomCategory {
8 /** identifies the category */
9 term: string;
10 /** identifies the categorization scheme via a URI. */
11 scheme?: string;
12 /** provides a human-readable label for display */
13 label?: string;
14}
15
16/**
17 * <content> either contains, or links to, the complete content of the entry.
18 * In the most common case, the `type` attribute is either `text`, `html`, `xhtml`, in which case the content element is defined identically to other text constructs, which are described here.
19 * Otherwise, if the `src` attribute is present, it represents the URI of where the content can be found. The `type` attribute, if present, is the media type of the content.
20 * Otherwise, if the `type` attribute ends in `+xml` or `/xml`, then an xml document of this type is contained inline.
21 * Otherwise, if the `type` attribute starts with `text`, then an escaped document of this type is contained inline.
22 * Otherwise, a base64 encoded document of the indicated media type is contained inline.
23 */
24export interface AtomContent {
25 type?: AtomTextType;
26 src?: string;
27 /** the value stored here should be safe, unescaped HTML that can be put anywhere */
28 value: string;
29}
30
31/**
32 * <link> is patterned after html's link element. It has one required attribute, `href`, and five optional attributes: `rel`, `type`, `hreflang`, `title`, and `length`.
33 */
34export interface AtomLink {
35 /** `href` is the URI of the referenced resource (typically a Web page) */
36 href: string;
37 /**
38 * rel contains a single link relationship type. It can be a full URI (see extensibility), or one of the following predefined values (default=`alternate`):
39 * - `alternate`: an alternate representation of the entry or feed, for example a permalink to the html version of the entry, or the front page of the weblog.
40 * - `enclosure`: a related resource which is potentially large in size and might require special handling, for example an audio or video recording.
41 * - `related`: an document related to the entry or feed.
42 * - `self`: the feed itself.
43 * - `via`: the source of the information provided in the entry.
44 */
45 rel?: AtomLinkRelType;
46 /** `type` indicates the media type of the resource. */
47 type?: string;
48 /** `hreflang` indicates the language of the referenced resource. */
49 hreflang?: string;
50 /** `title`, human readable information about the link, typically for display purposes. */
51 title?: string;
52 /** `length`, the length of the resource, in bytes. */
53 length?: string;
54}
55
56/** describes a person, corporation, or similar entity. */
57export interface AtomPerson {
58 /** conveys a human-readable name for the person. */
59 name: string;
60 /** contains a home page for the person. */
61 uri?: string;
62 /** contains an email address for the person. */
63 email?: string;
64}
65
66export type AtomLinkRelType = 'alternate' | 'enclosure' | 'related' | 'self' | 'via';
67
68/** representation of <author> element */
69export interface AtomAuthor extends AtomPerson {}
70/** representation of <contributor> element */
71export interface AtomContributor extends AtomPerson {}
72
73/**
74 * <title>, <summary>, <content>, and <rights> contain human-readable text, usually in small quantities. The type attribute determines how this information is encoded (default="text")
75 * - If `type="text"`, then this element contains plain text with no entity escaped html.
76 * - If `type="html"`, then this element contains entity escaped html.
77 * - If `type="xhtml"`, then this element contains inline xhtml, wrapped in a div element.
78 */
79export interface AtomText {
80 type?: AtomTextType;
81 value: string;
82}
83
84export type AtomTextType = 'text' | 'html' | 'xhtml';
85
86/** representation of <title> element */
87export interface AtomTitle extends AtomText {}
88/** representation of <summary> element */
89export interface AtomSummary extends AtomText {}
90/** representation of <rights> element */
91export interface AtomRights extends AtomText {}
92