package eliom

  1. Overview
  2. Docs
On This Page
  1. Content creation
Legend:
Library
Module
Module type
Parameter
Class
Class type

Creation of functional HTML5 content (copy-able but not referable).

Content creation

See <<a_api project="tyxml" | module Html_sigs.T >>

module Raw : Html_sigs.Make(Xml)(Svg.F.Raw).T with type +'a elt = 'a elt and type +'a attrib = 'a attrib

Cf. <<a_api project="tyxml" | module Html_sigs.T >> .

include module type of Raw

Cf. <<a_api project="tyxml" | module Html_sigs.T >> .

type +'a elt = 'a elt

HTML elements.

Element constructors are in section elements. Most elements constructors are either nullary, unary or star, depending on the number of children they accept. Children are usually given as a list of elements. txt is used for text.

div [a [txt "Foo"]] is equivalent to <div><a>foo</a></div>

The type variable 'a is used to track the element's type. This allows the OCaml typechecker to check HTML validity.

For example, div [] is of type [> `Div] elt. The span function only accepts children of type Html_types.span_content. Since `Div is not part of it. span [div []] will not typecheck.

Note that the concrete implementation of this type can vary. See Xml for details.

type doc = Html_types.html elt

A complete HTML document.

type +'a attrib = 'a attrib

HTML attributes

Attribute constructors are in section attributes and their name starts with a_. Attributes are given to elements with the ~a optional argument.

a ~a:[a_href "ocsigen.org"] [txt "link!"] is equivalent to <a href="ocsigen.org">link!</a>

Similarly to elt, attributes use the OCaml type system to enforce HTML validity.

For example a_href returns a value of type [> `Href] attrib. The div function only accepts attributes of type Html_types.div_attrib. Since `Href is not part of it, div ~a:[a_href "ocsigen.org"] [] will not typecheck.

In some cases, attributes have to be disambiguated. The max attribute has two version, a_max and a_input_max, depending on the element. Such disambiguated attribute will contain the name of the associated element.

module Xml : Xml_sigs.T with type 'a W.t = 'a Xml.W.t with type 'a W.tlist = 'a Xml.W.tlist with type ('a, 'b) W.ft = ('a, 'b) Xml.W.ft with type uri = Xml.uri with type event_handler = Xml.event_handler with type mouse_event_handler = Xml.mouse_event_handler with type keyboard_event_handler = Xml.keyboard_event_handler with type touch_event_handler = Xml.touch_event_handler with type attrib = Xml.attrib with type elt = Xml.elt

Underlying XML data-structure

type 'a wrap = 'a Xml.W.t

wrap is a container for elements and values.

In most cases, 'a wrap = 'a. For R modules (in eliom or js_of_ocaml), It will be React.S.t.

type 'a list_wrap = 'a Xml.W.tlist

list_wrap is a container for list of elements.

In most cases, 'a list_wrap = 'a list. For R modules (in eliom or js_of_ocaml), It will be ReactiveData.RList.t.

type ('a, 'b) nullary = ?a:'a attrib list -> unit -> 'b elt

A nullary element is an element that doesn't have any children.

type ('a, 'b, 'c) unary = ?a:'a attrib list -> 'b elt wrap -> 'c elt

A unary element is an element that have exactly one children.

type ('a, 'b, 'c) star = ?a:'a attrib list -> 'b elt list_wrap -> 'c elt

A star element is an element that has any number of children, including zero.

Various information about HTML, such as the doctype, ...

Uri

type uri = Xml.uri
val string_of_uri : (uri, string) Xml.W.ft

Attributes

val a_class : Html_types.nmtokens wrap -> [> `Class ] attrib

This attribute assigns a class name or set of class names to an element. Any number of elements may be assigned the same class name or names.

val a_user_data : Html_types.nmtoken -> Html_types.text wrap -> [> `User_data ] attrib

May be used to specify custom attributes. The example given by the W3C is as follows :

<ol>
  <li data-length="2m11s">Beyond The Sea</li>
</ol>

It should be used for preprocessing ends only.

val a_id : Html_types.text wrap -> [> `Id ] attrib

This attribute assigns a name to an element. This name must be unique in a document. The text should be without any space.

val a_title : Html_types.text wrap -> [> `Title ] attrib

This attribute offers advisory information about the element for which it is set.

Values of the title attribute may be rendered by user agents in a variety of ways. For instance, visual browsers frequently display the title as a tool tip (a short message that appears when the pointing device pauses over an object). Audio user agents may speak the title information in a similar context.

The title attribute has an additional role when used with the link element to designate an external style sheet. Please consult the section on links and style sheets for details.

I18N

val a_xml_lang : Html_types.languagecode wrap -> [> `XML_lang ] attrib
val a_lang : Html_types.languagecode wrap -> [> `Lang ] attrib

Events

Javascript events
val a_onabort : Xml.event_handler -> [> `OnAbort ] attrib
val a_onafterprint : Xml.event_handler -> [> `OnAfterPrint ] attrib
val a_onbeforeprint : Xml.event_handler -> [> `OnBeforePrint ] attrib
val a_onbeforeunload : Xml.event_handler -> [> `OnBeforeUnload ] attrib
val a_onblur : Xml.event_handler -> [> `OnBlur ] attrib
val a_oncanplay : Xml.event_handler -> [> `OnCanPlay ] attrib
val a_oncanplaythrough : Xml.event_handler -> [> `OnCanPlayThrough ] attrib
val a_onchange : Xml.event_handler -> [> `OnChange ] attrib
val a_ondurationchange : Xml.event_handler -> [> `OnDurationChange ] attrib
val a_onemptied : Xml.event_handler -> [> `OnEmptied ] attrib
val a_onended : Xml.event_handler -> [> `OnEnded ] attrib
val a_onerror : Xml.event_handler -> [> `OnError ] attrib
val a_onfocus : Xml.event_handler -> [> `OnFocus ] attrib
val a_onformchange : Xml.event_handler -> [> `OnFormChange ] attrib
val a_onforminput : Xml.event_handler -> [> `OnFormInput ] attrib
val a_onhashchange : Xml.event_handler -> [> `OnHashChange ] attrib
val a_oninput : Xml.event_handler -> [> `OnInput ] attrib
val a_oninvalid : Xml.event_handler -> [> `OnInvalid ] attrib
val a_onmousewheel : Xml.event_handler -> [> `OnMouseWheel ] attrib
val a_onoffline : Xml.event_handler -> [> `OnOffLine ] attrib
val a_ononline : Xml.event_handler -> [> `OnOnLine ] attrib
val a_onpause : Xml.event_handler -> [> `OnPause ] attrib
val a_onplay : Xml.event_handler -> [> `OnPlay ] attrib
val a_onplaying : Xml.event_handler -> [> `OnPlaying ] attrib
val a_onpagehide : Xml.event_handler -> [> `OnPageHide ] attrib
val a_onpageshow : Xml.event_handler -> [> `OnPageShow ] attrib
val a_onpopstate : Xml.event_handler -> [> `OnPopState ] attrib
val a_onprogress : Xml.event_handler -> [> `OnProgress ] attrib
val a_onratechange : Xml.event_handler -> [> `OnRateChange ] attrib
val a_onreadystatechange : Xml.event_handler -> [> `OnReadyStateChange ] attrib
val a_onredo : Xml.event_handler -> [> `OnRedo ] attrib
val a_onresize : Xml.event_handler -> [> `OnResize ] attrib
val a_onscroll : Xml.event_handler -> [> `OnScroll ] attrib
val a_onseeked : Xml.event_handler -> [> `OnSeeked ] attrib
val a_onseeking : Xml.event_handler -> [> `OnSeeking ] attrib
val a_onselect : Xml.event_handler -> [> `OnSelect ] attrib
val a_onshow : Xml.event_handler -> [> `OnShow ] attrib
val a_onstalled : Xml.event_handler -> [> `OnStalled ] attrib
val a_onstorage : Xml.event_handler -> [> `OnStorage ] attrib
val a_onsubmit : Xml.event_handler -> [> `OnSubmit ] attrib
val a_onsuspend : Xml.event_handler -> [> `OnSuspend ] attrib
val a_ontimeupdate : Xml.event_handler -> [> `OnTimeUpdate ] attrib
val a_onundo : Xml.event_handler -> [> `OnUndo ] attrib
val a_onunload : Xml.event_handler -> [> `OnUnload ] attrib
val a_onvolumechange : Xml.event_handler -> [> `OnVolumeChange ] attrib
val a_onwaiting : Xml.event_handler -> [> `OnWaiting ] attrib
val a_onload : Xml.event_handler -> [> `OnLoad ] attrib
val a_onloadeddata : Xml.event_handler -> [> `OnLoadedData ] attrib
val a_onloadedmetadata : Xml.event_handler -> [> `OnLoadedMetaData ] attrib
val a_onloadstart : Xml.event_handler -> [> `OnLoadStart ] attrib
val a_onmessage : Xml.event_handler -> [> `OnMessage ] attrib
Mouse events
val a_onclick : Xml.mouse_event_handler -> [> `OnClick ] attrib
val a_oncontextmenu : Xml.mouse_event_handler -> [> `OnContextMenu ] attrib
val a_ondblclick : Xml.mouse_event_handler -> [> `OnDblClick ] attrib
val a_ondrag : Xml.mouse_event_handler -> [> `OnDrag ] attrib
val a_ondragend : Xml.mouse_event_handler -> [> `OnDragEnd ] attrib
val a_ondragenter : Xml.mouse_event_handler -> [> `OnDragEnter ] attrib
val a_ondragleave : Xml.mouse_event_handler -> [> `OnDragLeave ] attrib
val a_ondragover : Xml.mouse_event_handler -> [> `OnDragOver ] attrib
val a_ondragstart : Xml.mouse_event_handler -> [> `OnDragStart ] attrib
val a_ondrop : Xml.mouse_event_handler -> [> `OnDrop ] attrib
val a_onmousedown : Xml.mouse_event_handler -> [> `OnMouseDown ] attrib
val a_onmouseup : Xml.mouse_event_handler -> [> `OnMouseUp ] attrib
val a_onmouseover : Xml.mouse_event_handler -> [> `OnMouseOver ] attrib
val a_onmousemove : Xml.mouse_event_handler -> [> `OnMouseMove ] attrib
val a_onmouseout : Xml.mouse_event_handler -> [> `OnMouseOut ] attrib
val a_ontouchstart : Xml.touch_event_handler -> [> `OnTouchStart ] attrib

Touch events

val a_ontouchend : Xml.touch_event_handler -> [> `OnTouchEnd ] attrib
val a_ontouchmove : Xml.touch_event_handler -> [> `OnTouchMove ] attrib
val a_ontouchcancel : Xml.touch_event_handler -> [> `OnTouchCancel ] attrib
Keyboard events
val a_onkeypress : Xml.keyboard_event_handler -> [> `OnKeyPress ] attrib
val a_onkeydown : Xml.keyboard_event_handler -> [> `OnKeyDown ] attrib
val a_onkeyup : Xml.keyboard_event_handler -> [> `OnKeyUp ] attrib

Other attributes

val a_allowfullscreen : unit -> [> `Allowfullscreen ] attrib
val a_allowpaymentrequest : unit -> [> `Allowpaymentrequest ] attrib
val a_autocomplete : bool wrap -> [> `Autocomplete ] attrib
val a_async : unit -> [> `Async ] attrib
val a_autofocus : unit -> [> `Autofocus ] attrib
val a_autoplay : unit -> [> `Autoplay ] attrib
val a_muted : unit -> [> `Muted ] attrib
val a_crossorigin : [< `Anonymous | `Use_credentials ] wrap -> [> `Crossorigin ] attrib
val a_integrity : string wrap -> [> `Integrity ] attrib
val a_mediagroup : string wrap -> [> `Mediagroup ] attrib
val a_challenge : Html_types.text wrap -> [> `Challenge ] attrib
val a_contenteditable : bool wrap -> [> `Contenteditable ] attrib
val a_contextmenu : Html_types.idref wrap -> [> `Contextmenu ] attrib
val a_controls : unit -> [> `Controls ] attrib
val a_dir : [< `Rtl | `Ltr ] wrap -> [> `Dir ] attrib
val a_draggable : bool wrap -> [> `Draggable ] attrib
val a_form : Html_types.idref wrap -> [> `Form ] attrib
val a_formaction : Xml.uri wrap -> [> `Formaction ] attrib
val a_formenctype : Html_types.contenttype wrap -> [> `Formenctype ] attrib
val a_formnovalidate : unit -> [> `Formnovalidate ] attrib
val a_formtarget : Html_types.text wrap -> [> `Formtarget ] attrib
val a_hidden : unit -> [> `Hidden ] attrib
val a_high : Html_types.float_number wrap -> [> `High ] attrib
val a_icon : Xml.uri wrap -> [> `Icon ] attrib
val a_ismap : unit -> [> `Ismap ] attrib
val a_keytype : Html_types.text wrap -> [> `Keytype ] attrib
val a_list : Html_types.idref wrap -> [> `List ] attrib
val a_loop : unit -> [> `Loop ] attrib
val a_low : Html_types.float_number wrap -> [> `High ] attrib
val a_max : Html_types.float_number wrap -> [> `Max ] attrib
val a_input_max : Html_types.number_or_datetime wrap -> [> `Input_Max ] attrib
val a_min : Html_types.float_number wrap -> [> `Min ] attrib
val a_input_min : Html_types.number_or_datetime wrap -> [> `Input_Min ] attrib
val a_inputmode : [< `Verbatim | `Latin | `Latin_name | `Latin_prose | `Full_width_latin | `Kana | `Katakana | `Numeric | `Tel | `Email | `Url ] wrap -> [> `Inputmode ] attrib
val a_novalidate : unit -> [> `Novalidate ] attrib
val a_open : unit -> [> `Open ] attrib
val a_optimum : Html_types.float_number wrap -> [> `Optimum ] attrib
val a_pattern : Html_types.text wrap -> [> `Pattern ] attrib
val a_placeholder : Html_types.text wrap -> [> `Placeholder ] attrib
val a_poster : Xml.uri wrap -> [> `Poster ] attrib
val a_preload : [< `None | `Metadata | `Audio ] wrap -> [> `Preload ] attrib
val a_pubdate : unit -> [> `Pubdate ] attrib
val a_radiogroup : Html_types.text wrap -> [> `Radiogroup ] attrib
val a_required : unit -> [> `Required ] attrib
val a_reversed : unit -> [> `Reversed ] attrib
val a_sandbox : [< Html_types.sandbox_token ] list wrap -> [> `Sandbox ] attrib
val a_spellcheck : bool wrap -> [> `Spellcheck ] attrib
val a_scoped : unit -> [> `Scoped ] attrib
val a_seamless : unit -> [> `Seamless ] attrib
val a_sizes : (Html_types.number * Html_types.number) list option wrap -> [> `Sizes ] attrib
val a_span : Html_types.number wrap -> [> `Span ] attrib
val a_srclang : Html_types.nmtoken wrap -> [> `XML_lang ] attrib
type image_candidate = [
  1. | `Url of uri
  2. | `Url_width of uri * Html_types.number
  3. | `Url_pixel of uri * Html_types.float_number
]
val a_srcset : image_candidate list wrap -> [> `Srcset ] attrib
val a_img_sizes : Html_types.text list wrap -> [> `Img_sizes ] attrib
val a_start : Html_types.number wrap -> [> `Start ] attrib
val a_step : Html_types.float_number option wrap -> [> `Step ] attrib
val a_wrap : [< `Soft | `Hard ] wrap -> [> `Wrap ] attrib
val a_version : Html_types.cdata wrap -> [> `Version ] attrib
val a_xmlns : [< `W3_org_1999_xhtml ] wrap -> [> `XMLns ] attrib
val a_manifest : Xml.uri wrap -> [> `Manifest ] attrib
val a_cite : Xml.uri wrap -> [> `Cite ] attrib
val a_xml_space : [< `Default | `Preserve ] wrap -> [> `XML_space ] attrib
val a_accesskey : Html_types.character wrap -> [> `Accesskey ] attrib

This attribute assigns an access key to an element. An access key is a single character from the document character set. NB: authors should consider the input method of the expected reader when specifying an accesskey.

val a_charset : Html_types.charset wrap -> [> `Charset ] attrib

This attribute specifies the character encoding of the resource designated by the link. Please consult the section on character encodings for more details.

val a_accept_charset : Html_types.charsets wrap -> [> `Accept_charset ] attrib
val a_accept : Html_types.contenttypes wrap -> [> `Accept ] attrib
val a_href : Xml.uri wrap -> [> `Href ] attrib

This attribute specifies the location of a Web resource, thus defining a link between the current element (the source anchor) and the destination anchor defined by this attribute.

val a_hreflang : Html_types.languagecode wrap -> [> `Hreflang ] attrib

This attribute specifies the base language of the resource designated by href and may only be used when href is specified.

val a_download : string option wrap -> [> `Download ] attrib
val a_rel : Html_types.linktypes wrap -> [> `Rel ] attrib

This attribute describes the relationship from the current document to the anchor specified by the href attribute. The value of this attribute is a space-separated list of link types.

This attribute is used to describe a reverse link from the anchor specified by the href attribute to the current document. The value of this attribute is a space-separated list of link types.

val a_tabindex : Html_types.number wrap -> [> `Tabindex ] attrib

This attribute specifies the position of the current element in the tabbing order for the current document. This value must be a number between 0 and 32767. User agents should ignore leading zeros.

val a_mime_type : Html_types.contenttype wrap -> [> `Mime_type ] attrib

This attribute gives an advisory hint as to the content type of the content available at the link target address. It allows user agents to opt to use a fallback mechanism rather than fetch the content if they are advised that they will get content in a content type they do not support.Authors who use this attribute take responsibility to manage the risk that it may become inconsistent with the content available at the link target address.

val a_datetime : Html_types.cdata wrap -> [> `Datetime ] attrib
val a_action : Xml.uri wrap -> [> `Action ] attrib

This attribute specifies a form processing agent. User agent behavior for a value other than an HTTP URI is undefined.

val a_checked : unit -> [> `Checked ] attrib

When the type attribute has the value "radio" or "checkbox", this boolean attribute specifies that the button is on. User agents must ignore this attribute for other control types.

val a_cols : Html_types.number wrap -> [> `Cols ] attrib

This attribute specifies the visible width in average character widths. Users should be able to enter longer lines than this, so user agents should provide some means to scroll through the contents of the control when the contents extend beyond the visible area. User agents may wrap visible text lines to keep long lines visible without the need for scrolling.

val a_enctype : Html_types.contenttype wrap -> [> `Enctype ] attrib
val a_label_for : Html_types.idref wrap -> [> `Label_for ] attrib
val a_for : Html_types.idref wrap -> [> `Label_for ] attrib
  • deprecated

    Use a_label_for

val a_output_for : Html_types.idrefs wrap -> [> `Output_for ] attrib
val a_for_list : Html_types.idrefs wrap -> [> `Output_for ] attrib
  • deprecated

    Use a_output_for

val a_maxlength : Html_types.number wrap -> [> `Maxlength ] attrib
val a_minlength : Html_types.number wrap -> [> `Minlength ] attrib
val a_method : [< `Get | `Post ] wrap -> [> `Method ] attrib
val a_formmethod : [< `Get | `Post ] wrap -> [> `Method ] attrib
  • deprecated

    Use a_method

val a_multiple : unit -> [> `Multiple ] attrib
val a_name : Html_types.text wrap -> [> `Name ] attrib

This attribute assigns the control name.

val a_rows : Html_types.number wrap -> [> `Rows ] attrib

This attribute specifies the number of visible text lines. Users should be able to enter more lines than this, so user agents should provide some means to scroll through the contents of the control when the contents extend beyond the visible area.

val a_selected : unit -> [> `Selected ] attrib

When set, this boolean attribute specifies that this option is pre-selected.

val a_size : Html_types.number wrap -> [> `Size ] attrib
val a_src : Xml.uri wrap -> [> `Src ] attrib
val a_input_type : [< `Url | `Tel | `Text | `Time | `Search | `Password | `Checkbox | `Range | `Radio | `Submit | `Reset | `Number | `Hidden | `Month | `Week | `File | `Email | `Image | `Datetime_local | `Datetime | `Date | `Color | `Button ] wrap -> [> `Input_Type ] attrib
val a_text_value : Html_types.text wrap -> [> `Text_Value ] attrib

This attribute specifies the initial value of the control. If this attribute is not set, the initial value is set to the contents of the option element.

val a_int_value : Html_types.number wrap -> [> `Int_Value ] attrib
val a_value : Html_types.cdata wrap -> [> `Value ] attrib
val a_float_value : Html_types.float_number wrap -> [> `Float_Value ] attrib
val a_disabled : unit -> [> `Disabled ] attrib
val a_readonly : unit -> [> `ReadOnly ] attrib
val a_button_type : [< `Button | `Submit | `Reset ] wrap -> [> `Button_Type ] attrib
val a_command_type : [< `Command | `Checkbox | `Radio ] wrap -> [> `Command_Type ] attrib
val a_menu_type : [< `Context | `Toolbar ] wrap -> [> `Menu_Type ] attrib
val a_label : Html_types.text wrap -> [> `Label ] attrib
val a_align : [< `Left | `Right | `Justify | `Char ] wrap -> [> `Align ] attrib
  • deprecated

    Use CSS text-align

val a_axis : Html_types.cdata wrap -> [> `Axis ] attrib
  • deprecated

    Not supported in HTML5

val a_colspan : Html_types.number wrap -> [> `Colspan ] attrib
val a_headers : Html_types.idrefs wrap -> [> `Headers ] attrib
val a_rowspan : Html_types.number wrap -> [> `Rowspan ] attrib
val a_scope : [< `Row | `Col | `Rowgroup | `Colgroup ] wrap -> [> `Scope ] attrib
  • deprecated

    Not supported in HTML5

val a_summary : Html_types.text wrap -> [> `Summary ] attrib
  • deprecated

    Move content elsewhere or to a <caption> child

val a_border : Html_types.pixels wrap -> [> `Border ] attrib
  • deprecated

    Use CSS border and/or border-width

val a_rules : [< `None | `Groups | `Rows | `Cols | `All ] wrap -> [> `Rules ] attrib
  • deprecated

    Use CSS border

val a_char : Html_types.character wrap -> [> `Char ] attrib
  • deprecated

    The char attribute is not supported in HTML5

val a_alt : Html_types.text wrap -> [> `Alt ] attrib
val a_height : Html_types.number wrap -> [> `Height ] attrib
val a_width : Html_types.number wrap -> [> `Width ] attrib
type shape = [
  1. | `Rect
  2. | `Circle
  3. | `Poly
  4. | `Default
]
val a_shape : shape wrap -> [> `Shape ] attrib
val a_coords : Html_types.numbers wrap -> [> `Coords ] attrib
val a_usemap : Html_types.idref wrap -> [> `Usemap ] attrib
val a_data : Xml.uri wrap -> [> `Data ] attrib
val a_codetype : Html_types.contenttype wrap -> [> `Codetype ] attrib
  • deprecated

    Not supported in HTML5

val a_frameborder : [< `Zero | `One ] wrap -> [> `Frameborder ] attrib
  • deprecated

    Use CSS border

val a_marginheight : Html_types.pixels wrap -> [> `Marginheight ] attrib
  • deprecated

    Use CSS

val a_marginwidth : Html_types.pixels wrap -> [> `Marginwidth ] attrib
  • deprecated

    Use CSS

val a_scrolling : [< `Yes | `No | `Auto ] wrap -> [> `Scrolling ] attrib
val a_target : Html_types.frametarget wrap -> [> `Target ] attrib
val a_content : Html_types.text wrap -> [> `Content ] attrib
val a_http_equiv : Html_types.text wrap -> [> `Http_equiv ] attrib
val a_defer : unit -> [> `Defer ] attrib
val a_media : Html_types.mediadesc wrap -> [> `Media ] attrib
val a_style : string wrap -> [> `Style_Attr ] attrib
val a_property : string wrap -> [> `Property ] attrib

ARIA support

WAI-ARIA is a specification written by the W3C, defining a set of additional HTML attributes that can be applied to elements to provide additional semantics and improve accessibility wherever it is lacking.

See for example a WAI-ARIA tutorial.

val a_role : string list wrap -> [> `Role ] attrib
val a_aria : string -> string list wrap -> [> `Aria ] attrib

Basic support for WAI-ARIA attributes: a_aria "foo" corresponds to an "aria-foo" attribute.

Elements

val txt : string wrap -> [> Html_types.txt ] elt

Section

Grouping content

val figure : ?figcaption: [ `Top of [< Html_types.figcaption ] elt wrap | `Bottom of [< Html_types.figcaption ] elt wrap ] -> ([< Html_types.figure_attrib ], [< Html_types.figure_content_fun ], [> Html_types.figure ]) star

Semantic

val bdo : dir:[< `Ltr | `Rtl ] wrap -> ([< Html_types.bdo_attrib ], [< Html_types.bdo_content_fun ], [> Html_types.bdo ]) star

Hypertext

Edit

val del : ([< Html_types.del_attrib ], 'a, [> 'a Html_types.del ]) star
val ins : ([< Html_types.ins_attrib ], 'a, [> 'a Html_types.ins ]) star

Embedded

val object_ : ?params:[< Html_types.param ] elt list_wrap -> ([< Html_types.object__attrib ], 'a, [> `Object of 'a ]) star
val audio : ?src:Xml.uri wrap -> ?srcs:[< Html_types.source ] elt list_wrap -> ([< Html_types.audio_attrib ], 'a, [> 'a Html_types.audio ]) star
val video : ?src:Xml.uri wrap -> ?srcs:[< Html_types.source ] elt list_wrap -> ([< Html_types.video_attrib ], 'a, [> 'a Html_types.video ]) star
val canvas : ([< Html_types.canvas_attrib ], 'a, [> 'a Html_types.canvas ]) star
val area : alt:Html_types.text wrap -> ([< Html_types.common | `Alt | `Coords | `Shape | `Target | `Rel | `Media | `Hreflang | `Mime_type ], [> Html_types.area ]) nullary
val map : ([< Html_types.map_attrib ], 'a, [> 'a Html_types.map ]) star

Tables Data

Forms

Label authorizes only one control inside them that should be labelled with a for attribute (although it is not necessary). Such constraints are not currently enforced by the type-system

val datalist : ?children: [< `Options of [< Html_types.selectoption ] elt list_wrap | `Phras of [< Html_types.phrasing ] elt list_wrap ] -> ([< Html_types.datalist_attrib ], [> Html_types.datalist ]) nullary

Data

val entity : string -> [> Html_types.txt ] elt

entity "foo" is the HTML entity &foo;. Both numerical and named form are allowed.

val space : unit -> [> Html_types.txt ] elt
val cdata : string -> [> Html_types.txt ] elt
val cdata_script : string -> [> Html_types.txt ] elt
val cdata_style : string -> [> Html_types.txt ] elt

Interactive

val menu : ?children: [< `Lis of [< `Li of [< Html_types.common ] ] elt list_wrap | `Flows of [< Html_types.flow5 ] elt list_wrap ] -> ([< Html_types.menu_attrib ], [> Html_types.menu ]) nullary

Scripting

Style Sheets

Ruby

Deprecated

val pcdata : string wrap -> [> Html_types.pcdata ] elt
  • deprecated

    Use txt instead

Conversion with untyped representation

WARNING: These functions do not ensure HTML or SVG validity! You should always explicitly given an appropriate type to the output.

import signal converts the given XML signal into Tyxml elements. It can be used with HTML and SVG parsing libraries, such as Markup.

val tot : Xml.elt -> 'a elt
val totl : Xml.elt list_wrap -> 'a elt list_wrap
val toelt : 'a elt -> Xml.elt
val toeltl : 'a elt list_wrap -> Xml.elt list_wrap
val doc_toelt : doc -> Xml.elt
val to_xmlattribs : 'a attrib list -> Xml.attrib list
val to_attrib : Xml.attrib -> 'a attrib
module Unsafe : sig ... end

Unsafe features.

include Eliom_content_sigs.LINKS_AND_FORMS with type +'a elt := 'a elt and type +'a attrib := 'a attrib and type uri := uri and type ('a, 'b, 'c) star := ('a, 'b, 'c) star and type 'a form_param := 'a form_param
type ('a, 'b, 'c) lazy_star = ?a:'a attrib list -> 'b elt list Eliom_lazy.request -> 'c elt
include Eliom_form_sigs.LINKS with type +'a elt := 'a elt and type +'a attrib := 'a attrib and type uri := uri
val make_uri : ?absolute:bool -> ?absolute_path:bool -> ?https:bool -> service: ('get, unit, Eliom_service.get, _, _, _, _, _, _, unit, _) Eliom_service.t -> ?hostname:string -> ?port:int -> ?fragment:string -> ?keep_nl_params:[ `All | `Persistent | `None ] -> ?nl_params:Eliom_parameter.nl_params_set -> 'get -> uri

