# Utilities for manipulating 'what' keys for the log.

def wikiwhat(page):
    basepage = page
    if page.endswith('/talk'): basepage = page[:-5]
    if basepage.find('/') >= 0:
	return page
    else:
	return 'wiki/' + page

# Decide whether a given "what" lives in theorem space
def thmspace(what):
    lwhat = what.split('/')
    return len(lwhat) > 1 and lwhat[-1] != 'talk' and lwhat[0] not in ('wiki', 'bib', 'user')

