4Qc@sdZdZddlZddlZddlZddlmZddlmZ ej dkrrddl m Z ni+dd 6dd 6dd6dd6dd6dd6dd6dd6dd6dd6dd 6dd"6dd$6dd&6dd(6dd*6dd,6dd.6dd06dd26dd46dd66dd96dd;6dd=6dd@6ddB6ddE6ddG6ddI6ddK6ddN6ddQ6ddT6ddV6ddX6ddZ6dd\6dd^6dd`6ddb6ddd6ddf6Z iZdgZdhZdiZdjZdkZdlZdmZdnZdoZdpdqdrdsdtdudvdwgZdxZdyZdzd{Zd|Zejd}ejZd~Z dZ!dZ"dZ#dZ$dZ%dZ&dZ'dS(s9 This package contains directive implementation modules. treStructuredTextiN(tnodes(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|" (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: %st s"%s"i(tretmatchRgtfloattgroupR`R~(RtunitsRti((sR/usr/local/lib/python2.7/site-packages/docutils/parsers/rst/directives/__init__.pyt get_measures.cCst|tdgS(NR(Rt length_units(R((sR/usr/local/lib/python2.7/site-packages/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((sR/usr/local/lib/python2.7/site-packages/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^R~RRtmake_idRa(Rtnamest class_namesR{t class_name((sR/usr/local/lib/python2.7/site-packages/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 RRRy((sR/usr/local/lib/python2.7/site-packages/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((sR/usr/local/lib/python2.7/site-packages/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((sR/usr/local/lib/python2.7/site-packages/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((sR/usr/local/lib/python2.7/site-packages/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((sR/usr/local/lib/python2.7/site-packages/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((sR/usr/local/lib/python2.7/site-packages/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\R}R`R~t format_values(RtvaluesR((sR/usr/local/lib/python2.7/site-packages/docutils/parsers/rst/directives/__init__.pytchoicexs  cCs6ddjg|d D]}d|^q|dfS(Ns %s, or "%s"s, is"%s"(Rg(RR((sR/usr/local/lib/python2.7/site-packages/docutils/parsers/rst/directives/__init__.pyRs*(ii(RR(RR(R R (RR (RR(RR(RR(RR(RR(RsWarning(RR(R R(R R(R R (R R!(R R"(R R$(R R&(R R((R R*(R R+(R s Container(R/R0(R/R2(R/R3(R4R5(R4R7(spartsR:(spartsR<(spartsR>(spartsR@(RBRC(RDRE(RGRH(RGsInclude(RGRL(RGRN(RGRP(RGRR(RGRT(RGRU(RGRW(RGRY((t__doc__t __docformat__RRtsystdocutilsRtdocutils.parsers.rst.languagesRRdt version_infotdocutils._compatRRiR]RzR|RRRRRRRRRRRRtcompilet IGNORECASERRRRRRRRR(((sR/usr/local/lib/python2.7/site-packages/docutils/parsers/rst/directives/__init__.pyts     :