import os, urllib, os.path import wx from pwiki.StringOps import mbcsEnc WIKIDPAD_PLUGIN = (("InsertionByKey", 1),) def describeInsertionKeys(ver, app): return ((u"tooltip", ("html_single", "html_previewWX", "html_preview", "html_multi"), TPHandler),) class TPHandler: def __init__(self, app): self.app = app self.extAppExe = None def taskStart(self, exporter, exportType): pass def taskEnd(self): pass def createContent(self, exporter, exportType, insToken): iext = ('png', 'jpg', 'gif', 'bmp') img = False; bstr = mbcsEnc(insToken.value, "replace")[0] if not bstr: # Nothing in, nothing out return u"" #try: word,text=bstr.split('|') word=word.strip() text=text.strip() #except: # return u"fail:%s" % bstr for e in iext: if word.endswith(e): img = True break if img == True: #word = os.path.join( dataDir, word ) #word = urllib.pathname2url(word) return u"
"\ ""\ "
"\ "%s
"\ "
" % (word, word,text) else: return u"
"\ "%s"\ "
%s
"\ "
" % (word, text) def getExtraFeatures(self): return ()