package syndic

  1. Overview
  2. Docs

Syndic.Opml1: compliant with OPML 1.0.

The purpose of the Outline Processor Markup Language, or OPML, is to provide a way to exchange information between outliners and Internet services that can be browsed or controlled through an outliner. Outlines can be used for specifications, legal briefs, product plans, presentations, screenplays, directories, diaries, discussion groups, chat systems and stories.

module Error : module type of Syndic_error

The common signature that all error modules must (at least) satisfy.

type head = {
  1. title : string;
    (*

    Title of the document.

    *)
  2. date_created : Syndic_date.t option;
    (*

    A date-time indicating when the document was created.

    *)
  3. date_modified : Syndic_date.t;
    (*

    A date-time indicating when the document was last modified.

    *)
  4. owner_name : string;
    (*

    Owner of the document.

    *)
  5. owner_email : string;
    (*

    Email address of the owner of the document.

    *)
  6. expansion_state : int list;
    (*

    A comma-separated list of line numbers that are expanded. The line numbers in the list tell you which headlines to expand. The order is important. For each element in the list, X, starting at the first summit, navigate flatdown X times and expand. Repeat for each element in the list.

    *)
  7. vert_scroll_state : int option;
    (*

    A number saying which line of the outline is displayed on the top line of the window. This number is calculated with the expansion state already applied.

    *)
  8. window_top : int option;
    (*

    Pixel location of the top edge of the window.

    *)
  9. window_left : int option;
    (*

    Pixel location of the left edge of the window.

    *)
  10. window_bottom : int option;
    (*

    Pixel location of the bottom edge of the window.

    *)
  11. window_right : int option;
    (*

    Pixel location of the right edge of the window.

    *)
}
val head : ?date_created:Syndic_date.t -> ?expansion_state:int list -> ?vert_scroll_state:int -> ?window_top:int -> ?window_left:int -> ?window_bottom:int -> ?window_right:int -> date_modified:Syndic_date.t -> owner_name:string -> owner_email:string -> string -> head

head ~date_modified ~owner_name ~owner_email title returns a head. By default, all optional arguments leave the corresponding fields empty.

type outline = {
  1. text : string;
    (*

    String that's displayed when the outline is being browsed or edited. There is no specific limit on the length of the text attribute.

    *)
  2. typ : string option;
    (*

    "Type" of outline. Says how other attributes of the outline are interpreted. This is application dependent. For example, for news feed, it is common to have "rss" as the value of this field.

    *)
  3. is_comment : bool;
    (*

    Indicates whether the outline is commented or not. By convention if an outline is commented, all subordinate outlines are considered to be commented as well.

    *)
  4. is_breakpoint : bool;
    (*

    Indicates whether a breakpoint is set on this outline. This attribute is mainly necessary for outlines used to edit scripts that execute.

    *)
  5. xml_url : Uri.t option;
    (*

    Link to the XML data associated to this outline, typically the RSS feed.

    *)
  6. html_url : Uri.t option;
    (*

    Link to the HTML data associated to this outline, typically the HTML pages rendering the news feed.

    *)
  7. attrs : Xmlm.attribute list;
    (*

    Association list of additional attributes in the outline.

    *)
  8. outlines : outline list;
    (*

    List of outline elements that are considered sub-items of the current outline.

    *)
}
val outline : ?typ:string -> ?is_comment:bool -> ?is_breakpoint:bool -> ?xml_url:Uri.t -> ?html_url:Uri.t -> ?attrs:Xmlm.attribute list -> ?outlines:outline list -> string -> outline

outline text returns an outline.

  • parameter is_comment

    Default: false.

  • parameter is_breakpoint

    Default: false.

    All the other parameters are bu default empty.

type body = outline list

List of outline elements.

type t = {
  1. version : string;
    (*

    The version of OPML document (should be 1.0 or 1.1)

    *)
  2. head : head;
  3. body : body;
}
val parse : ?xmlbase:Uri.t -> Xmlm.input -> t

parse i takes i and returns an opml record which is the OCaml representation of the OPML document.

val read : ?xmlbase:Uri.t -> string -> t

read fname reads the file name fname and parses it. For the optional parameters, see parse.

val to_xml : t -> Syndic_xml.t

to_xml opml converts the OPML document opml to an XML tree.

val output : t -> Xmlm.dest -> unit

output opml dest writes the XML tree of the OPML document opml to dest.

val write : t -> string -> unit

write opml fname writes the XML tree of the OPML document opml to the file named fname.

val of_atom : head:head -> Syndic_atom.feed list -> t

of_atom ~head feeds returns the OPML list of authors of the atom feeds. The text is the name associated to a feed, i.e. the name of the first author in the feed authors list or, if empty, the one of the first post. It is important that the feeds contain a link entry with rel = Self for the OPML document to be able to create a xml_url entry pointing to the feed.

As a special convention, if the length of the rel = Self link is present and negative, the property is_comment is set to true.

OCaml

Innovation. Community. Security.