V!\c@sdZdZddlZddlZddlZddlmZddlmZm Z m Z ddl m Z ejdkrdd lmZni+dd 6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd!6dd#6dd%6dd'6dd)6dd+6dd-6dd/6dd16dd36dd56dd76dd:6dd<6dd>6ddA6ddC6ddF6ddH6ddJ6ddL6ddO6ddR6ddU6ddW6ddY6dd[6dd]6dd_6dda6ddc6dde6ddg6ZiZdhZdiZdjZdkZdlZdmZdnZdoZdpZdqdrdsdtdudvdwdxgZdyZdzZd{d|Zd}Z ej!d~ej"Z#dZ$dZ%dZ&dZ'dZ(dZ)dZ*dZ+dZ,dS(s9 This package contains directive implementation modules. treStructuredTextiN(tnodes(tsplit_escaped_whitespacet escape2nulltunescape(tenii(t __import__t admonitionst Attentiont attentiontCautiontcautiontbodyt CodeBlocktcodetDangertdangertErrorterrort Importantt importanttNotetnotetTipttiptHintthinttWarningtwarningt Admonitiont admonitiontSidebartsidebartTopicttopict LineBlocks line-blockt ParsedLiteralsparsed-literalt MathBlocktmathtRubrictrubrictEpigraphtepigrapht Highlightst highlightst PullQuotes pull-quotetCompoundtcompoundt Containert containerttablestRSTTablettabletCSVTables csv-tablet ListTables list-tabletimagestImagetimagetFiguretfiguretpartstContentstcontentstSectnumtsectnumtHeadertheadertFootertfootert referencest TargetNotess target-notesthtmltMetatmetatmisctRawtrawtIncludetincludetReplacetreplacetUnicodetunicodetClasstclasstRoletrolet DefaultRoles default-roletTitlettitletDatetdatet TestDirectivesrestructuredtext-test-directivecCs>|j}g}g}|tkr2t||fSd }y|j|}WnTtk ru}|jd||fn+tk r|jd||jfnX|sy"tj|}|jd|Wqtk r|jd||}qXn|r0|j j dj |d|j }|j|nyt |\} } Wntk r^d |fSXy"t| ttdd} WnItk r} |j|j jd | || fd|j d |fSXyt| | } | t|sN(RaRRRRj(RR<turi((sL/tmp/pip-install-usGedi/docutils/docutils/parsers/rst/directives/__init__.pyRs  cCs+t|}|dkr'tdn|S(s| Check for a nonnegative integer argument; raise ``ValueError`` if not. (Directive option conversion function.) is(negative value; must be positive or zero(tintR(Rtvalue((sL/tmp/pip-install-usGedi/docutils/docutils/parsers/rst/directives/__init__.pytnonnegative_ints  cCs1y|jd}Wntk r&nXt|S(sK Check for an integer percentage value with optional percent sign. s %(trstripRcR(R((sL/tmp/pip-install-usGedi/docutils/docutils/parsers/rst/directives/__init__.pyt percentages  temtextpxtintcmtmmtpttpccCstjddj||}yt|jdWnGttfk rtddjg|D]}d|^q_nX|jd|jdS(s Check for a positive argument of one of the units and return a normalized string of the form "" (without space in between). To be called from directive option conversion functions. s^([0-9.]+) *(%s)$t|is8not a positive measure of one of the following units: %sRs"%s"i(tretmatchRjtfloattgroupRcR(RtunitsRti((sL/tmp/pip-install-usGedi/docutils/docutils/parsers/rst/directives/__init__.pyt get_measures.cCst|tdgS(NR(Rt length_units(R((sL/tmp/pip-install-usGedi/docutils/docutils/parsers/rst/directives/__init__.pytlength_or_unitlesssRcCsmyt|tdgSWnNtk rhyt|dg|SWqitk rdt|tdgSXnXdS(s Return normalized string of a length or percentage unit. Add if there is no unit. Raise ValueError if the argument is not a positive measure of one of the valid CSS units (or without unit). >>> length_or_percentage_or_unitless('3 pt') '3pt' >>> length_or_percentage_or_unitless('3%', 'em') '3%' >>> length_or_percentage_or_unitless('3') '3' >>> length_or_percentage_or_unitless('3', 'px') '3px' t%RN(RRR(Rtdefault((sL/tmp/pip-install-usGedi/docutils/docutils/parsers/rst/directives/__init__.pyt length_or_percentage_or_unitlesss  cCsw|dkrtdn|j}g}xC|D];}tj|}|sbtd|n|j|q4W|S(s Convert the argument into a list of ID-compatible strings and return it. (Directive option conversion function.) Raise ``ValueError`` if no argument is found. s#argument required but none supplieds"cannot make "%s" into a class nameN(RaRRRtmake_idRd(Rtnamest class_namesR~t class_name((sL/tmp/pip-install-usGedi/docutils/docutils/parsers/rst/directives/__init__.pyt class_options   s2(?:0x|x|\\x|U\+?|\\u)([0-9a-f]+)$|&#x([0-9a-f]+);$cCsyj|jrtt|Stj|}|re|jdpO|jd}tt|dS|SWn#tk r}td|nXdS(s Convert a Unicode character code to a Unicode character. (Directive option conversion function.) Codes may be decimal numbers, hexadecimal numbers (prefixed by ``0x``, ``x``, ``\x``, ``U+``, ``u``, or ``\u``; e.g. ``U+262E``), or XML-style numeric character entities (e.g. ``☮``). Other text remains as-is. Raise ValueError for illegal Unicode code values. iiiscode too large (%s)N(tisdigittunichrRtunicode_patternRRt OverflowErrorR(RRRR|((sL/tmp/pip-install-usGedi/docutils/docutils/parsers/rst/directives/__init__.pyt unicode_code%s  cCs5t|}t|dkr1td|n|S(s A single character is returned as-is. Unicode characters codes are converted as in `unicode_code`. (Directive option conversion function.) is8%r invalid; must be a single character or a Unicode code(RtlenR(Rtchar((sL/tmp/pip-install-usGedi/docutils/docutils/parsers/rst/directives/__init__.pytsingle_char_or_unicode=s   cCs:|dkrd}n!|dkr*d}n t|}|S(s As with `single_char_or_unicode`, but "tab" and "space" are also supported. (Directive option conversion function.) ttabs tspaceR(R(RR((sL/tmp/pip-install-usGedi/docutils/docutils/parsers/rst/directives/__init__.pyt$single_char_or_whitespace_or_unicodeHs      cCs+t|}|dkr'tdn|S(s Converts the argument into an integer. Raises ValueError for negative, zero, or non-integer values. (Directive option conversion function.) is(negative or zero value; must be positive(RR(RR((sL/tmp/pip-install-usGedi/docutils/docutils/parsers/rst/directives/__init__.pyt positive_intUs  cCsGd|kr|jd}n |j}g|D]}t|^q1S(s Converts a space- or comma-separated list of values into a Python list of integers. (Directive option conversion function.) Raises ValueError for non-positive-integer values. t,(RR(Rtentriestentry((sL/tmp/pip-install-usGedi/docutils/docutils/parsers/rst/directives/__init__.pytpositive_int_list_s  cCs9ytj|Wn!tk r4td|nX|S(s Verfies the encoding argument by lookup. (Directive option conversion function.) Raises ValueError for unknown encodings. sunknown encoding: "%s"(tcodecstlookupt LookupErrorR(R((sL/tmp/pip-install-usGedi/docutils/docutils/parsers/rst/directives/__init__.pytencodingms  cCspy|jj}Wn'tk r?tdt|nX||krP|Std|t|fdS(s Directive option utility function, supplied to enable options whose argument must be a member of a finite set of possible values (must be lower case). A custom conversion function must be written to use it. For example:: from docutils.parsers.rst import directives def yesno(argument): return directives.choice(argument, ('yes', 'no')) Raise ``ValueError`` if no argument is found or if the argument's value is not valid (not an entry in the supplied list). s'must supply an argument; choose from %ss"%s" unknown; choose from %sN(R_RRcRt format_values(RtvaluesR((sL/tmp/pip-install-usGedi/docutils/docutils/parsers/rst/directives/__init__.pytchoicezs  cCs6ddjg|d D]}d|^q|dfS(Ns %s, or "%s"s, is"%s"(Rj(RR((sL/tmp/pip-install-usGedi/docutils/docutils/parsers/rst/directives/__init__.pyRs*csfd}|S(sA The argument can be any of `values` or `argument_type`. cs|kr|S|SdS(N((R(totherR(sL/tmp/pip-install-usGedi/docutils/docutils/parsers/rst/directives/__init__.pyt auto_or_others ((RRR((RRsL/tmp/pip-install-usGedi/docutils/docutils/parsers/rst/directives/__init__.pytvalue_ors(ii(RR(RR (sbodyR (RR(RsError(RR(RR(RR(RR(RsWarning(RR(sbodyR(sbodyR!(sbodyR#(sbodyR$(sbodyR%(sbodyR'(sbodyR)(sbodyR+(sbodyR-(sbodyR.(sbodys Container(stablesR3(stablesR5(stablesR6(R7sImage(R7R:(spartsR=(spartsR?(spartssHeader(spartsRC(RERF(shtmlRH(smiscRK(smiscsInclude(smiscRO(smiscsUnicode(smiscRS(smiscRU(smiscRW(smiscRX(smiscRZ(smiscR\(-t__doc__t __docformat__RRtsystdocutilsRtdocutils.utilsRRRtdocutils.parsers.rst.languagesRRgt version_infotdocutils._compatRRlR`R}RRRRRRRRRRRRRtcompilet IGNORECASERRRRRRRRRR(((sL/tmp/pip-install-usGedi/docutils/docutils/parsers/rst/directives/__init__.pyts     :