wiki:AddToBlacklist

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

Migrated from old trac wiki

This plugin adds the currently selected word to the wiki's blacklist (Views > Func. pages > Wiki cc. blacklist). If nothing is selected, the currently selected tree node is added to the blacklist. This allows you to quickly add items from the list of "undefined" wikiwords, found under Views > undefined-nodes.

""" AddToBlacklist.py
    Adds the currently selected word or the currently selected treenode to the wiki's blacklist.

    v0.11 by wwwald, 20090204.
"""

WIKIDPAD_PLUGIN = (("MenuFunctions",1),)

def describeMenuItems(wiki):
	return ((addtoblacklist, "Add To Blacklist\tCtrl-Shift-X", "Add To Blacklist"),)

def addtoblacklist(pwiki, evt):
	editor = pwiki.getActiveEditor()
	blackword = editor.GetSelectedText()
	if len(blackword.strip())<1:
		blackword = pwiki.getCurrentWikiWord()
		blackwordtype = 'Wiki node'
	else:
		blackwordtype = 'Selected word'

	wdm = pwiki.getWikiDocument();
	blacklist = wdm.getFuncPage("wiki/CCBlacklist")
	blacklist.appendLiveText(blackword+'\n')
	pwiki.appendLogMessage(blackwordtype + ' blacklisted: ' + blackword)