The function make_uri service get_params returns the URL of the service service applied to the GET parameters get_params. By default the returned URL is relative to the current request URL but it is absolute when one of the following conditions is met:

  • the optional parameter ~absolute_path is true.
  • the optional parameter ~absolute is true.
  • the optional parameter ~https is true (resp. false) and the current request protocol is http (resp. https).
  • the optional parameter ~https is true and the function is used outside of a service handler
  • the service has been created with ~https:true and the current request protocol is http.
  • the service has been created with ~https:true and the function is used outside of a service handler.

When only the first condition is met (~absolute_path is true) the returned URL is just the absolute path, but when any other condition is satisfied the returned URL is prefixed with protocol://hostname[:port], where:

  • protocol is:

    • https if the service has been created with ~https:true or the optional parameter ~https is true;
    • http if the optional parameter ~https is false;
    • the current request protocol if available;
    • http in any other case.
  • hostname is:

    • the optional parameter ~hostname if given;
    • the attribute defaulthostname of <host> tag in configuration file or the machine hostname if the option <usedefaulthostname/> is set;
    • the Host http header of the current request if available;
    • the attribute defaulthostname of <host> tag in configuration file or the machine hostname in any other case.
  • port is:

    • the optional parameter ~port if given;
    • the attribute defaulthttpsport (resp. defaulthttpport) of <host> tag in configuration file or 443 (resp. 80) if protocol is https (resp. http) and the current request protocol is http (resp. https);
    • the attribute defaulthttpsport (resp. defaulthttpsport) of <host> tag in configuration file or 443 (resp. 80) if the option <usedefaulthostname/> is set and protocol is https (resp. http);
    • the port associated to the Host http header of the current request if available;
    • the incoming port of the current request if available;
    • the attribute defaulthttpport (resp. defaulthttpsport) of <host> tag in configuration file or 80 (resp. 443) in any other case.

