3

T'ícëã@sdZddlZddlZddlZddlZddlZddlmZm	Z	m
Z
mZmZm
Z
ddlmZddlmZmZmZddlmZddlmZddlmZdd	lmZmZdd
lmZm Z m!Z!ddl"m#Z#ddl$m%Z%dd
l&m'Z'erèddl(m)Z)e#j*e+ƒZ,e-e.e-dœdd„Z/Gdd„de%eƒZ0dS)zGExperimental docutils writers for HTML5 handling Sphinx's custom nodes.éN)Ú
TYPE_CHECKINGÚIterableÚOptionalÚSetÚTupleÚcast)Únodes)ÚElementÚNodeÚText)ÚHTMLTranslator)Ú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%ú6/tmp/pip-build-gk9425m9/sphinx/sphinx/writers/html5.pyÚmultiply_length sr'csjeZdZUdZdZdeƒZeee	j
eddœ‡fdd„Ze
ddœdd	„Ze
ddœd
d„Ze
ddœdd
„Ze
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œ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-„Z e
ddœd.d/„Z!e
ddœd0d1„Z"e
ddœd2d3„Z#e
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
eddMœdNdO„Z0de1e
ddœdPdQ„Z2e
ddœdRdS„Z3e
ddœdTdU„Z4e
e5e6dVfdœdWdX„Z7e
ddœdYdZ„Z8e
ddœd[d\„Z9e
edd]œd^d_„Z:e
ddœ‡fd`da„Z;e
ddœdbdc„Z<e
ddœddde„Z=e
ddœdfdg„Z>e
ddœdhdi„Z?e
ddœdjdk„Z@e
ddœdldm„ZAe
ddœ‡fdndo„ZBe
ddœ‡fdpdq„ZCe
ddœ‡fdrds„ZDe
ddœ‡fdtdu„ZEe
ddœ‡fdvdw„ZFe
ddœdxdy„ZGe
ddœdzd{„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‹„ZPe
ddœdŒd„ZQe
ddœdŽd„ZRe
ddœdd‘„ZSe
ddœd’d“„ZTe
ddœd”d•„ZUe
ddœ‡fd–d—„ZVe
ddœ‡fd˜d™„ZWe
ddœ‡fdš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©„Z_e
ddœdªd«„Z`e
ddœd¬d­„Zae
ddœd®d¯„Zbe
ddœd°d±„Zcedddœd²d³„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ÆdDŽ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œ‡fdêdë„Ze
ddœdìdí„Z‚e
ddœ‡fdîdï„Zƒe
ddœ‡fdðdñ„Z„e
ddœdòdó„Z…de
eddôœdõdö„Z†d	e
eddôœd÷dø„Z‡d
e
eddôœdùdú„Zˆde
eddôœdûdü„Z‰eŠedýœdþdÿ„ƒZ‹e
ddœdd„ZŒeŠdd„ƒZeŠdd„ƒZŽ‡ZS(ÚHTML5Translatorz%
    Our custom HTML translator.
    Nr)ÚdocumentÚbuilderrcsdtƒj||ƒ|jj|_|jjg|_|jj|_d|_|jj	|_
d|_d|_dg|_
dg|_d|_dS)NrÚ)ÚsuperÚ__init__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)Úselfr)r*)Ú	__class__r%r&r-8s


