The ScrippetMacro does something similar using by extending IHTMLPreviewRenderer for rendering Final Draft Pro scripts when the attachment is clicked. I ended up implementing that as a separate class and haven't shared the bits of common code between them yet. You can look at that here: http://trac-hacks.org/browser/scrippetmacro/0.12/scrippets/render.py
You'll also need to set something up in the [mimeviewer] mime_map to add a mapping for the csv files: text/csv:csv so it'll try to find the renderer when you view the attachment. Ben On Sun, Nov 27, 2011 at 7:10 PM, Helend <[email protected]> wrote: > Thanks for your suggestions. > > I have noticed the CsvMacro. Currently we already have many csv files > attached to tickets and wiki pages. It will take more space for big > csv files. We would like to show csv files as table with Trac > preview. > > filter_stream can be used to remove OLD table, then create a NEW > table. The method will read and process csv file twice. I just wander > whether there is a more simple or faster method. > > Cheers, > Bangyou > > > On Nov 28, 12:53 pm, Benjamin Lau <[email protected]> wrote: >> I'd take a look at modifying the existing CsvMacro[1] to support >> another calling convention where it can make use of an attachment. >> >> You can take a look at the ScrippetMacro[2]'s macro implementation for >> a way of doing this so the macro can work as both called both like: >> {{{ >> #CSV >> <data>}}} >> >> and as >> [[CSV(<attachment name>)]] >> >> Ben >> [1]http://trac-hacks.org/wiki/CsvMacro >> >> >> >> >> >> >> >> On Sun, Nov 27, 2011 at 3:07 PM, Helend <[email protected]> wrote: >> > I would like to develop a plugin to show csv attachment as table. Do >> > you have any idea to start it except "filter_stream". >> >> > Thanks. >> >> > Cheers, >> > Bangyou >> >> > -- >> > You received this message because you are subscribed to the Google Groups >> > "Trac Development" group. >> > To post to this group, send email to [email protected]. >> > To unsubscribe from this group, send email to >> > [email protected]. >> > For more options, visit this group >> > athttp://groups.google.com/group/trac-dev?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "Trac Development" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/trac-dev?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Trac Development" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/trac-dev?hl=en.
