On Sun, Mar 28, 2010 at 9:22 AM, Eric Iverson <[email protected]> wrote:
> In jhs it is easy to use jhtml'...' to put raw html in the display log. It
> would be relatively easy to write a verb that displays J data in an html
> table. This is a good exercise for the community.
Here is a rough model:
fmt0=:3 :0 L:0
if.#$y do.
,@(,"1&'<br />')"2^:(_1 + #...@$) ":y
else.
":y
end.
)
fmt=:3 :0 L:1 ^:_
if.L.y do.
'<table border=1>'&, ,&'</table>' ;'<tr>'&,&.> ,&'</tr>'&.> <@;"1
'<td>'&,&.> ,&'</td>'&.>fmt0 y
else.
fmt0 y
end.
)
fmt0 is meant to model converting an unboxed array into an html
fragment. I did not put much effort into it, but you probably already
have something that does what it does.
fmt is meant to model representing a boxed array as a table.
I have not figured out what it should be doing for arrays higher than
rank 2 arrays. Would putting <br> tags between table elements (like
fmt0 should be doing if i had not left trailing <br> tags in place) be
adequate?
Thanks,
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm