3

T'íc‡ã@s2dZddlZddlZddlZddlZddlZddlmZm	Z	m
Z
mZmZddl
mZddlmZmZmZddlmZddlmZddlmZdd	lmZdd
lmZmZddlmZm Z m!Z!ddl"m#Z#dd
l$m%Z%ddl&m'Z'erðddl(m)Z)e#j*e+ƒZ,e-e.e-dœdd„Z/Gdd„deƒZ0Gdd„de%eƒZdS)z/docutils writers handling Sphinx' custom nodes.éN)Ú
TYPE_CHECKINGÚIterableÚOptionalÚTupleÚcast)Únodes)ÚElementÚNodeÚText)ÚHTMLTranslator)ÚWriter)Úaddnodes)ÚBuilder)ÚRemovedInSphinx50WarningÚRemovedInSphinx60Warning)Ú_Ú__Úadmonitionlabels)Úlogging)ÚSphinxTranslator)Úget_image_size)ÚStandaloneHTMLBuilder)ÚlengthÚscaleÚreturncCsPtjd|ƒ}|s|S|dkr |S|jƒ\}}t|ƒ|d}dt|ƒ|fSdS)z/Multiply *length* (width or height) by *scale*.z^(\d*\.?\d*)\s*(\S*)$édz%s%sN)ÚreÚmatchÚgroupsÚfloatÚint)rrÚmatchedÚamountÚunitÚresult©r%ú5/tmp/pip-build-gk9425m9/sphinx/sphinx/writers/html.pyÚmultiply_length!sr'cs:eZdZddiZdddœ‡fdd„Zddœd	d
„Z‡ZS)Ú
HTMLWriterZembed_stylesheetFrN)Úbuilderrcstƒjƒ||_dS)N)ÚsuperÚ__init__r))Úselfr))Ú	__class__r%r&r+3s
zHTMLWriter.__init__)rcCst|jj|j|jƒ}tt|ƒ|_|jj|ƒ|jjƒ|_x dD]}t	||t
||dƒƒq<Wdj|jjdd…ƒ|_
dS)NÚhead_prefixÚ
stylesheetÚheadÚbody_prefixÚbody_pre_docinfoÚdocinfoÚbodyÚfragmentÚbody_suffixÚmetaÚtitleÚsubtitleÚheaderÚfooterÚhtml_prologÚ	html_headÚ
html_titleÚ
html_subtitleÚ	html_bodyÚé)r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@)r)Zcreate_translatorÚdocumentrrÚvisitorÚ	walkaboutÚastextÚoutputÚsetattrÚgetattrÚjoinr7Z
clean_meta)r,rDÚattrr%r%r&Ú	translate7szHTMLWriter.translate)Ú__name__Ú
__module__Ú__qualname__Zsettings_default_overridesr+rLÚ
__classcell__r%r%)r-r&r(.sr(csÞeZdZUdZdZdejeddœ‡fdd„Ze	ddœdd	„Z
e	ddœd
d„Ze	ddœdd
„Ze	ddœdd„Z
e	ddœdd„Ze	ddœdd„Ze	ddœdd„Ze	ddœdd„Ze	ddœdd„Ze	ddœdd„Ze	ddœdd„Ze	ddœdd„Ze	ddœd d!„Ze	ddœd"d#„Ze	ddœd$d%„Ze	ddœd&d'„Ze	ddœd(d)„Ze	ddœd*d+„Ze	ddœd,d-„Ze	ddœd.d/„Ze	ddœd0d1„Ze	ddœd2d3„Ze	ddœd4d5„Z e	ddœd6d7„Z!e	ddœd8d9„Z"e	ddœd:d;„Z#e	ddœd<d=„Z$e	ddœd>d?„Z%e	ddœd@dA„Z&e	ddœdBdC„Z'e	ddœdDdE„Z(e	ddœdFdG„Z)e	ddœdHdI„Z*e	ddœdJdK„Z+de	e,ddMœdNdO„Z-de.e	ddœdPdQ„Z/e	ddœdRdS„Z0e	ddœdTdU„Z1e	e2e3dVfdœdWdX„Z4e	ddœdYdZ„Z5e	ddœd[d\„Z6e	e,dd]œd^d_„Z7e	ddœd`da„Z8e	ddœ‡fdbdc„Z9e	ddœ‡fddde„Z:e	ddœdfdg„Z;e	ddœdhdi„Z<e	ddœdjdk„Z=e	ddœdldm„Z>e	ddœdndo„Z?e	ddœdpdq„Z@e	ddœ‡fdrds„ZAe	ddœ‡fdtdu„ZBe	ddœ‡fdvdw„ZCe	ddœ‡fdxdy„ZDe	ddœ‡fdzd{„ZEe	ddœd|d}„ZFe	ddœd~d„ZGe	ddœd€d„ZHe	ddœd‚dƒ„ZIe	ddœd„d…„ZJe	ddœd†d‡„ZKe	ddœdˆd‰„ZLe	ddœdŠd‹„ZMe	ddœdŒd„ZNe	ddœdŽd„ZOe	ddœdd‘„ZPeQeRdœ‡fd’d“„ZSe	ddœd”d•„ZTe	ddœd–d—„ZUe	ddœd˜d™„ZVe	ddœdšd›„ZWe	ddœ‡fdœd„ZXe	ddœ‡fdždŸ„ZYe	ddœ‡fd d¡„ZZe	ddœd¢d£„Z[e	ddœd¤d¥„Z\e	ddœd¦d§„Z]e	ddœd¨d©„Z^e	ddœdªd«„Z_e	ddœd¬d­„Z`e	ddœd®d¯„Zae	ddœd°d±„Zbe	ddœd²d³„Zce	ddœd´dµ„Zde	ddœd¶d·„Zee	ddœ‡fd¸d¹„Zfegddœdºd»„Zhe	ddœd¼d½„Zie	ddœd¾d¿„Zje	ddœdÀdÁ„Zke	ddœdÂdÄZle	ddœdÄdńZme	ddœdÆdDŽZne	ddœdÈdɄZoe	ddœdÊd˄Zpe	ddœdÌd̈́Zqe	ddœdÎdτZre	ddœdÐdфZse	ddœdÒdӄZte	ddœdÔdՄZue	ddœdÖdׄZve	ddœdØdلZwe	ddœdÚdۄZxe	ddœdÜd݄Zye	ddœdÞd߄Zze	ddœdàdá„Z{e	ddœdâdã„Z|e	ddœdädå„Z}e	ddœdædç„Z~e	ddœdèdé„Ze	ddœdêdë„Z€e	ddœdìdí„Ze	ddœdîdï„Z‚e	ddœ‡fdðdñ„Zƒe	ddœ‡fdòdó„Z„e	ddœdôdõ„Z…e	ddœ‡fdöd÷„Z†e	ddœ‡fdødù„Z‡e	ddœ‡fdúdû„Zˆe	ddœdüdý„Z‰e	ddœ‡fdþdÿ„ZŠde	e,ddœdd„Z‹de	e,ddœdd„ZŒde	e,ddœdd„Zde	e,ddœdd„ZŽee,d	œd
d„ƒZedd
„ƒZ‘edd„ƒZ’‡Z“S(rz%
    Our custom HTML translator.
    Nr)rCr)rcsdtƒj||ƒ|jj|_|jjg|_|jj|_d|_|jj	|_
d|_d|_dg|_
dg|_d|_dS)NrrA)r*r+r)ÚhighlighterZcurrent_docnameÚdocnamesÚconfigÚmanpages_urlÚprotect_literal_textZhtml_secnumber_suffixÚsecnumber_suffixÚparam_separatorÚoptional_param_levelÚ_table_row_indicesÚ_fieldlist_row_indicesÚrequired_params_left)r,rCr))r-r%r&r+Ms


zHTMLTranslator.__init__)ÚnodercCs(|jj|dƒ|jjd|dƒdS)NÚdocnamez<span id="document-%s"></span>)rRÚappendr4)r,r\r%r%r&Úvisit_start_of_file[sz"HTMLTranslator.visit_start_of_filecCs|jjƒdS)N)rRÚpop)r,r\r%r%r&Údepart_start_of_file`sz#HTMLTranslator.depart_start_of_filecCs|jj|j|dƒƒdS)NÚdl)r4r^Ústarttag)r,r\r%r%r&Ú
visit_descjszHTMLTranslator.visit_desccCs|jjdƒdS)Nz</dl>

)r4r^)r,r\r%r%r&Údepart_descmszHTMLTranslator.depart_desccCs&|jj|j|dƒƒ|jd7_dS)NÚdté)r4r^rcrU)r,r\r%r%r&Úvisit_desc_signaturepsz#HTMLTranslator.visit_desc_signaturecCs8|jd8_|jdƒs(|j|tdƒƒ|jjdƒdS)NrgZis_multilinezPermalink to this definitionz</dt>
)rUÚgetÚadd_permalink_refrr4r^)r,r\r%r%r&Údepart_desc_signatureus
z$HTMLTranslator.depart_desc_signaturecCsdS)Nr%)r,r\r%r%r&Úvisit_desc_signature_line{sz(HTMLTranslator.visit_desc_signature_linecCs,|jdƒr|j|jtdƒƒ|jjdƒdS)NZ
add_permalinkzPermalink to this definitionz<br />)rirjÚparentrr4r^)r,r\r%r%r&Údepart_desc_signature_line~s
z)HTMLTranslator.depart_desc_signature_linecCs|jj|j|ddƒƒdS)NÚddrA)r4r^rc)r,r\r%r%r&Úvisit_desc_content„sz!HTMLTranslator.visit_desc_contentcCs|jjdƒdS)Nz</dd>)r4r^)r,r\r%r%r&Údepart_desc_content‡sz"HTMLTranslator.depart_desc_contentcCs|jj|j|ddƒƒdS)NÚspanrA)r4r^rc)r,r\r%r%r&Úvisit_desc_inlineŠsz HTMLTranslator.visit_desc_inlinecCs|jjdƒdS)Nz</span>)r4r^)r,r\r%r%r&Údepart_desc_inlinesz!HTMLTranslator.depart_desc_inlinecCs|jj|j|ddƒƒdS)NÚcoderA)r4r^rc)r,r\r%r%r&Úvisit_desc_name“szHTMLTranslator.visit_desc_namecCs|jjdƒdS)Nz</code>)r4r^)r,r\r%r%r&Údepart_desc_name–szHTMLTranslator.depart_desc_namecCs|jj|j|ddƒƒdS)NrurA)r4r^rc)r,r\r%r%r&Úvisit_desc_addname™sz!HTMLTranslator.visit_desc_addnamecCs|jjdƒdS)Nz</code>)r4r^)r,r\r%r%r&Údepart_desc_addnameœsz"HTMLTranslator.depart_desc_addnamecCsdS)Nr%)r,r\r%r%r&Úvisit_desc_typeŸszHTMLTranslator.visit_desc_typecCsdS)Nr%)r,r\r%r%r&Údepart_desc_type¢szHTMLTranslator.depart_desc_typecCs(|jjdƒ|jjdƒ|jjdƒdS)Nz <span class="sig-return">z-<span class="sig-return-icon">&#x2192;</span>z# <span class="sig-return-typehint">)r4r^)r,r\r%r%r&Úvisit_desc_returns¥sz!HTMLTranslator.visit_desc_returnscCs|jjdƒdS)Nz</span></span>)r4r^)r,r\r%r%r&Údepart_desc_returnsªsz"HTMLTranslator.depart_desc_returnscCs:|jjdƒd|_d|_tdd„|jDƒƒ|_|j|_dS)Nz <span class="sig-paren">(</span>rgrcSsg|]}t|tjƒ‘qSr%)Ú
isinstancer
Zdesc_parameter)Ú.0Úcr%r%r&ú
<listcomp>²sz;HTMLTranslator.visit_desc_parameterlist.<locals>.<listcomp>)	r4r^Úfirst_paramrXÚsumÚchildrenr[Zchild_text_separatorrW)r,r\r%r%r&Úvisit_desc_parameterlist­sz'HTMLTranslator.visit_desc_parameterlistcCs|jjdƒdS)Nz <span class="sig-paren">)</span>)r4r^)r,r\r%r%r&Údepart_desc_parameterlist¶sz(HTMLTranslator.depart_desc_parameterlistcCsT|jrd|_n|js"|jj|jƒ|jdkr:|jd8_|jdƒsP|jjdƒdS)NrrgÚnoemphz<em>)r‚r[r4r^rWrXÚhasattr)r,r\r%r%r&Úvisit_desc_parameter¿s

z#HTMLTranslator.visit_desc_parametercCs.|jdƒs|jjdƒ|jr*|jj|jƒdS)Nr‡z</em>)rˆr4r^r[rW)r,r\r%r%r&Údepart_desc_parameterÉs
z$HTMLTranslator.depart_desc_parametercCs|jd7_|jjdƒdS)Nrgz<span class="optional">[</span>)rXr4r^)r,r\r%r%r&Úvisit_desc_optionalÏsz"HTMLTranslator.visit_desc_optionalcCs|jd8_|jjdƒdS)Nrgz<span class="optional">]</span>)rXr4r^)r,r\r%r%r&Údepart_desc_optionalÓsz#HTMLTranslator.depart_desc_optionalcCs|jj|j|ddddƒdS)NÚemrAÚproperty)ÚCLASS)r4r^rc)r,r\r%r%r&Úvisit_desc_annotation×sz$HTMLTranslator.visit_desc_annotationcCs|jjdƒdS)Nz</em>)r4r^)r,r\r%r%r&Údepart_desc_annotationÚsz%HTMLTranslator.depart_desc_annotationcCs |jj|j|d|ddƒdS)NÚdivÚtype)r)r4r^rc)r,r\r%r%r&Úvisit_versionmodifiedßsz$HTMLTranslator.visit_versionmodifiedcCs|jjdƒdS)Nz</div>
)r4r^)r,r\r%r%r&Údepart_versionmodifiedâsz%HTMLTranslator.depart_versionmodifiedcCs\ddi}|jdƒsd|kr,|dd7<n|dd7<d|kr„|dpNd|d<|jjr¤|djd	ƒr¤|j|dƒ|d<d
|_n d|ks”tdƒ‚d|d|d<t|jt	j
ƒsât|ƒd
krÎt|dt	jƒsÒt‚|dd7<d|krö|d|d<d|kr|d|d<|j
j|j|ddf|Žƒ|jdƒrX|j
jd|jdjtt|dƒƒƒdS)NÚclassÚ	referenceZinternalÚrefuriz	 internalz	 externalú#Úhrefzmailto:TZrefidz3References must have "refuri" or "refid" attribute.rgrz image-referenceZreftitler8ÚtargetÚarAÚ	secnumberz%sÚ.)riÚsettingsÚcloak_email_addressesÚ
startswithZcloak_mailtoÚ	in_mailtoÚAssertionErrorr~rmrZTextElementÚlenÚimager4r^rcrVrJÚmapÚstr)r,r\Úattsr%r%r&Úvisit_referenceæs.
 
