Example #1
0
	def __init__(self, name):
		'Initialize.'
		self.articles = []
		self.name = name
		sourceAddress = 'http://devtome.com/doku.php?id=wiki:user:%s&do=edit' % self.name
		print('Loading user page from %s' % self.name)
		sourceText = devtome.getSourceText(sourceAddress)
		isCollated = False
		isOriginal = False
		for line in almoner.getTextLines(sourceText):
			lineStrippedLower = line.strip().lower()
			if '==' in lineStrippedLower:
				isCollated = False
				isOriginal = False
			if isCollated:
				lowerLinkName = devtome.getLinkName(line).lower()
				self.articles.append(lowerLinkName)
			if isOriginal:
				lowerLinkName = devtome.getLinkName(line).lower()
				self.articles.append(lowerLinkName)
			if '==' in lineStrippedLower:
				if 'collated' in lineStrippedLower:
					isCollated = True
				elif 'original' in lineStrippedLower:
					isOriginal = True
Example #2
0
def addToAuthorDictionary(authorDictionary, name, text):
    "Add author name to invoiced articles."
    isArticle = False
    for line in almoner.getTextLines(text):
        lineStrippedLower = line.strip().lower()
        if "==" in lineStrippedLower:
            isArticle = False
            if "collated" in lineStrippedLower or "original" in lineStrippedLower:
                isArticle = True
        if isArticle:
            title = devtome.getLinkName(lineStrippedLower, name)
            if title != "":
                authorDictionary[title] = name
Example #3
0
def addToAuthorDictionary(authorDictionary, name, text):
	'Add author name to invoiced articles.'
	isArticle = False
	for line in almoner.getTextLines(text):
		lineStrippedLower = line.strip().lower()
		if '==' in lineStrippedLower:
			isArticle = False
			if 'collated' in lineStrippedLower or 'original' in lineStrippedLower:
				isArticle = True
		if isArticle:
			title = devtome.getLinkName(lineStrippedLower)
			if title != '':
				authorDictionary[title] = name[len('wiki:user:') :]
Example #4
0
def getArticles(name):
	'Get invoiced articles by name.'
	articles = []
	sourceAddress = 'http://devtome.com/doku.php?id=wiki:user:%s&do=edit' % name
	print('Loading user page from %s' % name)
	sourceText = almoner.getSourceText(sourceAddress)
	isArticle = False
	for line in almoner.getTextLines(sourceText):
		lineStrippedLower = line.strip().lower()
		if '==' in lineStrippedLower:
			if '===' not in lineStrippedLower:
				isArticle = False
		if isArticle:
			lowerLinkName = devtome.getLinkName(line, name).lower()
			if lowerLinkName != '':
				articles.append(lowerLinkName)
		if '==' in lineStrippedLower:
			if 'collated' in lineStrippedLower or 'original' in lineStrippedLower:
				isArticle = True
	return articles