o °-$`3ã@sldZdZddlZddlZddlZddlZddlmZmZddlm Z m Z ddl m Z m Z Gdd„de ƒZdS) z( Docutils component-related transforms. ÚreStructuredTextéN)ÚnodesÚutils)ÚApplicationErrorÚ DataError)Ú TransformÚTransformErrorc@seZdZdZdZdd„ZdS)ÚFilterab Include or exclude elements which depend on a specific Docutils component. For use with `nodes.pending` elements. A "pending" element's dictionary attribute ``details`` must contain the keys "component" and "format". The value of ``details['component']`` must match the type name of the component the elements depend on (e.g. "writer"). The value of ``details['format']`` is the name of a specific format or context of that component (e.g. "html"). If the matching Docutils component supports that format or context, the "pending" element is replaced by the contents of ``details['nodes']`` (a list of nodes); otherwise, the "pending" element is removed. For example, the reStructuredText "meta" directive creates a "pending" element containing a "meta" element (in ``pending.details['nodes']``). Only writers (``pending.details['component'] == 'writer'``) supporting the "html", latex, or "odf" formats (``pending.details['format'] == 'html,latex,odf'``) will include the "meta" element; it will be deleted from the output of all other writers. i cCsh|j}|jd}|jd d¡}|jjj|}|D]}| |¡r+| |jd¡dSq|j  |¡dS)NÚ componentÚformatú,r) Ú startnodeÚdetailsÚsplitÚdocumentÚ transformerÚ componentsÚsupportsÚ replace_selfÚparentÚremove)ÚselfÚpendingÚcomponent_typeÚformatsr r ©rú@/usr/lib/python3/dist-packages/docutils/transforms/components.pyÚapply-s  þz Filter.applyN)Ú__name__Ú __module__Ú __qualname__Ú__doc__Údefault_priorityrrrrrr s r )r!Ú __docformat__ÚsysÚosÚreÚtimeÚdocutilsrrrrÚdocutils.transformsrrr rrrrÚs