table_print icon indicating copy to clipboard operation
table_print copied to clipboard

Output to HTML

Open markrickert opened this issue 10 years ago • 4 comments

This gem looks promising for console output, but it would be awesome if it could also output to HTML with a helper method (Rails) for use in views.

I've seen a comment in another PR that you wanted to do this and was wondering if it was in the pipeline and if yes, how far away is this feature?

Thanks!

markrickert avatar Sep 29 '14 17:09 markrickert

It will be relatively straightforward to output plain HTML. What will be more difficult is letting you add custom markup (classes, etc) to that base table. What are your thoughts on just plain tr/td tags? Still useful for you?

Overall I think HTML is an important addition that will make table_print useful for many more people. Honestly the next few weeks are pretty busy for me but I can at least commit to making HTML output the top priority for this project.

Thanks for your feedback! :)

arches avatar Oct 02 '14 16:10 arches

I may be stating the obvious, but if it's only for debug purpose, I use this helper :

  def tp_pre data, options={}
    content_tag :pre, TablePrint::Printer.new(data, options).table_print
  end

all the time.

gamov avatar Nov 21 '14 03:11 gamov

haha! It's obvious now that you said it :) I always forget about pre tags. I'll add that to the README, thanks!

arches avatar Nov 21 '14 15:11 arches

whoops, didn't mean to close this issue. I think actual <td> elements will still be useful.

arches avatar Nov 21 '14 15:11 arches