zHTML5Translator.__init__)ÚnodercCs(|jj|dƒ|jjd|dƒdS)NÚdocnamez<span id="document-%s"></span>)r/ÚappendÚbody)r9r;r%r%r&Úvisit_start_of_fileFsz#HTML5Translator.visit_start_of_filecCs|jjƒdS)N)r/Úpop)r9r;r%r%r&Údepart_start_of_fileKsz$HTML5Translator.depart_start_of_filecCs|jj|j|dƒƒdS)NÚdl)r>r=Ústarttag)r9r;r%r%r&Ú
visit_descUszHTML5Translator.visit_desccCs|jjdƒdS)Nz</dl>

)r>r=)r9r;r%r%r&Údepart_descXszHTML5Translator.depart_desccCs&|jj|j|dƒƒ|jd7_dS)NÚdté)r>r=rCr2)r9r;r%r%r&Úvisit_desc_signature[sz$HTML5Translator.visit_desc_signaturecCs8|jd8_|jdƒs(|j|tdƒƒ|jjdƒdS)NrGZis_multilinezPermalink to this definitionz</dt>
)r2ÚgetÚadd_permalink_refrr>r=)r9r;r%r%r&Údepart_desc_signature`s
z%HTML5Translator.depart_desc_signaturecCsdS)Nr%)r9r;r%r%r&Úvisit_desc_signature_linefsz)HTML5Translator.visit_desc_signature_linecCs,|jdƒr|j|jtdƒƒ|jjdƒdS)NZ
add_permalinkzPermalink to this definitionz<br />)rIrJÚparentrr>r=)r9r;r%r%r&Údepart_desc_signature_lineis
z*HTML5Translator.depart_desc_signature_linecCs|jj|j|ddƒƒdS)NÚddr+)r>r=rC)r9r;r%r%r&Úvisit_desc_contentosz"HTML5Translator.visit_desc_contentcCs|jjdƒdS)Nz</dd>)r>r=)r9r;r%r%r&Údepart_desc_contentrsz#HTML5Translator.depart_desc_contentcCs|jj|j|ddƒƒdS)NÚspanr+)r>r=rC)r9r;r%r%r&Úvisit_desc_inlineusz!HTML5Translator.visit_desc_inlinecCs|jjdƒdS)Nz</span>)r>r=)r9r;r%r%r&Údepart_desc_inlinexsz"HTML5Translator.depart_desc_inlinecCs|jj|j|ddƒƒdS)NrRr+)r>r=rC)r9r;r%r%r&Úvisit_desc_name~szHTML5Translator.visit_desc_namecCs|jjdƒdS)Nz</span>)r>r=)r9r;r%r%r&Údepart_desc_namesz HTML5Translator.depart_desc_namecCs|jj|j|ddƒƒdS)NrRr+)r>r=rC)r9r;r%r%r&Úvisit_desc_addname„sz"HTML5Translator.visit_desc_addnamecCs|jjdƒdS)Nz</span>)r>r=)r9r;r%r%r&Údepart_desc_addname‡sz#HTML5Translator.depart_desc_addnamecCsdS)Nr%)r9r;r%r%r&Úvisit_desc_typeŠszHTML5Translator.visit_desc_typecCsdS)Nr%)r9r;r%r%r&Údepart_desc_typesz HTML5Translator.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">)r>r=)r9r;r%r%r&Úvisit_desc_returnssz"HTML5Translator.visit_desc_returnscCs|jjdƒdS)Nz</span></span>)r>r=)r9r;r%r%r&Údepart_desc_returns•sz#HTML5Translator.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<HTML5Translator.visit_desc_parameterlist.<locals>.<listcomp>)	r>r=Úfirst_paramr5ÚsumÚchildrenr8Zchild_text_separatorr4)r9r;r%r%r&Úvisit_desc_parameterlist˜sz(HTML5Translator.visit_desc_parameterlistcCs|jjdƒdS)Nz <span class="sig-paren">)</span>)r>r=)r9r;r%r%r&Údepart_desc_parameterlist¡sz)HTML5Translator.depart_desc_parameterlistcCsT|jrd|_n|js"|jj|jƒ|jdkr:|jd8_|jdƒsP|jjdƒdS)NrrGÚnoemphz<em class="sig-param">)rar8r>r=r4r5Úhasattr)r9r;r%r%r&Úvisit_desc_parameterªs

z$HTML5Translator.visit_desc_parametercCs.|jdƒs|jjdƒ|jr*|jj|jƒdS)Nrfz</em>)rgr>r=r8r4)r9r;r%r%r&Údepart_desc_parameter´s
z%HTML5Translator.depart_desc_parametercCs|jd7_|jjdƒdS)NrGz<span class="optional">[</span>)r5r>r=)r9r;r%r%r&Úvisit_desc_optionalºsz#HTML5Translator.visit_desc_optionalcCs|jd8_|jjdƒdS)NrGz<span class="optional">]</span>)r5r>r=)r9r;r%r%r&Údepart_desc_optional¾sz$HTML5Translator.depart_desc_optionalcCs|jj|j|ddddƒdS)NÚemr+Úproperty)ÚCLASS)r>r=rC)r9r;r%r%r&Úvisit_desc_annotationÂsz%HTML5Translator.visit_desc_annotationcCs|jjdƒdS)Nz</em>)r>r=)r9r;r%r%r&Údepart_desc_annotationÅsz&HTML5Translator.depart_desc_annotationcCs |jj|j|d|ddƒdS)NÚdivÚtype)rn)r>r=rC)r9r;r%r%r&Úvisit_versionmodifiedÊsz%HTML5Translator.visit_versionmodifiedcCs|jjdƒdS)Nz</div>
)r>r=)r9r;r%r%r&Údepart_versionmodifiedÍsz&HTML5Translator.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-referenceZreftitleÚtitleÚtargetÚar+Ú	secnumberz%sÚ.)rIÚsettingsÚcloak_email_addressesÚ
startswithZcloak_mailtoÚ	in_mailtoÚAssertionErrorr]rMrZTextElementÚlenÚimager>r=rCr3ÚjoinÚmapÚstr)r9r;Úattsr%r%r&Úvisit_referenceÑs.
 
zHTML5Translator.visit_referencecCs|j|ƒdS)N)rŠ)r9r;r%r%r&Úvisit_number_referenceísz&HTML5Translator.visit_number_referencecCs|j|ƒdS)N)Údepart_reference)r9r;r%r%r&Údepart_number_referenceðsz'HTML5Translator.depart_number_referencecCs
tj‚dS)N)rÚSkipNode)r9r;r%r%r&Ú
visit_commentôszHTML5Translator.visit_commentr+)r;ÚnamercCs<|jj|j|dd|dƒ|r8|jdtj|t|ƒƒdS)Nrqzadmonition )rnr)r>r=rCÚinsertrrzr)r9r;rr%r%r&Úvisit_admonitionøs
z HTML5Translator.visit_admonitioncCs|jjdƒdS)Nz</div>
)r>r=)r9r;r%r%r&Údepart_admonitionþsz!HTML5Translator.depart_admonitioncCs|j|dƒdS)NZseealso)r’)r9r;r%r%r&Ú
visit_seealsoszHTML5Translator.visit_seealsocCs|j|ƒdS)N)r“)r9r;r%r%r&Údepart_seealsoszHTML5Translator.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/rxr+éÿÿÿÿ)	rIr]rMrÚsectionr*rr/Z
secnumbers)r9r;r<Z
anchornamer%r%r&Ú
get_secnumbers


zHTML5Translator.get_secnumbercCs4|j|ƒ}|r0|jjddjtt|ƒƒ|jƒdS)Nz&<span class="section-number">%s</span>r~)ršr>r=r†r‡rˆr3)r9r;r}r%r%r&Ú
add_secnumbers
zHTML5Translator.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r/Z
fignumbersrIr>r=r0Z
numfig_formatrÚloggerÚwarningr†r‡rˆ)rœrÚkeyÚprefixÚmsgZnumbers)r9r%r&Úappend_fignumber"s z7HTML5Translator.add_fignumber.<locals>.append_fignumberZstdr—rz Any IDs not assigned for %s node)Úlocation)
rˆr*ÚenvÚdomainsZget_enumerable_node_typer„rÚtagnamerŸr )r9r;r¤rœr£r%)r9r&Ú
add_fignumber!szHTML5Translator.add_fignumber)r;rzrcCsB|dr>|jjr>|jjr>d}|jj||dd||jjfƒdS)Nr—z2<a class="headerlink" href="#%s" title="%s">%s</a>r)r0Úhtml_permalinksr*Úadd_permalinksr>r=Úhtml_permalinks_icon)r9r;rzÚformatr%r%r&rJ;sz!HTML5Translator.add_permalink_refcs2t|ƒdkr"t|dtjƒr"tj‚tƒj|ƒdS)NrGr)r„r]r
ÚtoctreerrŽr,Úvisit_bullet_list)r9r;)r:r%r&r¯Bsz!HTML5Translator.visit_bullet_listcCs|jj|j|ddƒƒdS)NrOr+)r>r=rC)r9r;r%r%r&Úvisit_definitionIsz HTML5Translator.visit_definitioncCs|jjdƒdS)Nz</dd>
)r>r=)r9r;r%r%r&Údepart_definitionNsz!HTML5Translator.depart_definitioncCs|jj|j|ddddƒdS)NrRr+Ú
classifier)rn)r>r=rC)r9r;r%r%r&Úvisit_classifierRsz HTML5Translator.visit_classifiercCs6|jjdƒ|jddd}t|tjƒs2|jjdƒdS)Nz</span>FT)ÚdescendÚsiblingsz</dt>)r>r=Ú	next_noder]rr²)r9r;r¶r%r%r&Údepart_classifierVsz!HTML5Translator.depart_classifiercCs|jj|j|ddƒƒdS)NrFr+)r>r=rC)r9r;r%r%r&Ú
visit_term_szHTML5Translator.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
ZglossaryrJrr>r=)r9r;r¶r%r%r&Údepart_termcszHTML5Translator.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®Úpr+ÚcaptionÚheading)rnZROLEz<span class="caption-text">z</span></p>
)r]rMr
Zcompact_paragraphrIr>r=rCÚcontextr,Úvisit_titler›r©rÚtable)r9r;)r:r%r&r¾qs
zHTML5Translator.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½r0rªr*r«rMrgrrJrr>r=r¬r]rr¿r,Údepart_title)r9r;Z	close_tag)r:r%r&rÀ}s"


zHTML5Translator.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¥rqr+zhighlight-%s notranslate)Úsuffixrnz</div>
)Z	rawsourceÚastextr,Úvisit_literal_blockrIr0Zhighlight_optionsZhtml_codeblock_linenos_styler.Zhighlight_blockrCr>r=rrŽ)r9r;ÚlangrÃrÄrÆZhighlightedrC)r:r%r&rɓs 
z#HTML5Translator.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">rRr+zcaption-text)rn)r]rMrÚ	containerrIr>r=r,Ú
visit_captionr©rC)r9r;)r:r%r&rͪs
zHTML5Translator.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>
)r>r=r]rMrrÌrIrJrÚfigurer,Údepart_caption)r9r;)r:r%r&rϲszHTML5Translator.depart_captioncCs|j|ƒdS)N)rÉ)r9r;r%r%r&Úvisit_doctest_blockÂsz#HTML5Translator.visit_doctest_blockcCs|jj|j|dƒdƒdS)NÚ
blockquotez<div>)r>r=rC)r9r;r%r%r&Úvisit_block_quoteÆsz!HTML5Translator.visit_block_quotecCs|jjdƒdS)Nz</div></blockquote>
)r>r=)r9r;r%r%r&Údepart_block_quoteÉsz"HTML5Translator.depart_block_quotecCsTd|dkr(|jj|j|ddddƒn(|jj|j|ddddƒ|jd7_dS)NÚkbdÚclassesr+zdocutils literal notranslate)rnÚcoderG)r>r=rCr2)r9r;r%r%r&Ú
visit_literalÍs
zHTML5Translator.visit_literalcCs8d|dkr|jjdƒn|jd8_|jjdƒdS)NrÔrÕz</kbd>rGz</code>)r>r=r2)r9r;r%r%r&Údepart_literalÖszHTML5Translator.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„)r^rr%r%r&ú	<genexpr>ãsz7HTML5Translator.visit_productionlist.<locals>.<genexpr>Ústrongr+z</strong> ::= z%s     ržÚ
z</pre>
)
r>r=rCrrr
Ú
productionÚmaxÚljustr„Z	walkaboutrrŽ)r9r;ÚnamesZproductionlistrÝÚmaxlenÚlastnamer%r%r&Úvisit_productionlistÝs$


z$HTML5Translator.visit_productionlistcCsdS)Nr%)r9r;r%r%r&Údepart_productionlistñsz%HTML5Translator.depart_productionlistcCsdS)Nr%)r9r;r%r%r&Úvisit_productionôsz HTML5Translator.visit_productioncCsdS)Nr%)r9r;r%r%r&Údepart_production÷sz!HTML5Translator.depart_productioncCs |jj|j|ddddƒdS)NrºZcentered)rnz<strong>)r>r=rC)r9r;r%r%r&Úvisit_centeredúszHTML5Translator.visit_centeredcCs|jjdƒdS)Nz
</strong></p>)r>r=)r9r;r%r%r&Údepart_centeredþszHTML5Translator.depart_centeredcCsdS)Nr%)r9r;r%r%r&Úvisit_compact_paragraphsz'HTML5Translator.visit_compact_paragraphcCsdS)Nr%)r9r;r%r%r&Údepart_compact_paragraphsz(HTML5Translator.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 downloadr+)ruÚdownloadrwruz	 externalryr|z</a>Úfilenamez	 internal)r*Zdownload_supportr½r=r>rCÚ	posixpathr†ZdlpathÚurllibÚparseÚquote)r9r;r‰r%r%r&Úvisit_download_references 
z(HTML5Translator.visit_download_referencecCs|jj|jjƒƒdS)N)r>r=r½r@)r9r;r%r%r&Údepart_download_referencesz)HTML5Translator.depart_download_referencecs|jddƒtƒj|ƒS)NÚalignrÂ)Ú
setdefaultr,Úvisit_figure)r9r;)r:r%r&rõszHTML5Translator.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ÚsrcZaltrózalign-%sruÚimgr+)rùrú)r*Zimagesrír†ZimgpathrÚosÚpathÚsrcdirrŸr rrˆÚlowerÚendswithr'rIr>r=Zemptytagr,Úvisit_image)r9r;ZolduriÚsizerör‰)r:r%r&r&s@






zHTML5Translator.visit_imagecs$|djƒjdƒrntƒj|ƒdS)Nrörùrú)rùrú)rrr,Údepart_image)r9r;)r:r%r&rQszHTML5Translator.depart_imagecCs
tj‚dS)N)rrŽ)r9r;r%r%r&Ú
visit_toctreeWszHTML5Translator.visit_toctreecCs
tj‚dS)N)rrŽ)r9r;r%r%r&Úvisit_index\szHTML5Translator.visit_indexcCs
tj‚dS)N)rrŽ)r9r;r%r%r&Úvisit_tabular_col_spec_sz&HTML5Translator.visit_tabular_col_speccCsdS)Nr%)r9r;r%r%r&Úvisit_glossarybszHTML5Translator.visit_glossarycCsdS)Nr%)r9r;r%r%r&Údepart_glossaryeszHTML5Translator.depart_glossarycCsdS)Nr%)r9r;r%r%r&Ú
visit_ackshszHTML5Translator.visit_ackscCsdS)Nr%)r9r;r%r%r&Údepart_ackskszHTML5Translator.depart_ackscCs|jjdƒdS)Nz<table class="hlist"><tr>)r>r=)r9r;r%r%r&Úvisit_hlistnszHTML5Translator.visit_hlistcCs|jjdƒdS)Nz</tr></table>
)r>r=)r9r;r%r%r&Údepart_hlistqszHTML5Translator.depart_hlistcCs|jjdƒdS)Nz<td>)r>r=)r9r;r%r%r&Úvisit_hlistcoltszHTML5Translator.visit_hlistcolcCs|jjdƒdS)Nz</td>)r>r=)r9r;r%r%r&Údepart_hlistcolwszHTML5Translator.depart_hlistcolcCs¤|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ž)
rÈÚencoder2Zwords_and_spacesÚfindallÚstripr>r=r„r‚rr€Zcloak_email)r9r;ÚtextÚencodedÚtokenr%r%r&Ú
visit_Text{s
"
zHTML5Translator.visit_TextcCs|j|dƒdS)NZnote)r’)r9r;r%r%r&Ú
visit_noteszHTML5Translator.visit_notecCs|j|ƒdS)N)r“)r9r;r%r%r&Údepart_note“szHTML5Translator.depart_notecCs|j|dƒdS)Nr )r’)r9r;r%r%r&Ú
visit_warning–szHTML5Translator.visit_warningcCs|j|ƒdS)N)r“)r9r;r%r%r&Údepart_warning™szHTML5Translator.depart_warningcCs|j|dƒdS)NZ	attention)r’)r9r;r%r%r&Úvisit_attentionœszHTML5Translator.visit_attentioncCs|j|ƒdS)N)r“)r9r;r%r%r&Údepart_attentionŸsz HTML5Translator.depart_attentioncCs|j|dƒdS)NZcaution)r’)r9r;r%r%r&Ú
visit_caution¢szHTML5Translator.visit_cautioncCs|j|ƒdS)N)r“)r9r;r%r%r&Údepart_caution¥szHTML5Translator.depart_cautioncCs|j|dƒdS)NZdanger)r’)r9r;r%r%r&Úvisit_danger¨szHTML5Translator.visit_dangercCs|j|ƒdS)N)r“)r9r;r%r%r&Ú
depart_danger«szHTML5Translator.depart_dangercCs|j|dƒdS)NÚerror)r’)r9r;r%r%r&Úvisit_error®szHTML5Translator.visit_errorcCs|j|ƒdS)N)r“)r9r;r%r%r&Údepart_error±szHTML5Translator.depart_errorcCs|j|dƒdS)NZhint)r’)r9r;r%r%r&Ú
visit_hint´szHTML5Translator.visit_hintcCs|j|ƒdS)N)r“)r9r;r%r%r&Údepart_hint·szHTML5Translator.depart_hintcCs|j|dƒdS)NZ	important)r’)r9r;r%r%r&Úvisit_importantºszHTML5Translator.visit_importantcCs|j|ƒdS)N)r“)r9r;r%r%r&Údepart_important½sz HTML5Translator.depart_importantcCs|j|dƒdS)NZtip)r’)r9r;r%r%r&Ú	visit_tipÀszHTML5Translator.visit_tipcCs|j|ƒdS)N)r“)r9r;r%r%r&Ú
depart_tipÃszHTML5Translator.depart_tipcCs
|j|ƒS)N)Zvisit_emphasis)r9r;r%r%r&Úvisit_literal_emphasisÆsz&HTML5Translator.visit_literal_emphasiscCs
|j|ƒS)N)Zdepart_emphasis)r9r;r%r%r&Údepart_literal_emphasisÉsz'HTML5Translator.depart_literal_emphasiscCs
|j|ƒS)N)Zvisit_strong)r9r;r%r%r&Úvisit_literal_strongÌsz$HTML5Translator.visit_literal_strongcCs
|j|ƒS)N)Z
depart_strong)r9r;r%r%r&Údepart_literal_strongÏsz%HTML5Translator.depart_literal_strongcCs8i}|jdƒr|d|d<|jj|j|ddf|ŽƒdS)NZexplanationrzZabbrr+)rgr>r=rC)r9r;Úattrsr%r%r&Úvisit_abbreviationÒs
z"HTML5Translator.visit_abbreviationcCs|jjdƒdS)Nz</abbr>)r>r=)r9r;r%r%r&Údepart_abbreviationØsz#HTML5Translator.depart_abbreviationcCs2|j|ƒ|jr.|jjf|jŽ|d<|j|ƒdS)Nrw)r*r1r­Ú
attributesrŠ)r9r;r%r%r&Ú
visit_manpageÛs
zHTML5Translator.visit_manpagecCs|jr|j|ƒ|j|ƒdS)N)r1rŒr+)r9r;r%r%r&Údepart_manpageás
zHTML5Translator.depart_manpagecCs|jjdƒi}dd„|jjjdƒDƒ}|jddƒ|jd|jddƒƒd	|krbd
|d	|d<|j|dfd
dj|ƒi|—Ž}|j	j|ƒdS)NrcSsg|]}|jdƒ‘qS)z 	
)r)r^Úclsr%r%r&r`ìsz/HTML5Translator.visit_table.<locals>.<listcomp>ú,Údocutilszalign-%srórÂr÷z	width: %sÚstyler¿rnrž)
r6r=rZtable_styleÚsplitr‘rIrCr†r>)r9r;r‰rÕÚtagr%r%r&Úvisit_tableèszHTML5Translator.visit_tablecs|jjƒtƒj|ƒdS)N)r6r@r,Údepart_table)r9r;)r:r%r&r;÷s
zHTML5Translator.depart_tablecCsb|jd	d7<|jd
ddkr4|djdƒn|djdƒ|jj|j|ddƒƒd|_dS)NrGérrÕzrow-evenzrow-oddÚtrr+r˜r˜)r6r=r>rCÚcolumn)r9r;r%r%r&Ú	visit_rowûszHTML5Translator.visit_rowcs|jjdƒtƒj|ƒS)Nr)r7r=r,Úvisit_field_list)r9r;)r:r%r&r@sz HTML5Translator.visit_field_listcs|jjƒtƒj|ƒS)N)r7r@r,Údepart_field_list)r9r;)r:r%r&rAs
z!HTML5Translator.depart_field_listcCsF|jdd7<|jdddkr4|djdƒn|djdƒdS)	NrGr<rrÕz
field-evenz	field-oddr˜r˜)r7r=)r9r;r%r%r&Úvisit_fieldszHTML5Translator.visit_field)r;Úmath_envrcCs*|jj}|jjjj|\}}|||ƒdS)N)r*Úmath_renderer_nameÚappÚregistryÚhtml_inline_math_renderers)r9r;rCrÚvisitrr%r%r&Ú
visit_mathszHTML5Translator.visit_mathcCs.|jj}|jjjj|\}}|r*|||ƒdS)N)r*rDrErFrG)r9r;rCrrÚdepartr%r%r&Údepart_mathszHTML5Translator.depart_mathcCs*|jj}|jjjj|\}}|||ƒdS)N)r*rDrErFÚhtml_block_math_renderers)r9r;rCrrHrr%r%r&Úvisit_math_blocksz HTML5Translator.visit_math_blockcCs.|jj}|jjjj|\}}|r*|||ƒdS)N)r*rDrErFrL)r9r;rCrrrJr%r%r&Údepart_math_block#sz!HTML5Translator.depart_math_block)rcCstjdtdd|jjS)Nz,HTMLTranslator.permalink_text is deprecated.r<)Ú
stacklevel)ÚwarningsÚwarnrr0r¬)r9r%r%r&Úpermalink_text)s
zHTML5Translator.permalink_textcCsLtjdtddx6|ddd…D]"}|jjd|ƒ|dj|ƒq"WdS)aZGenerate hyperlink targets for tables.

        Original visit_table() generates hyperlink targets inside table tags
        (<table>) if multiple IDs are assigned to listings.
        That is invalid DOM structure.  (This is a bug of docutils <= 0.13.1)

        This exports hyperlink targets before tables to make valid DOM structure.
        z*generate_targets_for_table() is deprecatedr<)rOr—rGNz<span id="%s"></span>)rPrQrr>r=Úremove)r9r;Úidr%r%r&Úgenerate_targets_for_table/s
	
