ó 1Tc@sydZddlZddlZddlmZddlmZddlmZde fd„ƒYZ ej dej ƒZ e Zd „ZejejejejfZd „Zd „Zd „Zd „Zd„Zd„Zd„ZddddddgZd„Zd„Zdd„Z d„Z!d„Z"d„Z#e#ej$_%ej&dkruej$j'Z(d„Z)e)ej$_'ndS( sŲ sphinx.util.nodes ~~~~~~~~~~~~~~~~~ Docutils node-related utility functions for Sphinx. :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. i’’’’N(tnodes(taddnodes(tpairindextypest WarningStreamcBseZd„Zd„ZRS(cCs||_tjdƒ|_dS(Ns+\((DEBUG|INFO|WARNING|ERROR|SEVERE)/[0-4]\)(twarnfunctretcompilet_re(tselfR((ssphinx/util/nodes.pyt__init__s cCs;|jƒ}|r7|j|jjd|ƒddƒndS(Ns\1:t(tstripRRtsubtNone(Rttext((ssphinx/util/nodes.pytwrites (t__name__t __module__R R(((ssphinx/util/nodes.pyRs s^(.+?)\s*(?$cCs½|jr dSt|tjƒrv|j}|jdk rv|j|_|jd|_|jjddƒd|_dSnt|tj tj tj tjfƒr¹t |ƒ|_d|_dSdS(Nis ii( tsourcet isinstanceRttermtparenttlineR t rawsourcetsplittcaptionttitletrubrictfind_source_node(tnodetdefinition_list_item((ssphinx/util/nodes.pytapply_source_workaround&s$     ccsµx®|jtjƒD]š}t|ƒ|js2qnt|tƒrSd|krSqnt|tjƒr~|jddkr~qn|j j ddƒj ƒ}|r||fVqqWdS(s3Extract translatable messages from a document tree.t translatableitorphans t N( ttraverseRt TextElementRRRt IGNORED_NODESt field_nametchildrenRtreplaceR (tdoctreeRtmsg((ssphinx/util/nodes.pytextract_messagesLs  %cCs+x$t|ƒD]}|jr |jSq WdS(N(ttraverse_parentR(Rtpnode((ssphinx/util/nodes.pyR`s ccsx|r|V|j}qWdS(N(R(R((ssphinx/util/nodes.pyR,fs ccsUd„}xE|j|ƒD]4}d|kr8|d}n |d}||fVqWdS(s6Traverse translatable index node from a document tree.cSs%t|tjƒo$|jdƒtkS(Ntinline(RRtindextgettFalse(R((ssphinx/util/nodes.pytis_block_indexnst raw_entriestentriesN(R#(R)R2RR4((ssphinx/util/nodes.pyttraverse_translatable_indexls     cCsm|jj}|jj}g|j_d|j_z|j|d|ddƒSWd||j_||j_XdS(sūVersion of state.nested_parse() that allows titles and does not require titles to have the same decoration as the calling document. This is useful when the parsed content comes from a completely different context, such as docstrings. it match_titlesiN(tmemot title_stylest section_levelt nested_parse(tstatetcontentRtsurrounding_title_stylestsurrounding_section_level((ssphinx/util/nodes.pytnested_parse_with_titlesys     cCs=|jƒ}x$|jtjƒD]}d|d s@            $