zHTMLTranslator.visit_referencecCs|j|ƒdS)N)r©)r,r\r%r%r&Úvisit_number_referencesz%HTMLTranslator.visit_number_referencecCs|j|ƒdS)N)Údepart_reference)r,r\r%r%r&Údepart_number_referencesz&HTMLTranslator.depart_number_referencecCs
tj‚dS)N)rÚSkipNode)r,r\r%r%r&Ú
visit_comment	szHTMLTranslator.visit_commentrA)r\ÚnamercCsF|jj|j|dd|dƒ|r8|jdtj|t|ƒƒ|j|ƒdS)Nr’zadmonition )rr)r4r^rcÚinsertrr8rZset_first_last)r,r\r¯r%r%r&Úvisit_admonition
s

zHTMLTranslator.visit_admonitioncCs|jjdƒdS)Nz</div>
)r4r^)r,r\r%r%r&Údepart_admonitionsz HTMLTranslator.depart_admonitioncCs|j|dƒdS)NZseealso)r±)r,r\r%r%r&Ú
visit_seealsoszHTMLTranslator.visit_seealsocCs|j|ƒdS)N)r²)r,r\r%r%r&Údepart_seealsoszHTMLTranslator.depart_seealso.cCs¢|jdƒr|dSt|jtjƒrž|jjdkrb|jd
}d||jddf}||jjkr„d|}n"d|jdd}||jjkr„d	}|jjj|ƒrž|jj|SdS)NrÚ
singlehtmlrgz%s/#%sÚidsrz%s/r™rAéÿÿÿÿ)	rir~rmrÚsectionr)r¯rRZ
secnumbers)r,r\r]Z
anchornamer%r%r&Ú
get_secnumbers


zHTMLTranslator.get_secnumbercCs4|j|ƒ}|r0|jjddjtt|ƒƒ|jƒdS)Nz&<span class="section-number">%s</span>rž)r¹r4r^rJr¦r§rV)r,r\rr%r%r&Ú
add_secnumber0s
zHTMLTranslator.add_secnumbercsrttddœ‡fdd„}ˆjjjdj|ƒ}|rnt|dƒdkr\tdƒ|j}tj	||dn|||ddƒdS)	N)ÚfigtypeÚ	figure_idrcs²ˆjjdkr dˆjd	|f}n|}|ˆjjj|iƒkr®ˆjjdƒˆjjj|ƒ}|dkrrt	dƒ|}t
j|ƒn<ˆjj||}ˆjj|djt
t|ƒƒdƒˆjjdƒdS)
Nrµz%s/%srgz<span class="caption-number">z#numfig_format is not defined for %sržú z</span>r·)r)r¯rRZ
fignumbersrir4r^rSZ
numfig_formatrÚloggerÚwarningrJr¦r§)r»r¼ÚkeyÚprefixÚmsgZnumbers)r,r%r&Úappend_fignumber7s z6HTMLTranslator.add_fignumber.<locals>.append_fignumberZstdr¶rz Any IDs not assigned for %s node)Úlocation)
r§r)ÚenvÚdomainsZget_enumerable_node_typer¤rÚtagnamer¾r¿)r,r\rÃr»rÂr%)r,r&Ú
add_fignumber6szHTMLTranslator.add_fignumber)r\r8rcCsB|dr>|jjr>|jjr>d}|jj||dd||jjfƒdS)Nr¶z2<a class="headerlink" href="#%s" title="%s">%s</a>r)rSÚhtml_permalinksr)Úadd_permalinksr4r^Úhtml_permalinks_icon)r,r\r8Úformatr%r%r&rjPsz HTMLTranslator.add_permalink_refcCs<x6|ddd…D]"}|jjd|ƒ|dj|ƒqWdS)a­Generate hyperlink targets for listings.

        Original visit_bullet_list(), visit_definition_list() and visit_enumerated_list()
        generates hyperlink targets inside listing tags (<ul>, <ol> and <dl>) if multiple
        IDs are assigned to listings.  That is invalid DOM structure.
        (This is a bug of docutils <= 0.12)

        This exports hyperlink targets before listings to make valid DOM structure.
        r¶rgNz<span id="%s"></span>)r4r^Úremove)r,r\Úidr%r%r&Úgenerate_targets_for_listingVs