z*HTML5Translator.generate_targets_for_tablecCstjdtdd|jdS)Nz"_fieldlist_row_index is deprecatedr<)rOrGr˜)rPrQrr7)r9r%r%r&Ú_fieldlist_row_index>s
z$HTML5Translator._fieldlist_row_indexcCstjdtdd|jdS)Nz_table_row_index is deprecatedr<)rOrGr˜)rPrQrr6)r9r%r%r&Ú_table_row_indexDs
z HTML5Translator._table_row_index)r+)N)r+)r+)r+)r+)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r*ÚsetZsupported_inline_tagsrrˆrr)rr-r	r?rArDrErHrKrLrNrPrQrSrTrUrVrWrXrYrZr[r\rdrerhrirjrkrorprsrtrŠ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ärårærçrèrérêrñròrõrrrrrrr	r
rrr
rrrrrrrrrrrrrr r"r#r$r%r&r'r(r)r*r+r,r-r/r0r2r3r:r;r?r@rArBrIrKrMrNrmrRrUrVrWÚ
__classcell__r%r%)r:r&r(-s

		
		+	r()1r[rýrírÚurllib.parserîrPÚtypingrrrrrrr6rZdocutils.nodesr	r
rZdocutils.writers.html5_polyglotrZBaseTranslatorZsphinxr
Zsphinx.buildersrZsphinx.deprecationrrZ
sphinx.localerrrZsphinx.utilrZsphinx.util.docutilsrZsphinx.util.imagesrZsphinx.builders.htmlrÚ	getLoggerrXrŸrˆr r'r(r%r%r%r&Ú<module>s*