def factory(text): try: entryPrefix, entryValue = text.split(u"=", 1) except: return None entryPrefixes = entryPrefix.split(u";") entryTitle = entryPrefixes[0] if len(entryPrefixes) > 1: entryFlags = entryPrefixes[1] else: entryFlags = u"" entryValue = unescapeWithRe(entryValue) # if escapedValue: # try: # entryValue = unescapeWithRe(entryValue) # except: # return None if entryTitle == u"": entryTitle = entryValue[:60] # TODO Changeable entryTitle = entryTitle.split("\n", 1)[0] else: try: entryTitle = unescapeWithRe(entryTitle) except: return None return TextBlocksEntry(entryTitle, entryFlags, entryValue)
def factory(text): try: entryPrefix, entryValue = text.split(u"=", 1) except: return None entryPrefixes = entryPrefix.split(u";") entryTitle = entryPrefixes[0] entryFlags = u"" entryIconDesc = u"" if len(entryPrefixes) > 1: entryFlags = entryPrefixes[1] if len(entryPrefixes) > 2: entryIconDesc = entryPrefixes[2] if entryTitle == u"": entryTitle = entryValue[-60:] # TODO Changeable entryTitle = entryTitle.split("\n")[-1] else: try: entryTitle = unescapeWithRe(entryTitle) except: return None return FavoriteWikisEntry(entryTitle, entryFlags, entryIconDesc, entryValue)