z+HTMLTranslator.generate_targets_for_listingcs<t|ƒdkr"t|dtjƒr"tj‚|j|ƒtƒj|ƒdS)Nrgr)	r¤r~r
Útoctreerr­rÏr*Úvisit_bullet_list)r,r\)r-r%r&rÑes
z HTMLTranslator.visit_bullet_listcs|j|ƒtƒj|ƒdS)N)rÏr*Úvisit_enumerated_list)r,r\)r-r%r&rÒms
z$HTMLTranslator.visit_enumerated_listcCs|jj|j|ddƒƒdS)NrorA)r4r^rc)r,r\r%r%r&Úvisit_definitionrszHTMLTranslator.visit_definitioncCs|jjdƒdS)Nz</dd>
)r4r^)r,r\r%r%r&Údepart_definitionwsz HTMLTranslator.depart_definitioncCs|jj|j|ddddƒdS)NrrrAÚ
classifier)r)r4r^rc)r,r\r%r%r&Úvisit_classifier{szHTMLTranslator.visit_classifiercCs6|jjdƒ|jddd}t|tjƒs2|jjdƒdS)Nz</span>FT)ÚdescendÚsiblingsz</dt>)r4r^Ú	next_noder~rrÕ)r,r\rÙr%r%r&Údepart_classifiersz HTMLTranslator.depart_classifiercCs|jj|j|ddƒƒdS)NrfrA)r4r^rc)r,r\r%r%r&Ú
visit_termˆszHTMLTranslator.visit_termcCsN|jddd}t|tjƒrn.t|jjjtjƒr>|j|tdƒƒ|j	j
dƒdS)NFT)r×rØzPermalink to this termz</dt>)rÙr~rrÕrmr
Zglossaryrjrr4r^)r,r\rÙr%r%r&Údepart_termŒszHTMLTranslator.depart_termcst|jtjƒrP|jjdƒrP|jj|j|dddddƒ|jjdƒ|jjdƒnt	ƒj
|ƒ|j|ƒ|j|jƒt|jt
jƒrŒ|jjdƒdS)	NrÐÚprAÚcaptionÚheading)rZROLEz<span class="caption-text">z</span></p>
)r~rmr
Zcompact_paragraphrir4r^rcÚcontextr*Úvisit_titlerºrÈrÚtable)r,r\)r-r%r&rášs
zHTMLTranslator.visit_titlecsà|jd}|jjr¶|jjr¶|jjdƒr¶|jdr¶|jdƒrN|j|jt	dƒƒqÐ|jdƒrˆ|j
jd|jdddt	dƒ|jjfƒqÐt
|jtjƒrÐ|j
jd	ƒ|j|jt	d
ƒƒnt
|jtjƒrÐ|j
jd	ƒtƒj|ƒdS)Nrgr¶z</hzPermalink to this headlinez</a></hz%</a><a class="headerlink" href="#%s" rz
title="%s">%sz</span>zPermalink to this tabler·)ràrSrÉr)rÊrmrˆr¡rjrr4r^rËr~rrâr*Údepart_title)r,r\Z	close_tag)r-r%r&rã¦s"


