<s> """<STR_LIT>""" <EOL> from docutils import frontend <EOL> from docutils import nodes <EOL> from docutils import utils <EOL> from docutils . parsers import rst <EOL> import six <EOL> def parse_text ( text ) : <EOL> parser = rst . Parser ( ) <EOL> settings = frontend . OptionParser ( components = ( rst . Parser , ) ) . get_default_values ( ) <EOL> document = utils . new_document ( text , settings ) <EOL> parser . parse ( text , document ) <EOL> return document . children <EOL> paragraph = lambda text : parse_text ( text ) [ <NUM_LIT:0> ] <EOL> note = lambda msg : nodes . note ( "<STR_LIT>" , paragraph ( msg ) ) <EOL> hint = lambda msg : nodes . hint ( "<STR_LIT>" , * parse_text ( msg ) ) <EOL> warning = lambda msg : nodes . warning ( "<STR_LIT>" , paragraph ( msg ) ) <EOL> category = lambda title : parse_text ( "<STR_LIT>" % ( title , "<STR_LIT:->" * len ( title ) ) ) [ <NUM_LIT:0> ] <EOL> subcategory = lambda title : parse_text ( "<STR_LIT>" % ( title , "<STR_LIT>" * len ( title ) ) ) [ <NUM_LIT:0> ] <EOL> def make_definition ( term , ref , descriptions ) : <EOL> """<STR_LIT>""" <EOL> ref = ref . replace ( "<STR_LIT:_>" , "<STR_LIT:->" ) . replace ( "<STR_LIT:U+0020>" , "<STR_LIT:->" ) <EOL> definition = parse_text ( <EOL> "<STR_LIT>" % <EOL> { "<STR_LIT>" : ref , "<STR_LIT>" : term } ) <EOL> for descr in descriptions : <EOL> if isinstance ( descr , ( six . text_type , six . binary_type ) ) : <EOL> descr = paragraph ( "<STR_LIT>" % descr ) <EOL> definition . append ( descr ) <EOL> return definition </s>
