Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[enhance] stdlib: Adding @stringifier/@xmlizer for Email.email/Uri.uri

  • Loading branch information...
commit 2fba855dd9665474e08ed2fff80e730daee295c7 1 parent e5b333e
@akoprow akoprow authored
View
2  stdlib/core/web/core/uri.opa
@@ -370,7 +370,7 @@ Uri =
* @param u an URI to be converted
* @return a string representation of [u].
*/
- to_string(u : Uri.uri) =
+ @stringifier(Uri.uri) to_string(u : Uri.uri) =
query_to_string(q) =
match q : list with
| [] -> ""
View
4 stdlib/core/xhtml/xhtml.opa
@@ -1279,3 +1279,7 @@ Xhtml =
@opacapi Xml_match_question = Xmlns.match_question
@opacapi Xml_match_number = Xmlns.match_exact
@opacapi Xml_match_range = Xmlns.match_range
+
+// Cannot be in Uri.uri module due to dependencies on this package
+@xmlizer(Uri.uri) uri_to_xml(u : Uri.uri) =
+ <>{"{u}"}</>
View
5 stdlib/web/mail/email.opa
@@ -169,11 +169,14 @@ Email = {{
of_string_opt(s) ? error("Wrong email: {s}")
- to_string(email) =
+ @stringifier(Email.email) to_string(email) =
match email.name with
| {~some} -> "\"{some}\" <{email.address.local}@{email.address.domain}>"
| {none} -> "{email.address.local}@{email.address.domain}"
+ @xmlizer(Email.email) to_xml(email) =
+ <>{"{email}"}</>
+
to_string_only_address(email) =
"{email.address.local}@{email.address.domain}"
Please sign in to comment.
Something went wrong with that request. Please try again.