If given the optional parameter ~fragment is prefixed by # and appended to the URL.

The optional parameter keep_nl_params allows one to override the keep_nl_params parameter used when creating the service, see Eliom_service.create for a detailed description.

The optional parameter nl_params allows one to add non localized GET parameter to the URL. See the eliom manual for more information about <<a_manual chapter="server-params" fragment="nonlocalizedparameters"|non localized parameters>>.

val uri_of_string : (unit -> string) -> uri

The function uri_of_string f returns a URI whose content is equivalent to f ().

For XML tree build with TyXML, like Html or Svg.F, the function f is applied each time the XML tree is sent to the client (either as page content or as a marshalled OCaml value). Hence, the function is always evaluated in the context of a service handler.

For other module, the function f is immediately applied.

The function css_link ~uri () creates a <link> node that reference a Cascading StyleSheet (CSS).

If the CSS is generated by an Eliom service, use make_uri to calculate the service URI. If the CSS is a static file, you may also use Eliom_service.static_dir or Eliom_service.extern to abstract the file with a service.

The optional parameter ~a allows one to add extra HTML attributes to the generated node.

val js_script : ?a:[< Html_types.script_attrib ] attrib list -> uri:uri -> unit -> [> Html_types.script ] elt

The function js_script ~uri () creates a <script> node that reference a javascript file.

