Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(3)  |  Call(2)  |  Derive(0)  |  Import(1)
Extract messages from HTML with embedded obvt text/template script tags.
    

        def html_extractor(fileobj, keywords, comment_tags, options):
    """Extract messages from HTML with embedded obvt text/template script tags.
    """
    tree = html.parse(fileobj)
    for el in tree.xpath('//script[@type="text/template"]'):
        el_sourceline = el.sourceline
        for sourceline, d, message_id, l in extractor(
            StringIO(el.text), keywords, comment_tags,
            options):
            yield el_sourceline + sourceline - 1, d, message_id, l
        


src/b/a/babel-obviel-0.7.1/babelobviel/test/test_extractor.py   babel-obviel(Download)
from babelobviel.obvt import extractor, html_extractor
import os
 
def datafile(name):
    return os.path.join(os.path.dirname(__file__), 'testdata', name)
def test_html_extractor():
    with open(datafile('test1.html')) as f:
        r = list(html_extractor(f, [], [], []))
        assert len(r) == 1
        lineno, funcname, message, comments = r[0]
def test_html_extractor_multi_line():
    with open(datafile('test2.html')) as f:
        r = list(html_extractor(f, [], [], []))
        assert len(r) == 1
        lineno, funcname, message, comments = r[0]