zHTMLTranslator.depart_titlecsÆ|j|jƒkrtƒj|ƒS|jddƒ}|jddƒ}|jdiƒ}|jddƒ|d<|jjj|iƒ}|rr|jjrr|jj}|jj	|j|f|||dœ|—Ž}|j
|dd	d
|d}|jj||dƒt
j‚dS)
NÚlanguageÚdefaultÚlinenosFÚhighlight_argsÚforce)ÚoptsrærÄr’rAzhighlight-%s notranslate)Úsuffixrz</div>
)Z	rawsourcerFr*Úvisit_literal_blockrirSZhighlight_optionsZhtml_codeblock_linenos_stylerQZhighlight_blockrcr4r^rr­)r,r\ÚlangrærçréZhighlightedrc)r-r%r&rë¼s 
z"HTMLTranslator.visit_literal_blockcs^t|jtjƒr(|jjdƒr(|jjdƒntƒj|ƒ|j	|jƒ|jj|j
|ddddƒdS)NÚ
literal_blockz <div class="code-block-caption">rrrAzcaption-text)r)r~rmrÚ	containerrir4r^r*Ú
visit_captionrÈrc)r,r\)r-r%r&rïÓs
zHTMLTranslator.visit_captioncs´|jjdƒt|jtjƒr:|jjdƒr:|j|jtdƒƒnBt|jtj	ƒr\|j|jtdƒƒn |jjdƒr||j|jjtdƒƒt|jtjƒr¤|jjdƒr¤|jjdƒnt
ƒj|ƒdS)Nz</span>rízPermalink to this codezPermalink to this imagerÐzPermalink to this toctreez</div>
)r4r^r~rmrrîrirjrÚfigurer*Údepart_caption)r,r\)r-r%r&rñÛszHTMLTranslator.depart_captioncCs|j|ƒdS)N)rë)r,r\r%r%r&Úvisit_doctest_blockësz"HTMLTranslator.visit_doctest_blockcCs|jj|j|dƒdƒdS)NÚ
blockquotez<div>)r4r^rc)r,r\r%r%r&Úvisit_block_quoteïsz HTMLTranslator.visit_block_quotecCs|jjdƒdS)Nz</div></blockquote>
)r4r^)r,r\r%r%r&Údepart_block_quoteòsz!HTMLTranslator.depart_block_quotecCsTd|dkr(|jj|j|ddddƒn(|jj|j|ddddƒ|jd7_dS)NÚkbdÚclassesrAzdocutils literal notranslate)rrurg)r4r^rcrU)r,r\r%r%r&Ú
visit_literalös
zHTMLTranslator.visit_literalcCs8d|dkr|jjdƒn|jd8_|jjdƒdS)Nrör÷z</kbd>rgz</code>)r4r^rU)r,r\r%r%r&Údepart_literalÿszHTMLTranslator.depart_literalcCsò|jj|j|dƒƒg}tttj|ƒ}x|D]}|j|dƒq.Wtdd„|Dƒƒ}d}x€|D]x}|dr¢|dj|ƒ}|jj|j|ddƒƒ|jj|dƒn |dk	rÂ|jjdd	t	|ƒƒ|j
|ƒ|jjd
ƒq`W|jjdƒtj‚dS)NÚpreZ	tokennamecss|]}t|ƒVqdS)N)r¤)rr¯r%r%r&ú	<genexpr>sz6HTMLTranslator.visit_productionlist.<locals>.<genexpr>ÚstrongrAz</strong> ::= z%s     r½Ú
z</pre>
)
r4r^rcrrr
Ú
productionÚmaxÚljustr¤rErr­)r,r\ÚnamesZproductionlistrþÚmaxlenÚlastnamer%r%r&Úvisit_productionlists$


z#HTMLTranslator.visit_productionlistcCsdS)Nr%)r,r\r%r%r&Údepart_productionlistsz$HTMLTranslator.depart_productionlistcCsdS)Nr%)r,r\r%r%r&Úvisit_productionszHTMLTranslator.visit_productioncCsdS)Nr%)r,r\r%r%r&Údepart_production sz HTMLTranslator.depart_productioncCs |jj|j|ddddƒdS)NrÝZcentered)rz<strong>)r4r^rc)r,r\r%r%r&Úvisit_centered#szHTMLTranslator.visit_centeredcCs|jjdƒdS)Nz
</strong></p>)r4r^)r,r\r%r%r&Údepart_centered'szHTMLTranslator.depart_centeredcs0t|jtjƒrdSt|jtjƒr$dStƒj|ƒS)z:Determine if the <p> tags around paragraph can be omitted.F)r~rmr
Zdesc_contentZversionmodifiedr*Úshould_be_compact_paragraph)r,r\)r-r%r&r
+s
z*HTMLTranslator.should_be_compact_paragraphcCsdS)Nr%)r,r\r%r%r&Úvisit_compact_paragraph5sz&HTMLTranslator.visit_compact_paragraphcCsdS)Nr%)r,r\r%r%r&Údepart_compact_paragraph8sz'HTMLTranslator.depart_compact_paragraphcCsÜdddœ}|jjs |jjdƒn¸d|krl|dd7<|d|d<|jj|j|ddf|Žƒ|jjd	ƒnld
|krÌ|dd7<tj|jjt	j
j|d
ƒƒ|d<|jj|j|ddf|Žƒ|jjd	ƒn|jjdƒdS)Nzreference downloadrA)r–Údownloadr˜r–z	 externalršrœz</a>Úfilenamez	 internal)r)Zdownload_supportràr^r4rcÚ	posixpathrJZdlpathÚurllibÚparseÚquote)r,r\r¨r%r%r&Úvisit_download_reference;s 
z'HTMLTranslator.visit_download_referencecCs|jj|jjƒƒdS)N)r4r^ràr`)r,r\r%r%r&Údepart_download_referenceOsz(HTMLTranslator.depart_download_referencecs|jddƒtƒj|ƒS)NÚalignrå)Ú
setdefaultr*Úvisit_figure)r,r\)r-r%r&rSszHTMLTranslator.visit_figurecs”|d}||jjkr0tj|jj|jj|ƒ|d<d|krªd|koFd|ksªttjj|jj|ƒƒ}|dkrzt	j
tdƒ|dn0d|kr’t|dƒ|d<d|krªt|dƒ|d<|d}|j
ƒjdƒr„d|i}d|krÞ|d|d<d|krò|d|d<d|kr<d|krt|d|dƒ|d<d|kr<t|d|dƒ|d<|jd|ƒ|d<d
|krfd|d
|d<|jj|j|ddf|ŽƒdStƒj|ƒdS)NÚurirÚwidthÚheightz7Could not obtain image size. :scale: option is ignored.)rÄrrgÚsvgÚsvgzÚsrcZaltrzalign-%sr–ÚimgrA)rr)r)ZimagesrrJZimgpathrÚosÚpathÚsrcdirr¾r¿rr§ÚlowerÚendswithr'rir4r^Zemptytagr*Úvisit_image)r,r\ZolduriÚsizerr¨)r-r%r&r$Zs@