If the script content is generated by an Eliom service, use make_uri to calculate the service URI. If it is a static file, you may also use Eliom_service.static_dir or Eliom_service.extern to abstract the file with a service.

The optional parameter ~a allows one to add extra HTML attributes to the generated node.

val a : ?absolute:bool -> ?absolute_path:bool -> ?https:bool -> ?a:[< Html_types.a_attrib ] attrib list -> service: ('get, unit, Eliom_service.get, _, _, _, _, _, _, unit, Eliom_service.non_ocaml) Eliom_service.t -> ?hostname:string -> ?port:int -> ?fragment:string -> ?keep_nl_params:[ `All | `Persistent | `None ] -> ?nl_params:Eliom_parameter.nl_params_set -> ?xhr:bool -> 'a elt list -> 'get -> [> 'a Html_types.a ] elt

The function a service a_content get_params creates a <a> node that link to service applied to GET parameters get_params and whose content is a_content. By default, the href attribute is a relative URL recomputed at each request with make_uri.

By default, the link is implemented in a way that allows the client-side Eliom application to keep running, irrespectable of the usage of the link (cf. <<a_api project="eliom" subproject="client" | val Eliom_client.change_page>> ).

By contrast, if the optional parameter ~xhr:false is given, the link is realized as a standard HTML link and clicking it discontinues the Eliom application. The ~xhr parameter has no effect outside an Eliom application. The default value of ~xhr is configurable through <<a_api project="eliom" subproject="server" | val Eliom_config.set_default_links_xhr >> .

The optional parameter ~a allows one to add extra HTML attributes to the generated node.

See make_uri for description of other optional parameters.

To create a <a> node that is not associated to a service, use Raw.a.

module Form : Eliom_form_sigs.S with type +'a elt := 'a elt and type +'a attrib := 'a attrib and type uri := uri and type 'a param = 'a form_param
OCaml

Innovation. Community. Security.