My agentic slop goes here. Not intended for anyone else!
1(** [Syndic.Opml1]: compliant with {{:http://dev.opml.org/spec1.html} OPML
2 1.0}.
3
4 The purpose of the {i Outline Processor Markup Language}, or OPML, is to
5 provide a way to exchange information between outliners and Internet
6 services that can be browsed or controlled through an outliner. Outlines
7 can be used for specifications, legal briefs, product plans, presentations,
8 screenplays, directories, diaries, discussion groups, chat systems and
9 stories. *)
10
11module Error : module type of Syndic_error
12
13type head =
14 { title: string (** Title of the document. *)
15 ; date_created: Syndic_date.t option
16 (** A date-time indicating when the document was created. *)
17 ; date_modified: Syndic_date.t
18 (** A date-time indicating when the document was last modified. *)
19 ; owner_name: string (** Owner of the document. *)
20 ; owner_email: string (** Email address of the owner of the document. *)
21 ; expansion_state: int list
22 (** A comma-separated list of line numbers that are expanded. The line
23 numbers in the list tell you which headlines to expand. The order
24 is important. For each element in the list, X, starting at the
25 first summit, navigate flatdown X times and expand. Repeat for each
26 element in the list. *)
27 ; vert_scroll_state: int option
28 (** A number saying which line of the outline is displayed on the top
29 line of the window. This number is calculated with the expansion
30 state already applied. *)
31 ; window_top: int option
32 (** Pixel location of the top edge of the window. *)
33 ; window_left: int option
34 (** Pixel location of the left edge of the window. *)
35 ; window_bottom: int option
36 (** Pixel location of the bottom edge of the window. *)
37 ; window_right: int option
38 (** Pixel location of the right edge of the window. *) }
39
40val head :
41 ?date_created:Syndic_date.t
42 -> ?expansion_state:int list
43 -> ?vert_scroll_state:int
44 -> ?window_top:int
45 -> ?window_left:int
46 -> ?window_bottom:int
47 -> ?window_right:int
48 -> date_modified:Syndic_date.t
49 -> owner_name:string
50 -> owner_email:string
51 -> string
52 -> head
53(** [head ~date_modified ~owner_name ~owner_email title] returns a head. By
54 default, all optional arguments leave the corresponding fields empty. *)
55
56type outline =
57 { text: string
58 (** String that's displayed when the outline is being browsed or
59 edited. There is no specific limit on the length of the text
60 attribute.*)
61 ; typ: string option
62 (** "Type" of outline. Says how other attributes of the [outline] are
63 interpreted. This is application dependent. For example, for news
64 feed, it is common to have "rss" as the value of this field. *)
65 ; is_comment: bool
66 (** Indicates whether the outline is commented or not. By convention if
67 an outline is commented, all subordinate outlines are considered to
68 be commented as well. *)
69 ; is_breakpoint: bool
70 (** Indicates whether a breakpoint is set on this outline. This
71 attribute is mainly necessary for outlines used to edit scripts
72 that execute. *)
73 ; xml_url: Uri.t option
74 (** Link to the XML data associated to this outline, typically the RSS
75 feed. *)
76 ; html_url: Uri.t option
77 (** Link to the HTML data associated to this outline, typically the
78 HTML pages rendering the news feed. *)
79 ; attrs: Xmlm.attribute list
80 (** Association list of additional attributes in the outline. *)
81 ; outlines: outline list
82 (** List of [outline] elements that are considered sub-items of the
83 current outline. *) }
84
85val outline :
86 ?typ:string
87 -> ?is_comment:bool
88 -> ?is_breakpoint:bool
89 -> ?xml_url:Uri.t
90 -> ?html_url:Uri.t
91 -> ?attrs:Xmlm.attribute list
92 -> ?outlines:outline list
93 -> string
94 -> outline
95(** [outline text] returns an outline.
96
97 @param is_comment Default: [false]. @param is_breakpoint Default: [false].
98
99 All the other parameters are bu default empty. *)
100
101(** List of outline elements. *)
102type body = outline list
103
104type t =
105 { version: string (** The version of OPML document (should be 1.0 or 1.1) *)
106 ; head: head
107 ; body: body }
108
109val parse : ?xmlbase:Uri.t -> Xmlm.input -> t
110(** [parse i] takes [i] and returns an opml record which is the OCaml
111 representation of the OPML document. *)
112
113val read : ?xmlbase:Uri.t -> string -> t
114(** [read fname] reads the file name [fname] and parses it. For the optional
115 parameters, see {!parse}. *)
116
117val to_xml : t -> Syndic_xml.t
118(** [to_xml opml] converts the OPML document [opml] to an XML tree. *)
119
120val output : t -> Xmlm.dest -> unit
121(** [output opml dest] writes the XML tree of the OPML document [opml] to
122 [dest]. *)
123
124val write : t -> string -> unit
125(** [write opml fname] writes the XML tree of the OPML document [opml] to the
126 file named [fname]. *)
127
128val of_atom : head:head -> Syndic_atom.feed list -> t
129(** [of_atom ~head feeds] returns the OPML list of authors of the atom feeds.
130 The [text] is the name associated to a feed, i.e. the name of the first
131 author in the feed authors list or, if empty, the one of the first post. It
132 is important that the feeds contain a link entry with [rel = Self] for
133 the OPML document to be able to create a [xml_url] entry pointing to the
134 feed.
135
136 As a special convention, if the length of the [rel = Self] link is
137 present and negative, the property [is_comment] is set to [true]. *)
138
139(**/**)
140
141(** An URI is given by (xmlbase, uri). The value of [xmlbase], if not [None],
142 gives the base URI against which [uri] must be resolved if it is relative. *)
143type uri = Uri.t option * string
144
145val unsafe :
146 ?xmlbase:Uri.t
147 -> Xmlm.input
148 -> [> `Opml of [> `Body of [> `Outline of ([> `Text of string
149 | `Type of string
150 | `IsBreakpoint of string
151 | `IsComment of string
152 | `Outline of 'a
153 | `XML_url of uri
154 | `HTML_url of uri
155 | `Attr of string * string ]
156 list
157 as
158 'a) ]
159 list
160 | `Head of [> `DateCreated of string
161 | `DateModified of string
162 | `ExpansionSate of string
163 | `OwnerEmail of string
164 | `OwnerName of string
165 | `Title of string
166 | `VertScrollState of string
167 | `WindowBottom of string
168 | `WindowLeft of string
169 | `WindowRight of string
170 | `WindowTop of string ]
171 list
172 | `Version of string ]
173 list ]
174(** Analysis without verification. *)
175
176(** @deprecated Use Syndic.Opml1.t instead. *)
177type opml = t