Hi all,
I have try my simple html export plugin on latest trunk (9610) and not
work completely with images. The result of format_to_html (nor
wiki_to_html) does not contains image urls but only empty <img /> tags
when image is attached to page and embedded with Image macro.
Here is a simple Wiki page:
-------
= test page =
This is an image: [[Image(whatever.png)]]
-------
Then the result of format_to_html is:
<h1 id="testpage">test page</h1>
<p>
This is an image: <a style="padding:0; border:none"><img /></a>
</p>
Here is my sample plugin that I just drop in the environment's plugin
directory:
from trac.core import *
from trac.mimeview.api import IContentConverter
from trac.mimeview.api import Context
from trac.mimeview.api import content_to_unicode
from trac.wiki.formatter import format_to_html
import os
class HTMLExportSamplePlugin(Component):
"""Convert Wiki pages to HTML."""
implements(IContentConverter)
# IContentConverter methods
def get_supported_conversions(self):
yield ('html', 'HTMLExportSample', 'html', 'text/x-trac-wiki',
'text/html', 9)
def convert_content(self, req, input_type, source, output_type):
codepage = 'utf-8'
context = Context.from_request(req, absurls=False)
page = format_to_html(self.env, context,
content_to_unicode(self.env, source, 'text/x-trac-wiki'))
meta = u'<meta http-equiv="Content-Type" content="text/html;
charset=%s"></meta>' % (codepage,)
page = u'<html><head>%s</head><body>%s</body></html>' % (meta,
page)
return (page, u'text/html')
So, how can I solve this problem?
Regards,
Zoltan.
--
You received this message because you are subscribed to the Google Groups "Trac
Users" 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-users?hl=en.