zHTMLTranslator.visit_imagecs$|djƒjdƒrntƒj|ƒdS)Nrrr)rr)r"r#r*Údepart_image)r,r\)r-r%r&r&…szHTMLTranslator.depart_imagecCs
tj‚dS)N)rr­)r,r\r%r%r&Ú
visit_toctree‹szHTMLTranslator.visit_toctreecCs
tj‚dS)N)rr­)r,r\r%r%r&Úvisit_indexszHTMLTranslator.visit_indexcCs
tj‚dS)N)rr­)r,r\r%r%r&Úvisit_tabular_col_spec“sz%HTMLTranslator.visit_tabular_col_speccCsdS)Nr%)r,r\r%r%r&Úvisit_glossary–szHTMLTranslator.visit_glossarycCsdS)Nr%)r,r\r%r%r&Údepart_glossary™szHTMLTranslator.depart_glossarycCsdS)Nr%)r,r\r%r%r&Ú
visit_acksœszHTMLTranslator.visit_ackscCsdS)Nr%)r,r\r%r%r&Údepart_acksŸszHTMLTranslator.depart_ackscCs|jjdƒdS)Nz<table class="hlist"><tr>)r4r^)r,r\r%r%r&Úvisit_hlist¢szHTMLTranslator.visit_hlistcCs|jjdƒdS)Nz</tr></table>
)r4r^)r,r\r%r%r&Údepart_hlist¥szHTMLTranslator.depart_hlistcCs|jjdƒdS)Nz<td>)r4r^)r,r\r%r%r&Úvisit_hlistcol¨szHTMLTranslator.visit_hlistcolcCs|jjdƒdS)Nz</td>)r4r^)r,r\r%r%r&Údepart_hlistcol«szHTMLTranslator.depart_hlistcolcs(tƒj|ƒ|jdjddƒ|jd<dS)NrBz&nbsp;z&#160;éþÿÿÿr2)r*Úvisit_option_groupràÚreplace)r,r\)r-r%r&r3®sz!HTMLTranslator.visit_option_groupcCs¤|jƒ}|j|ƒ}|jr|x†|jj|ƒD]P}|jƒrD|jjd|ƒq&|dkrZ|jj|ƒq&|jjdt|ƒddƒq&Wn$|j	r”|j
jr”|j|ƒ}|jj|ƒdS)Nz<span class="pre">%s</span>z 
z&#160;rgr½)
rFÚencoderUZwords_and_spacesÚfindallÚstripr4r^r¤r¢rŸr Zcloak_email)r,r\ÚtextÚencodedÚtokenr%r%r&Ú
visit_Text³s
"
zHTMLTranslator.visit_TextcCs|j|dƒdS)NZnote)r±)r,r\r%r%r&Ú
visit_noteÈszHTMLTranslator.visit_notecCs|j|ƒdS)N)r²)r,r\r%r%r&Údepart_noteËszHTMLTranslator.depart_notecCs|j|dƒdS)Nr¿)r±)r,r\r%r%r&Ú
visit_warningÎszHTMLTranslator.visit_warningcCs|j|ƒdS)N)r²)r,r\r%r%r&Údepart_warningÑszHTMLTranslator.depart_warningcCs|j|dƒdS)NZ	attention)r±)r,r\r%r%r&Úvisit_attentionÔszHTMLTranslator.visit_attentioncCs|j|ƒdS)N)r²)r,r\r%r%r&Údepart_attention×szHTMLTranslator.depart_attentioncCs|j|dƒdS)NZcaution)r±)r,r\r%r%r&Ú
visit_cautionÚszHTMLTranslator.visit_cautioncCs|j|ƒdS)N)r²)r,r\r%r%r&Údepart_cautionÝszHTMLTranslator.depart_cautioncCs|j|dƒdS)NZdanger)r±)r,r\r%r%r&Úvisit_dangeràszHTMLTranslator.visit_dangercCs|j|ƒdS)N)r²)r,r\r%r%r&Ú
depart_dangerãszHTMLTranslator.depart_dangercCs|j|dƒdS)NÚerror)r±)r,r\r%r%r&Úvisit_erroræszHTMLTranslator.visit_errorcCs|j|ƒdS)N)r²)r,r\r%r%r&Údepart_errorészHTMLTranslator.depart_errorcCs|j|dƒdS)NZhint)r±)r,r\r%r%r&Ú
visit_hintìszHTMLTranslator.visit_hintcCs|j|ƒdS)N)r²)r,r\r%r%r&Údepart_hintïszHTMLTranslator.depart_hintcCs|j|dƒdS)NZ	important)r±)r,r\r%r%r&Úvisit_importantòszHTMLTranslator.visit_importantcCs|j|ƒdS)N)r²)r,r\r%r%r&Údepart_importantõszHTMLTranslator.depart_importantcCs|j|dƒdS)NZtip)r±)r,r\r%r%r&Ú	visit_tipøszHTMLTranslator.visit_tipcCs|j|ƒdS)N)r²)r,r\r%r%r&Ú
depart_tipûszHTMLTranslator.depart_tipcCs
|j|ƒS)N)Zvisit_emphasis)r,r\r%r%r&Úvisit_literal_emphasisþsz%HTMLTranslator.visit_literal_emphasiscCs
|j|ƒS)N)Zdepart_emphasis)r,r\r%r%r&Údepart_literal_emphasissz&HTMLTranslator.depart_literal_emphasiscCs
|j|ƒS)N)Zvisit_strong)r,r\r%r%r&Úvisit_literal_strongsz#HTMLTranslator.visit_literal_strongcCs
|j|ƒS)N)Z
depart_strong)r,r\r%r%r&Údepart_literal_strongsz$HTMLTranslator.depart_literal_strongcCs8i}|jdƒr|d|d<|jj|j|ddf|ŽƒdS)NZexplanationr8ZabbrrA)rˆr4r^rc)r,r\Úattrsr%r%r&Úvisit_abbreviation
s
z!HTMLTranslator.visit_abbreviationcCs|jjdƒdS)Nz</abbr>)r4r^)r,r\r%r%r&Údepart_abbreviationsz"HTMLTranslator.depart_abbreviationcCs2|j|ƒ|jr.|jjf|jŽ|d<|j|ƒdS)Nr˜)rOrTrÌÚ
attributesr©)r,r\r%r%r&Ú
visit_manpages
zHTMLTranslator.visit_manpagecCs|jr|j|ƒ|j|ƒdS)N)rTr«rP)r,r\r%r%r&Údepart_manpages
zHTMLTranslator.depart_manpagecs$|jjdƒ|jddƒtƒj|ƒS)Nrrrå)rYr^rr*Úvisit_table)r,r\)r-r%r&rY szHTMLTranslator.visit_tablecs|jjƒtƒj|ƒdS)N)rYr`r*Údepart_table)r,r\)r-r%r&rZ(s
zHTMLTranslator.depart_tablecCsb|jd	d7<|jd
ddkr4|djdƒn|djdƒ|jj|j|ddƒƒd|_dS)NrgrBrr÷zrow-evenzrow-oddÚtrrAr·r·)rYr^r4rcÚcolumn)r,r\r%r%r&Ú	visit_row,szHTMLTranslator.visit_rowcs(tƒj|ƒ|jddkr$d|jd<dS)Nrgz&nbsp;z&#160;r·r·)r*Úvisit_entryr4)r,r\)r-r%r&r^5szHTMLTranslator.visit_entrycs|jjdƒtƒj|ƒS)Nr)rZr^r*Úvisit_field_list)r,r\)r-r%r&r_:szHTMLTranslator.visit_field_listcs|jjƒtƒj|ƒS)N)rZr`r*Údepart_field_list)r,r\)r-r%r&r`>s
z HTMLTranslator.depart_field_listcCs`|jdd7<|jdddkr4|djdƒn|djdƒ|jj|j|ddd	d
ƒdS)
NrgrBrr÷z
field-evenz	field-oddr[rAÚfield)rr·r·)rZr^r4rc)r,r\r%r%r&Úvisit_fieldBs
zHTMLTranslator.visit_fieldcs@t|jƒ}tƒj|ƒ|t|jƒkr<|jdjddƒ|jd<dS)Nrgz&nbsp;z&#160;r·r·)r¤ràr*Úvisit_field_namer4)r,r\Z
context_count)r-r%r&rcJs
zHTMLTranslator.visit_field_name)r\Úmath_envrcCs*|jj}|jjjj|\}}|||ƒdS)N)r)Úmath_renderer_nameÚappÚregistryÚhtml_inline_math_renderers)r,r\rdr¯Úvisitrr%r%r&Ú
visit_mathPszHTMLTranslator.visit_mathcCs.|jj}|jjjj|\}}|r*|||ƒdS)N)r)rerfrgrh)r,r\rdr¯rÚdepartr%r%r&Údepart_mathUszHTMLTranslator.depart_mathcCs*|jj}|jjjj|\}}|||ƒdS)N)r)rerfrgÚhtml_block_math_renderers)r,r\rdr¯rirr%r%r&Úvisit_math_block[szHTMLTranslator.visit_math_blockcCs.|jj}|jjjj|\}}|r*|||ƒdS)N)r)rerfrgrm)r,r\rdr¯rrkr%r%r&Údepart_math_block`sz HTMLTranslator.depart_math_block)rcCstjdtdd|jjS)Nz,HTMLTranslator.permalink_text is deprecated.rB)Ú
stacklevel)ÚwarningsÚwarnrrSrË)r,r%r%r&Úpermalink_textfs
zHTMLTranslator.permalink_textcCstjdtdd|jdS)Nz"_fieldlist_row_index is deprecatedrB)rprgr·)rqrrrrZ)r,r%r%r&Ú_fieldlist_row_indexls
z#HTMLTranslator._fieldlist_row_indexcCstjdtdd|jdS)Nz_table_row_index is deprecatedrB)rprgr·)rqrrrrY)r,r%r%r&Ú_table_row_indexrs
zHTMLTranslator._table_row_index)rA)N)rA)rA)rA)rA)”rMrNrOÚ__doc__r)rrCrr+rr_rardrerhrkrlrnrprqrsrtrvrwrxryrzr{r|r}r…r†r‰rŠr‹rŒrr‘r”r•r©rªr¬r®r§r±rr²r³r´rr r¹rºrÈrjrÏrÑrÒrÓrÔrÖrÚrÛrÜrárãrërïrñròrôrõrørùrrrrrr	r	Úboolr
rrrrrr$r&r'r(r)r*r+r,r-r.r/r0r1r3r
r;r<r=r>r?r@rArBrCrDrErGrHrIrJrKrLrMrNrOrPrQrRrTrUrWrXrYrZr]r^r_r`rbrcrjrlrnrorŽrsrtrurPr%r%)r-r&rFs


		
		
+	r)1rvrrrÚurllib.parserrqÚtypingrrrrrZdocutilsrZdocutils.nodesrr	r
Zdocutils.writers.html4css1rZBaseTranslatorrZsphinxr
Zsphinx.buildersrZsphinx.deprecationrrZ
sphinx.localerrrZsphinx.utilrZsphinx.util.docutilsrZsphinx.util.imagesrZsphinx.builders.htmlrÚ	getLoggerrMr¾r§r r'r(r%r%r%r&Ú<module>s.