Skip to content

Commit

Permalink
Label the URI of Html.link
Browse files Browse the repository at this point in the history
This is because it is usually convenient to be able to specify the
HTML last.
  • Loading branch information
Chris00 committed Jan 25, 2015
1 parent 5f6a9fa commit 3225ffa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions lib/html.ml
Expand Up @@ -89,8 +89,8 @@ type link = {
let html_of_link l : t =
<:xml<<a href=$str:l.href$>$str:l.text$</a>&>>

let link ?hreflang ?rel ?target ?ty ?title ?cls html l =
let attrs = [(("", "href"), Uri.to_string l)] in
let link ?hreflang ?rel ?target ?ty ?title ?cls ~href html =
let attrs = [(("", "href"), Uri.to_string href)] in
let attrs = match hreflang with
| Some h -> (("", "hreflang"), h) :: attrs
| None -> attrs in
Expand Down Expand Up @@ -150,8 +150,8 @@ let img ?alt ?width ?height ?ismap ?title ?cls src =
| Some c -> (("", "class"), c) :: attrs
| None -> attrs in
match ismap with
| Some u -> link [`El((("", "img"), (("", "ismap"), "") ::attrs), [])] u
~target:`self
| Some u -> link ~href:u ~target:`self
[`El((("", "img"), (("", "ismap"), "") ::attrs), [])]
| None -> `El((("", "img"), attrs), [])

(* color tweaks for lists *)
Expand Down
4 changes: 2 additions & 2 deletions lib/html.mli
Expand Up @@ -81,8 +81,8 @@ val link : ?hreflang: string ->
?ty: string ->
?title: string ->
?cls: string ->
t -> Uri.t -> element
(** [link html href] generate a link from [html] to [href].
href:Uri.t -> t -> element
(** [link href html] generate a link from [html] to [href].
@param title specifies extra information about the element that is
usually as a tooltip text when the mouse moves over
Expand Down

0 comments on commit 3225ffa

Please sign in to comment.