예제 #1
0
def enhance_tables(content):
    if not isinstance(content, contents.Article):
        return

    with modify_html(content) as html_tree:
        for table in html_tree.findall('.//table'):
            div = etree.Element('div')
            div.set('class', 'table')
            wrap_element(table, div)
예제 #2
0
def tweet_to_figure(blockquote):
    if 'twitter-tweet' not in blockquote.classes:
        return

    wrap_element(blockquote, etree.Element('figure'))
예제 #3
0
def object_to_figure(object_):
    wrap_element(object_, etree.Element('figure'))
예제 #4
0
def iframe_to_figure(iframe):
    wrap_element(iframe, etree.Element('figure'))