z]c@sdZdZddlZddlZddlZddlmZddlmZm Z m Z ddl m Z i+dd 6dd 6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd 6dd"6dd$6dd&6dd(6dd*6dd,6dd.6dd06dd26dd46dd76dd96dd;6dd>6dd@6ddC6ddE6ddG6ddI6ddL6ddO6ddR6ddT6ddV6ddX6ddZ6dd\6dd^6dd`6ddb6ddd6ZiZdeZdfZdgZdhZdiZdjZdkZdlZdmZdndodpdqdrdsdtdugZdvZdwZdxdyZdzZejd{ejZ d|Z!d}Z"d~Z#dZ$dZ%dZ&dZ'dZ(dZ)dS(s9 This package contains directive implementation modules. treStructuredTextiN(tnodes(tsplit_escaped_whitespacet escape2nulltunescape(tent 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(R`RRRRi(RR;turi((sJ/tmp/pip-build-kBFYxq/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((sJ/tmp/pip-build-kBFYxq/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 %(trstripRbR(R((sJ/tmp/pip-build-kBFYxq/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(tretmatchRitfloattgroupRbR(RtunitsRti((sJ/tmp/pip-build-kBFYxq/docutils/docutils/parsers/rst/directives/__init__.pyt get_measures.cCst|tdgS(NR(Rt length_units(R((sJ/tmp/pip-build-kBFYxq/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((sJ/tmp/pip-build-kBFYxq/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(R`RRRtmake_idRc(Rtnamest class_namesR~t class_name((sJ/tmp/pip-build-kBFYxq/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(R RRR|((sJ/tmp/pip-build-kBFYxq/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((sJ/tmp/pip-build-kBFYxq/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((sJ/tmp/pip-build-kBFYxq/docutils/docutils/parsers/rst/directives/__init__.pyt$single_char_or_whitespace_or_unicodeFs      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((sJ/tmp/pip-build-kBFYxq/docutils/docutils/parsers/rst/directives/__init__.pyt positive_intSs  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((sJ/tmp/pip-build-kBFYxq/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((sJ/tmp/pip-build-kBFYxq/docutils/docutils/parsers/rst/directives/__init__.pytencodingks  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^RRbRt format_values(RtvaluesR((sJ/tmp/pip-build-kBFYxq/docutils/docutils/parsers/rst/directives/__init__.pytchoicexs  cCs6ddjg|d D]}d|^q|dfS(Ns %s, or "%s"s, is"%s"(Ri(RR((sJ/tmp/pip-build-kBFYxq/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(sJ/tmp/pip-build-kBFYxq/docutils/docutils/parsers/rst/directives/__init__.pyt auto_or_others ((RRR((RRsJ/tmp/pip-build-kBFYxq/docutils/docutils/parsers/rst/directives/__init__.pytvalue_ors(RR(RR (R R (RR(RR(RR(RR(RR(RR(RR(RR(R R(R R (R R"(R R#(R R$(R R&(R R((R R*(R R,(R R-(R R/(R1R2(R1R4(R1R5(R6R7(R6R9(R;R<(R;R>(R;R@(R;RB(RDRE(RFRG(RIRJ(RIRL(RIRN(RIRP(RIRR(RIRT(RIRV(RIRW(RIRY(RIR[(*t__doc__t __docformat__RRtsystdocutilsRtdocutils.utilsRRRtdocutils.parsers.rst.languagesRRfRkR_R}RRRRRRRRRRRRRtcompilet IGNORECASERRRRRRRRRR(((sJ/tmp/pip-build-kBFYxq/docutils/docutils/parsers/rst/directives/__init__.pyts     :