def parse(self, input, partial=False): if not isinstance(input, str): input = ''.join(input) if not partial: input = fix_line_end(input) parser = zim.parser.Parser( Rule(LINK, url_re.r, process=self.parse_url) # FIXME need .r attribute because url_re is a Re object ) builder = ParseTreeBuilder(partial=partial) builder.start(FORMATTEDTEXT) parser(builder, input) builder.end(FORMATTEDTEXT) return builder.get_parsetree()
def parse(self, input, partial=False): if not isinstance(input, basestring): input = ''.join(input) if not partial: input = prepare_text(input) parser = zim.parser.Parser( Rule(LINK, url_re.r, process=self.parse_url) # FIXME need .r atribute because url_re is a Re object ) builder = ParseTreeBuilder(partial=partial) builder.start(FORMATTEDTEXT) parser(builder, input) builder.end(FORMATTEDTEXT) return builder.get_parsetree()