So I ended up going to just using the IHTMLPreviewRenderer interface and was able to get it to work. The latest version of my plug-in is now up on trac-hacks.org.
http://trac-hacks.org/wiki/ScrippetMacro Thanks for the help! Ben On Sun, Jan 30, 2011 at 1:04 PM, Dalton Barreto <[email protected]> wrote: > 2011/1/30 Benjamin Lau <[email protected]>: >> Hello, >> >> I'm trying to add a new content renderer to a plug-in I'm developing >> (http://trac-hacks.org/wiki/ScrippetMacro). The idea here is to add a >> content handler for Final Draft 8 scripts so they can be rendered >> within trac instead of having to download them to view them, or upload >> copies in another format (like PDF). Anyway... I'm running into a >> problem though. I think what's happening is that since the fbx file >> is just xml the normal handler for xml data is picking it up and >> rendering it. > > > I think this is probably not the case since one of the parameters > passed to the get_suported_convertions method is the filename's suffix > (or file extension, if you prefer). So probably trac could distinguish > between two files that have the same content type but different > suffixes. > > Note that I didn't read Trac's source code, I'm just guessing this > based on the IContentConverter interface. > > >> I was trying to implement this using the IContentConverter API. So I >> currently have: >> >> class ScrippetsRenderer(Component): >> implements(IContentConverter, ITemplateProvider) >> >> ## IContentConverter >> def get_supported_conversions(self): >> return [('finaldraft', 'Final Draft', 'fdx', 'text/xml', >> 'text/plain', 9)] >> >> def convert_content(self, req, mimetype, content, key): >> return "TESTING 1 2 3" >> >> But nothing happens and I just get the usual line numbered view of the >> xml as text. >> >> Any idea how to go about doing this? >> > > Are you sure that this new component is enabled in Trac's > admin/plugins page? I was writting a plugin once and had this very > same "Nothing is happening" problem. Just double check there to be > sure. > > -- > Dalton Barreto > http://daltonmatos.wordpress.com > > -- > 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.
