o -$`W9 @s2dZdZddlZddlZddlZddlmZddlmZm Z ddl m Z m Z m Z ddlmZejdkr5eZid d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*id+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdV Z iZ dWdXZdYdZZd[d\Zd]d^Zd_d`ZdadbZdcddZdedfZdgdhZgdiZdjdkZ dldmZ!ddodpZ"dqdrZ#e$dsej%Z&dtduZ'dvdwZ(dxdyZ)dzd{Z*d|d}Z+d~dZ,ddZ-ddZ.ddZ/ddZ0dS)z9 This package contains directive implementation modules. reStructuredTextN) import_module)nodesparsers)split_escaped_whitespace escape2nullunescape)en)r attention) admonitions Attentioncaution)r Cautioncode)body CodeBlockdanger)r Dangererror)r Error important)r Importantnote)r Notetip)r Tiphint)r Hintwarning)r Warning admonition)r Admonitionsidebar)rSidebartopic)rTopicz line-block)r LineBlockzparsed-literal)r ParsedLiteralmath)r MathBlockrubric)rRubricepigraph)rEpigraph highlights)r Highlightsz pull-quote)r PullQuotecompound)rCompound container)r Containertable)tablesRSTTablez csv-table)r7CSVTablez list-table)r7 ListTableimage)imagesImagefigure)r<Figurecontents)partsContentssectnum)rASectnumheader)rAHeaderfooter)rAFooterz target-notes) references TargetNotesmeta)htmlMetaraw)miscRaw)rOInclude)rOReplace)rOUnicode)rOClass)rORole)rO DefaultRole)rOTitle)rODate)rO TestDirective) includereplaceunicodeclassrolez default-roletitledatezrestructuredtext-test-directivec Cs|}g}g}|tvrt||fSd}z|j|}Wn-ty6}z|d||fWYd}~nd}~wtyH|d||jfYnw|slztj|}|d|Wntyk|d||}Ynw|r|jj d ||j d}||zt |\} } Wn tyd|fYSwzt d| } Wn'ty} z||jjd | || f|j dd|fWYd} ~ Sd} ~ wwzt| | } | t|<W| |fSty||jjd | | |f|j dd|fYSw) z Locate and return a directive function from its language-dependent name. If not found in the current language, check English. Return None if the named directive cannot be found. Nz?Problem retrieving directive entry from language module %r: %s.z+No directive entry for "%s" in module "%s".z*Using English fallback for directive "%s".z(Trying "%s" as canonical directive name. )linez docutils.parsers.rst.directives.z:Error importing directive module "%s" (directive "%s"): %sz8No directive class "%s" in module "%s" (directive "%s").)lower _directives directivesAttributeErrorappendKeyError__name___fallback_language_modulereporterinfojoin current_line_directive_registryr ImportErrorrgetattr)directive_namelanguage_moduledocumentnormnamemessagesmsg_text canonicalnamermessage modulename classnamemoduledetail directiverJ/usr/lib/python3/dist-packages/docutils/parsers/rst/directives/__init__.pyr~Os              r~cCs |t|<dS)z Register a nonstandard application-defined directive function. Language lookups are not needed for such functions. N)rd)namer~rrrregister_directives rcCs|r |r td|dS)z Check for a valid flag option (no argument) and return ``None``. (Directive option conversion function.) Raise ``ValueError`` if an argument is found. z%no argument is allowed; "%s" suppliedN)strip ValueErrorargumentrrrflags  rcCs|durtd|S)z Return the argument text, unchanged. (Directive option conversion function.) Raise ``ValueError`` if no argument is found. N#argument required but none supplied)rrrrrunchanged_requiredsrcCs|durdS|S)z Return the argument text, unchanged. (Directive option conversion function.) No argument implies empty string (""). Nrrrrr unchangedsrcCs,|durtdddd|D}|S)z Return the path argument unwrapped (with newlines removed). (Directive option conversion function.) Raise ``ValueError`` if no argument is found. NrrcSsg|]}|qSr)r.0srrr zpath..)rrm splitlines)rpathrrrrsrcCs4|durtdtt|}ddd|D}|S)z Return the URI argument with unescaped whitespace removed. (Directive option conversion function.) Raise ``ValueError`` if no argument is found. Nr css"|] }dt|VqdS)rN)rmrsplit)rpartrrr s zuri..)rrrrm)rrAurirrrrs  rcCt|}|dkr td|S)z| Check for a nonnegative integer argument; raise ``ValueError`` if not. (Directive option conversion function.) rz(negative value; must be positive or zerointrrvaluerrrnonnegative_intrcCs.z |d}Wt|StyYt|Sw)zw Check for an integer percentage value with optional percent sign. (Directive option conversion function.) z %)rstriprfrrrrr percentages  r)emexpxincmmmptpcc Csltdd||}z t|dWnttfy+tdddd|Dw|d|dS) a Check for a positive argument of one of the units and return a normalized string of the form "" (without space in between). (Directive option conversion function.) To be called from directive option conversion functions. z^([0-9.]+) *(%s)$|z8not a positive measure of one of the following units: %srcSg|]}d|qSz"%s"r)rirrrrrzget_measure..)rematchrmfloatgrouprfr)runitsrrrr get_measures rcCst|tdgS)Nr)r length_unitsrrrrlength_or_unitlesssrrc Cs`z t|tdgWSty/z t|dg|WYSty.t|tdgYYSww)a Return normalized string of a length or percentage unit. (Directive option conversion function.) 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' %r)rrr)rdefaultrrr length_or_percentage_or_unitlesss  rcCsN|durtd|}g}|D]}t|}|std|||q|S)z Convert the argument into a list of ID-compatible strings and return it. (Directive option conversion function.) Raise ``ValueError`` if no argument is found. Nrz"cannot make "%s" into a class name)rrrmake_idrg)rnames class_namesr class_namerrr class_options   rz2(?:0x|x|\\x|U\+?|\\u)([0-9a-f]+)$|&#x([0-9a-f]+);$c Cstz'|r tt|WSt|}|r%|dp|d}tt|dWS|WSty9}ztd|d}~ww)a 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. rrzcode too large (%s)N)isdigitunichrrunicode_patternrr OverflowErrorr)rrrr}rrr unicode_code*s   rcCs$t|}t|dkrtd||S)z A single character is returned as-is. Unicode characters codes are converted as in `unicode_code`. (Directive option conversion function.) rz8%r invalid; must be a single character or a Unicode code)rlenrrcharrrrsingle_char_or_unicodeBs  rcCs,|dkrd}|S|dkrd}|St|}|S)z As with `single_char_or_unicode`, but "tab" and "space" are also supported. (Directive option conversion function.) tab spacer)rrrrr$single_char_or_whitespace_or_unicodeMsrcCr)z Converts the argument into an integer. Raises ValueError for negative, zero, or non-integer values. (Directive option conversion function.) rz(negative or zero value; must be positiverrrrr positive_intZrrcCs*d|vr |d}n|}dd|DS)z 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. ,cSsg|]}t|qSr)r)rentryrrrrprz%positive_int_list..)r)rentriesrrrpositive_int_listds rcCs,zt|W|Stytd|w)z Verfies the encoding argument by lookup. (Directive option conversion function.) Raises ValueError for unknown encodings. zunknown encoding: "%s")codecslookup LookupErrorrrrrrencodingrs   rcCsPz|}Wntytdt|w||vr|Std|t|f)a 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). z'must supply an argument; choose from %sz"%s" unknown; choose from %s)rcrrfr format_values)rvaluesrrrrchoices  rcCs(dddd|ddD|dfS)Nz %s, or "%s"z, cSrrrrrrrrrz!format_values..)rm)rrrrrsrcsfdd}|S)zp Directive option conversion function. The argument can be any of `values` or `argument_type`. cs|vr|S|S)Nrrotherrrr auto_or_otherszvalue_or..auto_or_otherr)rrrrrrvalue_orsrcCs0|sdSzt|WStytd|w)z Return a docutils parser whose name matches the argument. (Directive option conversion function.) Return `None`, if the argument evaluates to `False`. NzUnknown parser name "%s".)rget_parser_classrprrrrr parser_names   r)r)1__doc__ __docformat__rrsys importlibrdocutilsrrdocutils.utilsrrrdocutils.parsers.rst.languagesr rj version_infochrrrordr~rrrrrrrrrrrrrcompile IGNORECASErrrrrrrrrrrrrrrs         #$&'0: