Esempio n. 1
0
    def tokenizeTitle(self, text, formatDetails=None,
            threadholder=DUMBTHREADHOLDER):
        """
        Function used by PageAst module
        """
        # TODO Cache if necessary
        formatMap = self.getExpressionsFormatList(
                self.formatWwTitleExpressions, formatDetails)
                
        tokenizer = Tokenizer(self.combinedWwTitleRE, -1)

        return tokenizer.tokenize(text, formatMap, FormatTypes.Default,
                threadholder=threadholder)
Esempio n. 2
0
    def tokenizePage(self, text, formatDetails,
            threadholder=DUMBTHREADHOLDER):
        """
        Function used by PageAst module
        """
        if formatDetails is None:
#             page = self.pWiki.getCurrentDocPage()
#             if page is None:
            formatDetails = WikiPageFormatDetails() # Default
#             else:
#                 formatDetails = page.getFormatDetails()

        if formatDetails.noFormat:
            # No formatting at all (used e.g. by some functional pages)
            return [Token(FormatTypes.Default, 0, {}, text)]
            
        # TODO Cache if necessary
        formatMap = self.getExpressionsFormatList(
                self.formatExpressions, formatDetails)
                
        tokenizer = Tokenizer(self.combinedPageRE, -1)
        
        return tokenizer.tokenize(text, formatMap, FormatTypes.Default,
                threadholder=threadholder)