(html_file)
return output
Get the next command-line option.
Get the next command-line option.
Get the next command - line option .
def _get_options(html_file):
    """Get the next command-line option."""
    parser = etree.HTMLParser(encoding='utf-8')
    doc = etree.parse(html_file, parser)
    output = []
    for node in doc.xpath('//h3[@id="options"]/following-sibling::dl/dt/code'):
        node.tag = 'a'
        node.attrib.clear()
        link_id = node.getparent().get('id')
        if link_id:
            node.set('href', '#' + link_id)
            node.set('class', 'option-link')
            node.text = '[' + (node.text or '')
            try:
                last = node.getchildren()[-1]
                last.tail = (last.tail or '') + ']'
            except IndexError:
                node.text += ']'
            node.tail = '\n'
            output.append(node)
    return output
def _get_options ( html_file ) : parser = etree . HTMLParser ( encoding = 'utf-8' ) doc = etree . parse ( html_file , parser ) output = [ ] for node in doc . xpath ( '//h3[@id="options"]/following-sibling::dl/dt/code' ) : node . tag = 'a' node . attrib . clear ( ) link_id = node . getparent ( ) . get ( 'id' ) if link_id : node . set ( 'href' , '#' + link_id ) node . set ( 'class' , 'option-link' ) node . text = '[' + ( node . text or '' ) try : last = node . getchildren ( ) [ - 1 ] last . tail = ( last . tail or '' ) + ']' except IndexError : node . text += ']' node . tail = '\n' output . append ( node ) return output