ó ÿgdSc@srdZddlZddlmZmZddlmZddlmZddl m Z ddl m Z ddl mZmZmZi ejd 6ejd 6ejd 6ejd 6ejd 6ejd6ejd6ejd6ejd6ejd6Zx[ejƒD]M\ZZejeeƒZejeeiegd6ƒZejeeƒqûWdefd„ƒYZigd„Z ej!dƒZ"igd„Z#ej!dƒZ$igd„Z%ej!dej&ƒZ'igd„Z(igd„Z)i edej*ƒd6ed e+ƒd!6e d"6e d#6e#d$6e#d%6e%d&6e%d'6e(d(6e)d)6Z,x*e,jƒD]\ZZ-ejee-ƒqNWdS(*s¾ sphinx.roles ~~~~~~~~~~~~ Handlers for additional ReST roles. :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. iÿÿÿÿN(tnodestutils(troles(taddnodes(t_(tws_re(tsplit_explicit_titletprocess_index_entrytset_role_source_infotcommandtdfntkbdt mailheadertmakevartmanpagetmimetypet newsgrouptprogramtregexptclassestXRefRolecBsbeZdZejZejZe e dde d„Z d„Z igd„Z d„Zd„ZRS(sA A generic cross-referencing role. To create a callable that can be used as a role function, create an instance of this class. The general features of this role are: * Automatic creation of a reference and a content node. * Optional separation of title and target with `title `. * The implementation is a class rather than a function to make customization easier. Customization can be done in two ways: * Supplying constructor parameters: * `fix_parens` to normalize parentheses (strip from target, and add to title if configured) * `lowercase` to lowercase the target * `nodeclass` and `innernodeclass` select the node classes for the reference and the content node * Subclassing and overwriting `process_link()` and/or `result_nodes()`. cCsO||_||_||_|dk r3||_n|dk rK||_ndS(N(t fix_parenst lowercaset warn_danglingtNonet nodeclasstinnernodeclass(tselfRRRRR((s6/usr/local/lib/python2.7/site-packages/sphinx/roles.pyt__init__Gs      cCsd|s>|jdƒr"|d }n|jjr>|d7}q>n|jdƒrZ|d }n||fS(Ns()iþÿÿÿ(tendswithtconfigtadd_function_parentheses(Rtenvthas_explicit_titlettitlettarget((s6/usr/local/lib/python2.7/site-packages/sphinx/roles.pyt _fix_parensQs   cCs0|jjj}|s$|jj}n |jƒ}d|krXd|} } d| g} n1|jddƒ\} } d| d| | fg} |dd!dkr tj|ƒd}|j rÙ|j |t |dƒ\}} n|j ||d| ƒ} |j |j|| d t ƒSt|ƒ\}}}tj|ƒ}tj|ƒ}|jrX|jƒ}n|j r‚|j ||||ƒ\}}n|j|d | d | d |ƒ}t|||ƒ|j|||||ƒ\}}||d <||j ||d| ƒ7}|j|d<|j|d<|j |j||d tƒS(Nt:ttxrefis%s-%sit!Rtis_reftreftypet refdomaint refexplicitt reftargettrefdoctrefwarn(tdocumenttsettingsR Rt default_roletlowertsplitRtunescapeRR$tFalseRt result_nodesRRRRt process_linktdocnameRtTrue(RttyptrawtextttexttlinenotinlinertoptionstcontentR tdomaintroleRttgtt innernodeR!R"R#trefnode((s6/usr/local/lib/python2.7/site-packages/sphinx/roles.pyt__call__^sD    !      cCs|tjd|ƒfS(sëCalled after parsing title and target text, and creating the reference node (given in *refnode*). This method can alter the reference node and must return a new (or the same) ``(title, target)`` tuple. t (Rtsub(RR RFR!R"R#((s6/usr/local/lib/python2.7/site-packages/sphinx/roles.pyR8scCs |ggfS(s(Called before returning the finished nodes. *node* is the reference node if one was created (*is_ref* is then true), else the content node. This method can add other nodes and must return a ``(nodes, messages)`` tuple (the usual return value of a role function). ((RR0R tnodeR)((s6/usr/local/lib/python2.7/site-packages/sphinx/roles.pyR7—sN(t__name__t __module__t__doc__Rt pending_xrefRRtliteralRR6RRR$RGR8R7(((s6/usr/local/lib/python2.7/site-packages/sphinx/roles.pyR,s   0 c Cs|jjj}|s$|jj}n |jƒ}tj|ƒ}d|jdƒ} t j ƒ} t j ddd| gƒ} |jj | ƒ|dkrÌdtdƒ|| dfg| dR?R@RAR R=ttargetidt indexnodet targetnodetanchort anchorindextpepnumtmsgtprbtreftsntrntrfcnum((s6/usr/local/lib/python2.7/site-packages/sphinx/roles.pytindexmarkup_role s`              s(?u‣R<s&&t&iRt acceleratori( RR5treplacet_amp_reR4Rtemphasist enumeratetlentTexttinlinetappend(R;R<R=R>R?R@RAtspansRJtitspanttextnodet accel_nodet letter_node((s6/usr/local/lib/python2.7/site-packages/sphinx/roles.pyt menusel_roleÙs*      s {([^}]+)}c Cstj|ƒ}d}tjd|jƒd|gƒ}x‰tj|ƒD]x} | jƒ|krŠ||| jƒ!} |tj| | ƒ7}n|tj | j dƒ| j dƒƒ7}| j ƒ}qFW|t |ƒkrõ|tj||||ƒ7}n|ggfS(NiRCRi( RR5RROR3t _litvar_retfinditertstartR}RztgrouptendR|( R;R<R=R>R?R@RAtpostretnodetmttxt((s6/usr/local/lib/python2.7/site-packages/sphinx/roles.pytemph_literal_roleôs!(!s \((.*)\)$c Cs‡tj|ƒ}tj|ƒ}|dkrCtj||ƒggfS||jƒ jƒ}|j dƒ} tj||d| ƒggfS(Nit explanation( RR5t_abbr_retsearchRRt abbreviationR‰tstripRŠ( R;R<R=R>R?R@RARŽtabbrtexpl((s6/usr/local/lib/python2.7/site-packages/sphinx/roles.pyt abbr_roles cCs|jjj}d|jdƒ}tjddd|gƒ} t|ƒ\} } } tj| ƒ} tj| ƒ} | rˆt | |ƒ} nGd}| j dƒrº| d} | d} d}nd| ||fg} t j ƒ}| |d R?R@RAR RhRjR!R"R#RTR™RiRƒ((s6/usr/local/lib/python2.7/site-packages/sphinx/roles.pyt index_roles&     RtdownloadRtdocRRRYtguilabelRutfiletsampR–RP(.RMtretdocutilsRRtdocutils.parsers.rstRtsphinxRt sphinx.localeRt sphinx.utilRtsphinx.util.nodesRRRRcRzROtliteral_emphasistgeneric_docrolest iteritemstrolenameRt GenericRoletgenerict CustomRoleRCtregister_local_roletobjectRRttcompileRyR†R‡RtSR’R˜R›tdownload_referenceR:tspecific_docrolestfunc(((s6/usr/local/lib/python2.7/site-packages/sphinx/roles.pyt sX           u6