Пример #1
0
    def __init__(self, src ='', debug =False, blockDefs =None, debugData =None, **kwargs):
        """Creates a new instance of ClassTemplate."""
        self._log = ArgsUtils.getLogger(self, kwargs)

        self._debugData = debugData
        self._debug     = debug

        src = StringUtils.toUnicode(src)

        self._raw = src.replace('\r','')
        if ArgsUtils.get('stripSource', True, kwargs):
            self._raw = self._raw.strip('\n')

        self._analyzed  = False
        self._errors    = []
        self._blocks    = []
        self._bookmarks = []
        self._initialBlock = ArgsUtils.get('initialBlock', None, kwargs)

        if isinstance(blockDefs, BlockDefinition):
            self._blockDefs = {'root':blockDefs}
        elif isinstance(blockDefs, dict):
            self._blockDefs = blockDefs
        elif isinstance(blockDefs, list):
            self._blockDefs = {'root':blockDefs}
        else:
            self._blockDefs = {
                'root':[
                    BlockDefinition.createQuoteDef(BlockDefinition.BLOCKED),
                    BlockDefinition.createLiteralDef(BlockDefinition.BLOCKED),
                    BlockDefinition.createParensDef(),
                    BlockDefinition.createBracketsDef(),
                    BlockDefinition.createBracesDef(),
                    ],
                }
Пример #2
0
    def __init__(self, source, **kwargs):

        self.footerDom  = u''
        self.page       = ArgsUtils.get('page', None, kwargs)
        self.site       = ArgsUtils.get('site', None, kwargs)

        self.filePath = ArgsUtils.get('path', None, kwargs)
        self.filename = ArgsUtils.get(
            'filename',
            os.path.basename(self.filePath) if self.filePath else None,
            kwargs)

        debugData = ArgsUtils.extract('debugData', None, kwargs)
        blocks    = {
            'root':[
                MarkupTextBlockUtils.createMarkupCommentDef(BlockDefinition.BLOCKED),
                MarkupTextBlockUtils.createMarkupOpenDef('quote'),
                MarkupTextBlockUtils.createMarkupCloseDef(BlockDefinition.BLOCKED) ],
            'quote':[
                BlockDefinition.createQuoteDef(BlockDefinition.BLOCKED),
                BlockDefinition.createLiteralDef(BlockDefinition.BLOCKED) ]}

        self._renderErrors = []
        self._tagIndex     = -1

        super(MarkupProcessor, self).__init__(
            source,
            ArgsUtils.extract('debug', False, kwargs),
            blocks,
            debugData,
            stripSource=False,
            **kwargs)

        self.logger.trace       = True
        self._result            = None
        self._anchors           = []
        self._tags              = []
        self._id                = StringUtils.getRandomString(8)
        self._css               = []
        self._js                = []
        self._radioArrays       = dict()
        self._patterns          = dict()
        self._groups            = dict()
        self._metadata          = ArgsUtils.getAsDict('metadata', kwargs)
        self._libraryIDs        = []
        self._autoTitle         = u''
        self._autoDescription   = u''
        self._allowModelCaching = False

        self.privateView = False
Пример #3
0
    def __init__(self, src ='', debug =False):
        """Creates a new instance of ClassTemplate."""
        blocks = {'root':[
            BlockDefinition.createTripleHashDef(BlockDefinition.BLOCKED),
            BlockDefinition.createHashDef(BlockDefinition.BLOCKED),
            BlockDefinition.createRegexDef(BlockDefinition.BLOCKED),
            BlockDefinition.createTripleQuotesDef(BlockDefinition.BLOCKED),
            BlockDefinition.createTripleLiteralsDef(BlockDefinition.BLOCKED),
            BlockDefinition.createQuoteDef(BlockDefinition.BLOCKED),
            BlockDefinition.createLiteralDef(BlockDefinition.BLOCKED),
            BlockDefinition.createParensDef(),
            BlockDefinition.createBracketsDef(),
            BlockDefinition.createBracesDef() ]}

        LineTextAnalyzer.__init__(self, src, debug, blocks)
        self._globalClasses = []
Пример #4
0
    def __init__(self, src ='', debug =False):
        """Creates a new instance of ClassTemplate."""
        blocks = {'root':[
            BlockDefinition.createTripleHashDef(BlockDefinition.BLOCKED),
            BlockDefinition.createHashDef(BlockDefinition.BLOCKED),
            BlockDefinition.createRegexDef(BlockDefinition.BLOCKED),
            BlockDefinition.createTripleQuotesDef(BlockDefinition.BLOCKED),
            BlockDefinition.createTripleLiteralsDef(BlockDefinition.BLOCKED),
            BlockDefinition.createQuoteDef(BlockDefinition.BLOCKED),
            BlockDefinition.createLiteralDef(BlockDefinition.BLOCKED),
            BlockDefinition.createParensDef(),
            BlockDefinition.createBracketsDef(),
            BlockDefinition.createBracesDef() ]}

        LineTextAnalyzer.__init__(self, src, debug, blocks)
        self._globalClasses = []
Пример #5
0
    def __init__(self,
                 src='',
                 debug=False,
                 blockDefs=None,
                 debugData=None,
                 **kwargs):
        """Creates a new instance of ClassTemplate."""
        self._log = ArgsUtils.getLogger(self, kwargs)

        self._debugData = debugData
        self._debug = debug

        src = StringUtils.toUnicode(src)

        self._raw = src.replace('\r', '')
        if ArgsUtils.get('stripSource', True, kwargs):
            self._raw = self._raw.strip('\n')

        self._analyzed = False
        self._errors = []
        self._blocks = []
        self._bookmarks = []
        self._initialBlock = ArgsUtils.get('initialBlock', None, kwargs)

        if isinstance(blockDefs, BlockDefinition):
            self._blockDefs = {'root': blockDefs}
        elif isinstance(blockDefs, dict):
            self._blockDefs = blockDefs
        elif isinstance(blockDefs, list):
            self._blockDefs = {'root': blockDefs}
        else:
            self._blockDefs = {
                'root': [
                    BlockDefinition.createQuoteDef(BlockDefinition.BLOCKED),
                    BlockDefinition.createLiteralDef(BlockDefinition.BLOCKED),
                    BlockDefinition.createParensDef(),
                    BlockDefinition.createBracketsDef(),
                    BlockDefinition.createBracesDef(),
                ],
            }