jftdZdZddlmZmZmZGddeZGddZGdd eZd S) a This package contains modules for standard tree transforms available to Docutils components. Tree transforms serve a variety of purposes: - To tie up certain syntax-specific "loose ends" that remain after the initial parsing of the input plaintext. These transforms are used to supplement a limited syntax. - To automate the internal linking of the document tree (hyperlink references, footnote references, etc.). - To extract useful information from the document tree. These transforms may be used to construct (for example) indexes and tables of contents. Each transform is an optional step that a Docutils component may choose to perform on the parsed document. reStructuredText) languagesApplicationError TransformSpecceZdZdS)TransformErrorN)__name__ __module__ __qualname__|/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib/python3.11/site-packages/docutils/transforms/__init__.pyrrsDr rc&eZdZdZdZ ddZdZdS) Transformz1Docutils transform component abstract base class.Ncx||_ ||_ tj|jj|j|_dS)zA Initial setup for in-place document transforms. N)document startnoder get_languagesettings language_codereporterlanguage)selfrrs r__init__zTransform.__init__(sF ! -" ".   +X->@@ 55r c td)z5Override to apply the transform to the document tree.z"subclass must override this method)NotImplementedError)rkwargss rapplyzTransform.apply9s!"FGGGr N)r r r __doc__default_priorityrrr r rrr"sK;;I6666"HHHHHr rc@eZdZdZdZd dZdZd dZdZdZ d Z dS) Transformera Store "transforms" and apply them to the document tree. Collect lists of `Transform` instances and "unknown_reference_resolvers" from Docutils components (`TransformSpec` instances). Apply collected "transforms" to the document tree. Also keeps track of components by component type name. https://docutils.sourceforge.io/docs/peps/pep-0258.html#transformer ctg|_ g|_ ||_ g|_ d|_ i|_ d|_dS)NFr) transformsunknown_reference_resolversrappliedsorted componentsserialno)rrs rrzTransformer.__init__KsX ,.(J  J 3 2    r Nc ||j}||}|j||d|fd|_dS)a+ Store a single transform. Use `priority` to override the default. `kwargs` is a dictionary whose contents are passed as keyword arguments to the `apply` method of the transform. This can be used to pass application-specific data to the transform instance. NF)r!get_priority_stringr%appendr()rtransform_classpriorityrpriority_strings r add_transformzTransformer.add_transformgsV  &7H228<<  otV < > > > r c|D]:}||j}|j||dif;d|_dS)z3Store multiple transforms, with default priorities.NF)r,r!r%r-r()rtransform_listr.r0s radd_transformszTransformer.add_transformsusb- > >O"66022O O " " /4< > > > > r c|j}||j}||}|j|||ifd|_dS)z4Store a transform with an associated `pending` node.NF) transformr!r,r%r-r()rpendingr/r.r0s r add_pendingzTransformer.add_pending~s\!+  &7H228<<  ow ; = = = r c:|xjdz c_d||jfzS)z Return a string, `priority` combined with `self.serialno`. This ensures FIFO order on transforms with identical priority. z %03d-%03d)r*)rr/s rr,zTransformer.get_priority_strings&  h 666r c@g}|D]h}t|ts||||j|j<||jid|_d}| ||xj|z c_dS)an Store each component's default transforms and reference resolvers Transforms are stored with default priorities for later sorting. "Unknown reference resolvers" are sorted and stored. Components that don't inherit from `TransformSpec` are ignored. Also, store components by type name in a mapping for later lookup. Fc|jSr)r/)fs rkeyfunz4Transformer.populate_from_components..keyfuns : r )keyN) isinstancerr4get_transformsr)component_typeextendr&r(sort)rr) resolvers componentr>s rpopulate_from_componentsz$Transformer.populate_from_componentss # D DIi77     8 8 : : ; ; ;8ADOI4 5   YB C C C C    6""" ((I5((((r c|jj|jj|jr|js"|jdd|_|j\}}}}||j|}|jdi||j ||||f|jdSdS)z6Apply all of the stored transforms, in priority order.T)reverse)rNr ) rrattach_observernote_transform_messager%r(rDpoprr'r-)rr/r.r7rr6s rapply_transformszTransformer.apply_transformss .. M 0 2 2 2o N; #$$T$222" 9=9L9L9N9N 6How' IIII IO % %f % % % L  ?GV L M M Mo N N N N Nr r) r r r r rr1r4r8r,rGrMr r rr#r#>s  8    7776662 N N N N Nr r#N) r __docformat__docutilsrrrrrr#r r rrPs &# @?????????     %   HHHHHHHH8yNyNyNyNyN-yNyNyNyNyNr