wiki:UrlifyFile

Version 1 (modified by chriz, 9 years ago) (diff)

Migrated from old trac wiki

# Select a path, press CTRL-U and it will turn into a clickable URL.
# Install: Put the source below into "WikidPad/user_extensions/URLifyFile.py"
# and restart WikidPad.

import urllib
WIKIDPAD_PLUGIN = (("MenuFunctions",1),)
def describeMenuItems(wiki):
	global nextNumber
	return ((URLifyFile, "URLify file\tCtrl-U", "URLify file"),)

def URLifyFile(wiki, evt):
	text = wiki.getActiveEditor().GetSelectedText()
	url = urllib.pathname2url(text)
	wiki.getActiveEditor().ReplaceSelection("file:%s" % url)