You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello Anton,
I have just been reading about the parser documentation and it appears to me that the application of the element function is inconsistent with its signature,
So,
?element:(name -> (name * string) list -> 'a list -> 'a)
is a function of three arguments producing 'a
but it is used as,
~element:(fun (name, _) children -> Element (name, children))
which appears to be a function of only two arguments, the tupple (name, _) and children,
See here for the original piece of documentation,
kind regards,
Ondrej
val tree :
?text:(string list -> 'a) ->
?element:(name -> (name * string) list -> 'a list -> 'a) ->
?comment:(string -> 'a) ->
?pi:(string -> string -> 'a) ->
?xml:(xml_declaration -> 'a) ->
?doctype:(doctype -> 'a) ->
([< signal ], sync) stream -> 'a option
This function's type signature may look intimidating, but it is actually easy to use. It is best introduced by example:
type my_dom = Text of string | Element of name * my_dom list
"
HTML5 is easy to parse".
|> string
|> parse_html
|> signals
|> tree
~text:(fun ss -> Text (String.concat "" ss))
~element:(fun (name, _) children -> Element (name, children))
The text was updated successfully, but these errors were encountered:
~element:(fun (_ns, name) _attrs children -> Element (name, children))
]}
The issue is that Markup.ml's doc generation script is currently broken, and as I haven't gotten around to fixing it, I haven't been able to post accurate docs lately (almost all the docs are still accurate, though). I opened #62 to remind myself to get on it! I'm closing this issue in the meantime.
Hello Anton,
I have just been reading about the parser documentation and it appears to me that the application of the element function is inconsistent with its signature,
So,
?element:(name -> (name * string) list -> 'a list -> 'a)
is a function of three arguments producing 'a
but it is used as,
~element:(fun (name, _) children -> Element (name, children))
which appears to be a function of only two arguments, the tupple (name, _) and children,
See here for the original piece of documentation,
kind regards,
Ondrej
val tree :
?text:(string list -> 'a) ->
?element:(name -> (name * string) list -> 'a list -> 'a) ->
?comment:(string -> 'a) ->
?pi:(string -> string -> 'a) ->
?xml:(xml_declaration -> 'a) ->
?doctype:(doctype -> 'a) ->
([< signal ], sync) stream -> 'a option
This function's type signature may look intimidating, but it is actually easy to use. It is best introduced by example:
type my_dom = Text of string | Element of name * my_dom list
"
HTML5 is easy to parse".
|> string
|> parse_html
|> signals
|> tree
~text:(fun ss -> Text (String.concat "" ss))
~element:(fun (name, _) children -> Element (name, children))
The text was updated successfully, but these errors were encountered: