Skip to content
Browse files

[enhance] stdlib/xhtml: auto-conversion from Iterator to xml

  • Loading branch information...
1 parent 7bc61f3 commit e7e5e477de25c955c2bb8549275ba4c224c68336 @akoprow akoprow committed Jun 4, 2012
Showing with 5 additions and 1 deletion.
  1. +5 −1 stdlib/core/xhtml/xhtml.opa
View
6 stdlib/core/xhtml/xhtml.opa
@@ -16,7 +16,7 @@
along with OPA. If not, see <http://www.gnu.org/licenses/>.
*/
-import stdlib.core.{web.core, rpc.core, parser, funaction, mutable.buffer, unification}
+import stdlib.core.{iter, web.core, rpc.core, parser, funaction, mutable.buffer, unification}
/**
* {1 About this module}
@@ -453,6 +453,10 @@ Xml =
@xmlizer(option('a)) option_to_xml(alpha_to_xml, o) =
Option.switch(alpha_to_xml, <></>, o)
+ // conversion from an iterator to xml + registering auto-magical conversion from iterator to xml
+ @xmlizer(iter('a)) iterator_to_xml(alpha_to_xml, i) =
+ create_fragment(Iter.map(alpha_to_xml, i) |> Iter.to_list)
+
/**
* Fold on every node of the xml
* @param the fold function

0 comments on commit e7e5e47

Please sign in to comment.
Something went wrong with that request. Please try again.