wiki:IsWikiWord

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

Migrated from old trac wiki

you should retrieve the formatting object (of class WikiFormatting, defined in WikiFormatting.py) by calling

formatting = wikidPad.getFormatting() or format = pwiki.getFormatting()

Then you can access a few helpful member functions of the formatting object:

def isWikiWord(self, word):

""" Test if word is syntactically a wiki word """

def isNakedWikiWord(self, word):

""" Test if word is syntactically a naked wiki word """

def isCcWikiWord(self, word):

""" Test if word is syntactically a naked camel-case wiki word """

def wikiWordToLabel(self, word):

""" Strip 'and?' if present and return naked word """

Use isWikiWord() to test a word as it would appear in a wiki page, with or without brackets, isNakedWikiWord() tests this for words without brackets ("naked" words) as they appear now everywhere internally in the database.

The use of isCcWikiWord() should be clear and wikiWordToLabel() strips brackets from a word (but doesn't test if it is a valid wiki word). The name of this last function may change in the future.