Example #1
0
    def apply(self, text, tags=None, vars=[]):
        # Dummy plugin
        class LogPlugin(Plugin):
            name = 'log'
            log = []
            def run(self, args, state):
                self.log.append(args)

        document = parse_string(dedent(text))
        validate(document, '', {'log': LogPlugin})
        apply_document(document, tags or set(), {'variables': vars})
        print LogPlugin.log
        return LogPlugin.log
Example #2
0
 def find(self, text, tags=None):
     document = parse_string(dedent(text))
     validate(document, '', {'test': TestPlugin})
     result = find_variables(document, tags or set())
     print result
     return result
Example #3
0
 def validate(self, text):
     document = parse_string(dedent(text))
     validate(document, '', [])
     return document