3

T'ícÉã@s”UdZddlZddlmZddlmZddlmZmZddl	m
Z
ddlmZddl
mZdd	lmZdd
lmZddlmZddlmZdd
lmZmZyddlmZWn ek
rÊddlmZYnXeje ƒZ!ej"dƒZ#ej"dƒZ$dddgZ%edd„ƒZ&ee'e'f&de&d<e'e'dœdd„Z(d-e'e'e)dœdd„Z*ed.ee'e)e'd!œd"d#„ƒZ+ee'e'ed/d$œd%d&„ƒZ,ee'dd'œd(d)„Z-ee'dd*œd+d,„Z.dS)0zreST helper functions.éN)Údefaultdict)Úcontextmanager)ÚDictÚ	Generator)Úeast_asian_width)Úroles)Úen)Ú
StringList)ÚReporter)ÚEnvironment)Ú__)ÚdocutilsÚlogging)Úpass_environment)Úenvironmentfilterz:\w+:.*?z([!-\-/:-@\[-`{-~])ú=ú-ú~cCsdS)NÚWF©rrrú1/tmp/pip-build-gk9425m9/sphinx/sphinx/util/rst.pyÚ<lambda>srZWFAÚja)ÚtextÚreturncCstjd|ƒ}tjdd|ƒ}|S)Nz\\\1z^\.z\.)Ú
symbols_reÚsubÚre)rrrrÚescape#srr)rÚ	widecharsrcs*tttdœdd„‰t‡‡fdd„|DƒƒS)zGet width of text.)ÚcharrrcSst|ƒ|krdSdSdS)Néé)r)r rrrrÚ	charwidth+sztextwidth.<locals>.charwidthc3s|]}ˆ|ˆƒVqdS)Nr)Ú.0Úc)r#rrrú	<genexpr>1sztextwidth.<locals>.<genexpr>)ÚstrÚintÚsum)rrr)r#rrÚ	textwidth)sr*r")ÚenvrÚlevelrcCs8|dkst‚t|t|jƒ}t|d}d|||fS)zCreate a heading for *level*.ér"z%s
%s)ÚAssertionErrorr*Ú	WIDECHARSÚlanguageÚSECTIONING_CHARS)r+rr,ÚwidthZsectioning_charrrrÚheading4sr3)ÚdocnameÚnamerccs^|rJtdddƒ}tj|td|ƒ\}}|r6tjd|ƒntjtdƒ||ddVtj	dƒdS)NÚérzdefault role %s not found)Úlocation)
r
rÚroleÚenglishr
Z
register_roleÚloggerÚwarningrZunregister_role)r4r5Zdummy_reporterZrole_fnÚ_rrrÚdefault_role=sr>)ÚcontentÚprologrcCs–|r’d}x"|D]}tj|ƒr&|d7}qPqW|dkrL|j|dddƒ|d7}x,t|jƒƒD]\}}|j|||d|ƒqZW|j||ddddƒdS)z+Prepend a string to content body as prolog.rr"r6z<generated>z<rst_prolog>N)Ú
docinfo_reÚmatchÚinsertÚ	enumerateÚ
splitlines)r?r@ÚposÚlineÚlinenorrrÚprepend_prologLs


rI)r?ÚepilogrcCsf|rbdt|ƒkr |jdƒ\}}nd}d}|jd||dƒx&t|jƒƒD]\}}|j|d|ƒqHWdS)z*Append a string to content body as epilog.rr"z<generated>r6z<rst_epilog>Néÿÿÿÿ)ÚlenÚinfoÚappendrDrE)r?rJÚsourcerHrGrrrÚ
append_epilogbsrP)r)r")NNN)/Ú__doc__rÚcollectionsrÚ
contextlibrÚtypingrrÚunicodedatarZdocutils.parsers.rstrZdocutils.parsers.rst.languagesrr:Zdocutils.statemachiner	Zdocutils.utilsr
Zjinja2rZ
sphinx.localerZsphinx.utilr
rZjinja2.utilsrÚImportErrorrÚ	getLoggerÚ__name__r;ÚcompilerArr1r/r'rr(r*r3r>rIrPrrrrÚ<module>s<