This script generates aliases for the different combinations of possible capitalizations for wiki page title.
If your page is Hello world, this script will generate
[alias: hello world]
[alias: hello World]
[alias: Hello World]
I have no idea if anyone else will find this useful or if this is the right place to post it. Anyway, thanks for developing this guys. I love Wikipad.
<% 1:
import math
editor.GotoPos(editor.GetLength())
willsCurrentWikiTitle = str(editor.getLoadedDocPage().wikiWord )
willsCurrentWikiWords = willsCurrentWikiTitle.split()
willsCurrentWikiWordsLength = len(willsCurrentWikiWords)
for x in range(0, math.pow(2, willsCurrentWikiWordsLength)):
line = ''
for y in range(0, willsCurrentWikiWordsLength):
wordsWhichGetCapitalized = str(bin(x))
bitwiseCompared = int(math.pow(2, willsCurrentWikiWordsLength)-1)
bitwiseCurrent = x
capitalized = bitwiseCompared & bitwiseCurrent
padZerosNumber = len(str(bin(bitwiseCompared))) - len(str(bin(bitwiseCurrent)))
padZeros = ""
for z in range(0, padZerosNumber):
padZeros += '0'
joinedString = str(bin(capitalized))[2:]
joinedString = padZeros + joinedString
if joinedString[y] == '1':
if y==0:
line += willsCurrentWikiWords[y].capitalize()
else:
line +=' '
line += willsCurrentWikiWords[y].capitalize()
else:
if y==0:
line += willsCurrentWikiWords[y].lower()
else:
line +=' '
line += willsCurrentWikiWords[y].lower()
if line != str(editor.getLoadedDocPage().wikiWord):
editor.AddText('[alias:')
editor.AddText(line)
editor.AddText(']\n')
editor.GotoPos(0)
%>