ifdZdZddlZddlZddlZddlZddlZddlmZm Z m Z m Z m Z m Z mZddlmZddlmZGddZd Zd Zdd dd dd ddddddeefdZ d$dZ d%dZde jddd dd dd dddddfdZde jdd dd dddddf dZ d&dZdd dd dd ddddddeede jfdZdZd'dZ dZ!dZ"dZ#dZ$dZ%dZ&d Z'd!Z(d"Z)d#Z*dS)(a Calling the ``publish_*`` convenience functions (or instantiating a `Publisher` object) with component names will result in default behavior. For custom behavior (setting component options), create custom component objects first, and pass *them* to ``publish_*``/`Publisher`. See `The Docutils Publisher`_. .. _The Docutils Publisher: https://docutils.sourceforge.io/docs/api/publisher.html reStructuredTextN) __version____version_details__ SettingsSpecioutilsreaderswriters) OptionParser)doctreeceZdZdZddddejdejdfdZdZdZ dZ ddZ dZ dd Z d Z dd Zdd Zdd ZddZdZ ddZdZdZdZdZdZdS) PublisherzK A facade encapsulating the high-level logic of a Docutils system. Nc Zd|_ ||_ ||_ ||_ dD]G} t t || t r"Jdt || d| d| dH||_ ||_ ||_ ||_ ||_ tj |_dS)a Initial setup. If any of `reader`, `parser`, or `writer` are not specified, ``set_components()`` or the corresponding ``set_...()`` method should be called with component names (`set_reader` sets the parser as well). N)readerparserwriterzpassed string "z" as "z+" parameter; pass an instance, or use the "zL_name" parameter instead (in docutils.core.publish_* convenience functions).)documentrrr isinstancegetattrstrsource source_class destinationdestination_classsettingsr ErrorOutput_stderr) selfrrrrrrrr components m/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib/python3.11/site-packages/docutils/core.py__init__zPublisher.__init__$s ; 3 3 35 D DI!'$ ":":C@@ D D D4++++YYY C D D@ D  G(?& "3D   J~'' crtj|}||||_|jj|_dS)zSet `self.reader` by name.N)r get_reader_classrr)r reader_namer parser_name reader_classs r set_readerzPublisher.set_readerUs5/ << "l6;77 k( r"cLtj|}||_dS)zSet `self.writer` by name.N)r get_writer_classr)r writer_name writer_classs r set_writerzPublisher.set_writer[s#/ << "lnn r"c|j|||j||j7|jj|j||jj|_|j||dSdSN)rr(r set_parserrr-)rr%r&r+s r set_componentszPublisher.set_components`s ;  OOKk B B B ; {!) &&{333+,DK ;  OOK ( ( ( ( (  r"c 0tjdtd|rR|st}||_|}t |dkr|ddkrdg|_t|j |j |j |f|d|| S) NzRPublisher.setup_option_parser is deprecated, and will be removed in Docutils 0.21.) stacklevel application applicationsT) componentsdefaultsread_config_filesusage description) warningswarnDeprecationWarningrconfig_sectionsplitlenconfig_section_dependenciesr rrr)rr<r= settings_specrAr:partss r setup_option_parserzPublisher.setup_option_parserjs  >(Q 8 8 8 8  M  / , +9M ("((**E5zzA~~%)}"<"<=Kcatch_warningsfilterwarningsr@rG)rargskwargss r _setup_settings_parserz Publisher._setup_settings_parser}s $ & & = =  #H7I J J J J+4+T is obsoleted by the --output option. You cannot use them together.-)rrbrgrh)routput _destination SystemExitroutput_encodingoutput_encoding_error_handlerr)rrrbs r rdzPublisher.set_destinations  # $ B)C BM(DM,FFF "ABBB}#s**'+ $ $ 4!>#'=#= %5 "11#-]2-E 2GGr"c|jj|j|j|jj|j|jf|jjdSr/) r transformerpopulate_from_componentsrrrrrapply_transformsrs r rvzPublisher.apply_transformss] !:: [$+t{'94;       !2244444r"Fcrd} |j|j|||||fi|pi|||j|j|j|j|_| |j |j|j } |j nt#t$r} d}| j} Yd} ~ n\d} ~ wt $rL} |js|jjr||| d}d} Yd} ~ nd} ~ wwxYw||rM|jrF|jjj|jjkr't/j|jjjdzn|rt/j| | S)z Process command line options and arguments (if `self.settings` not already set), run `self.reader` and then `self.writer`. Return `self.writer`'s output. NTr5 )rr_repromptrreadrrrrvrwriterassemble_partsrpcode ExceptionrUdebugging_dumpsreport_Exceptionreporter max_levelexit_status_levelr\exit) rr]r<r=rErYrAenable_exit_statusrrnerror exit_statuss r publishzPublisher.publishs }$))%m^22)/R222 KKMMM KKMMM K,,T[$+-1]<z-Publisher.debugging_dumps..sU7776Xvwv'8'8'8&//J-gov7777r"z ::: Pseudo-XML:raw_unicode_escape)rr dump_settingsprintrpprintpformat__dict__dump_internalsdump_transformsrtapplieddump_pseudo_xmlencoderws r rzPublisher.debugging_dumpss}  F = & M +$, ? ? ? ? &.!788t| L L L L = ' M -DL A A A A &.!788t| L L L L = ( L -DL A A A A "(,  6 6 6 6 &.77M-577788?Cl  L L L L = ( : %DL 9 9 9 9 $-''))00$&&,0L : : : : : : : :r"c  |jr|jsdSn#t$rYdSwxYwtjdkrdnd}d}d} |jjd}|jjd}n#ttf$rYnwxYwtdtd |d |d |d |j dS)z=Print info and prompt when waiting for input from a terminal.NntzCtrl+ZzCtrl+Dzuseful formatsrz Docutils z/ converting "z" into "zT". Call with option "--help" for more info. .. Waiting for source text (finish with z on an empty line):r) risattyrAttributeErrorosnamer supportedr IndexErrorrr)reot_key in_format out_formats r rzzPublisher.prompts- K&&(( T\-@-@-B-B      FF  goo((8 %   -a0I.q1JJ +    D  #+##&##0:##:A### <  ! ! ! ! ! !s!27 AA!$BBBct|tjr||dSt|tr||dSt|t jr1|j dt j |zdSt|t j r1|j dt j |zdStdt j |z|jtdttr dtdndd tjd d |jdS) Nz-Unable to open source file for reading: %s z2Unable to open destination file for writing: %s z%srzExiting due to error. Use "--traceback" to diagnose. Please report errors to . Include "--traceback" output, Docutils version (z []r), Python version (rz5), your OS type & version, and the command line used.)rr SystemMessagereport_SystemMessageUnicodeEncodeErrorreport_UnicodeErrorr InputErrorrr| error_string OutputErrorrrrr\versionrBrrs r rzPublisher.report_Exception1s eU0 1 1 2  % %e , , , , , 1 2 2 2  $ $U + + + + + r} - - 2 L   (*,/%*@*@ A B B B B B r~ . . 2 L  ?5112 3 3 3 3 3 $///dl C C C C 2=!4;  ""$$Q'  %)L  2 2 2 2 2 2r"c~td|jdtjj|jd|jdS)NzExiting due to level-z (z) system message.r)rlevelrReporterlevelsrrs r rzPublisher.report_SystemMessageGsM +++u~4U[AAAC< ! ! ! ! ! !r"c|j|j|j}|jt j|d|jjd| ddd| ddd|jj dtd tj d d dS) Nz! The specified output encoding (z) cannot handle all of the output. Try setting "--output-encoding-error-handler" to * "xmlcharrefreplace" (for HTML & XML output); the output will contain "asciixmlcharrefreplacezU" and should be usable. * "backslashreplace" (for other output formats); look for "backslashreplacezr" in the output. * "replace"; look for "?" in the output. "--output-encoding-error-handler" is currently set to "z". Exiting due to error. Use "--traceback" to diagnose. If the advice above doesn't eliminate the error, please report it to . Include "--traceback" output, Docutils version (rrz6), your OS type & version, and the command line used. )objectstartendrr|rrrrqrrrrr\rrB)rrdatas r rzPublisher.report_UnicodeErrorLs|EK 12 *u%%%%},,,{{7$78888{{7$67777}:::{{CK--//2223 4 5 5 5 5 5r")NNNN)NNNNN)NN)NNNNNNF)rr __qualname____doc__r FileInput FileOutputr!r(r-r1rGrOrSrZr_rercrdrvrrrzrrrrVr"r rrs#42<!R]/(/(/(/(b))) %%% )));??C2222&===488<" * * *GK@D7777"DDDD FFFFGGGG$555 :>7;8=((((T:::.!!!,222,!!! 55555r"rz*%prog [options] [ []]zReads from (default is stdin) and writes to (default is stdout). See https://docutils.sourceforge.io/docs/user/config.html for a detailed settings reference. standalonerestructuredtext pseudoxmlTc t||||}|||||| | | ||| | }|S)aT Set up & run a `Publisher` for command-line-based file I/O (input and output file paths taken automatically from the command line). Also return the output as `str` or `bytes` (for binary output document formats). Parameters: see `publish_programmatically()` for the remainder. - `argv`: Command-line argument list to use instead of ``sys.argv[1:]``. - `usage`: Usage string, output if there's a problem parsing the command line. - `description`: Program description, output for the "--help" option (along with command-line option descriptions). )rrArrr1r)rr%rr&rr+rrErYrArr]r<r= publisherrns r publish_cmdliner{sg*&&&8DDDI [+{CCC    e[-1C%:LNNF Mr"Fctdidtjd|d|dtjd|d|d|d|d |d |d |d | d | d| d| d| d|\}}|S)z Set up & run a `Publisher` for programmatic use with file-like I/O. Also return the output as `str` or `bytes` (for binary output document formats). Parameters: see `publish_programmatically()`. rrrarrrbrr%rr&rr+rrErYrArrV)publish_programmaticallyrrr)rrarrbrr%rr&rr+rrErYrArrnrs r publish_filers1 / / /\\ /*0& />Ik /-- / K /3C2B /v /$/; / v / $/; / v / $/; / /*7 /.- /&~ /.- /FI Mr"ctdidtjd|d|dtjddd|d|d |d |d |d |d |d| d| d| d| d| \}}|S)uC Set up & run a `Publisher` for programmatic use with string I/O. Accepts a `bytes` or `str` instance as `source`. The output is encoded according to the `output_encoding`_ setting; the return value is a `bytes` instance (unless `output_encoding`_ is "unicode", cf. `docutils.io.StringOutput.write()`). Parameters: see `publish_programmatically()`. This function is provisional because in Python 3 name and behaviour no longer match. .. _output_encoding: https://docutils.sourceforge.io/docs/user/config.html#output-encoding rrrarrNrbrr%rr&rr+rrErYrArrV)rr StringInput StringOutput)rrarbrr%rr&rr+rrErYrArrnrs r publish_stringrs01 / / /^^ /,2F /@K  /// /D /,<+; /v /$/; / v / $/; / v / $/; / /*7 /.- /&~ /.- /FI Mr"ctdid|d|d|dtjddd|d|d |d |d |d |d | d| d| d| d| d|\}}|jjS)a Set up & run a `Publisher`, and return a dictionary of document parts. Dictionary keys are the names of parts. Dictionary values are `str` instances; encoding is up to the client, e.g.:: parts = publish_parts(...) body = parts['body'].encode(parts['encoding'], parts['errors']) See the `API documentation`__ for details on the provided parts. Parameters: see `publish_programmatically()`. __ https://docutils.sourceforge.io/docs/api/publisher.html#publish-parts rrarrrNrbrr%rr&rr+rrErYrArrV)rrrrrF)rrarrbrr%rr&rr+rrErYrArrnrs r publish_partsrs01 / / /v /#.; /=I\ /// /D /,<+; /v /$/; / v / $/; / v / $/; / /*7 /.- /&~ /.- /FI   !!r"c tdid|d|d|dddddtjd|d |d |d |d dd dd|d|d| d| d| \} } | jS)z Set up & run a `Publisher` for programmatic use. Return a document tree. Parameters: see `publish_programmatically()`. rrarrNrbrrr%rr&rr+nullrrErYrArrV)rr NullOutputr)rrarrr%rr&rrErYrAr_outputrs r publish_doctreers2 / / /v /#.; /!\ /D /,04 /-- / v / $/; / v / $/; /t /"( / /*7 /.- /?Mn /.- /GY  r"c Ftjd} t| d|tj|tj|} |s|r| || |||| d|| |S)u Set up & run a `Publisher` to render from an existing document tree data structure. For programmatic use with string output (`bytes` or `str`, cf. `publish_string()`). Note that ``document.settings`` is overridden; if you want to use the settings of the original `document`, pass ``settings=document.settings``. Also, new `document.transformer` and `document.reporter` objects are generated. Parameters: `document` is a `docutils.nodes.document` object, an existing document tree. Other parameters: see `publish_programmatically()`. This function is provisional because in Python 3 name and behaviour of the `io.StringOutput` class no longer match. r)r&N)rrrr) r Readerrr DocTreeInputrr-rZrdr) rrbrr+rrErYrArrrs r publish_from_doctreers0^ / / /F&$!#!:!:,.O#+---I *k*[))) ++)>;;; d$4555   0B  C CCr"c t|||||}|||||| | | ||| | }|S)a Set up & run a `Publisher` for command-line-based file I/O (input and output file paths taken automatically from the command line). Also return the output as `bytes`. This is just like publish_cmdline, except that it uses io.BinaryFileOutput instead of io.FileOutput. Parameters: see `publish_programmatically()` for the remainder. - `argv`: Command-line argument list to use instead of ``sys.argv[1:]``. - `usage`: Usage string, output if there's a problem parsing the command line. - `description`: Program description, output for the "--help" option (along with command-line option descriptions). )rrrr)rr%rr&rr+rrErYrArr]r<r=rrrrns r publish_cmdline_to_binaryr?sp:&&&8,=???I [+{CCC    e[-1C%:LNNF Mr"ct||| | ||}||| | || ||||||||||}||fS)a^ Set up & run a `Publisher` for custom programmatic use. Return the output (as `str` or `bytes`, depending on `destination_class`, writer, and the "output_encoding" setting) and the Publisher object. Applications should not need to call this function directly. If it does seem to be necessary to call this function directly, please write to the Docutils-develop mailing list . Parameters: * `source_class` **required**: The class for dynamically created source objects. Typically `io.FileInput` or `io.StringInput`. * `source`: Type depends on `source_class`: - If `source_class` is `io.FileInput`: Either a file-like object (must have 'read' and 'close' methods), or ``None`` (`source_path` is opened). If neither `source` nor `source_path` are supplied, `sys.stdin` is used. - If `source_class` is `io.StringInput` **required**: The input as either a `bytes` object (ensure the 'input_encoding' setting matches its encoding) or a `str` object. * `source_path`: Type depends on `source_class`: - `io.FileInput`: Path to the input file, opened if no `source` supplied. - `io.StringInput`: Optional. Path to the file or name of the object that produced `source`. Only used for diagnostic output. * `destination_class` **required**: The class for dynamically created destination objects. Typically `io.FileOutput` or `io.StringOutput`. * `destination`: Type depends on `destination_class`: - `io.FileOutput`: Either a file-like object (must have 'write' and 'close' methods), or ``None`` (`destination_path` is opened). If neither `destination` nor `destination_path` are supplied, `sys.stdout` is used. - `io.StringOutput`: Not used; pass ``None``. * `destination_path`: Type depends on `destination_class`: - `io.FileOutput`: Path to the output file. Opened if no `destination` supplied. - `io.StringOutput`: Path to the file or object which will receive the output; optional. Used for determining relative paths (stylesheets, source links, etc.). * `reader`: A `docutils.readers.Reader` object. * `reader_name`: Name or alias of the Reader class to be instantiated if no `reader` supplied. * `parser`: A `docutils.parsers.Parser` object. * `parser_name`: Name or alias of the Parser class to be instantiated if no `parser` supplied. * `writer`: A `docutils.writers.Writer` object. * `writer_name`: Name or alias of the Writer class to be instantiated if no `writer` supplied. * `settings`: A runtime settings (`docutils.frontend.Values`) object, for dotted-attribute access to runtime settings. It's the end result of the `SettingsSpec`, config file, and option processing. If `settings` is passed, it's assumed to be complete and no further setting/config/option processing is done. * `settings_spec`: A `docutils.SettingsSpec` subclass or object. Provides extra application-specific settings definitions independently of components. In other words, the application becomes a component, and its settings data is processed along with that of the other components. Used only if no `settings` specified. * `settings_overrides`: A dictionary containing application-specific settings defaults that override the defaults of other components. Used only if no `settings` specified. * `config_section`: A string, the name of the configuration file section for this application. Overrides the ``config_section`` attribute defined by `settings_spec`. Used only if no `settings` specified. * `enable_exit_status`: Boolean; enable exit status at end of processing? )rrrr)rr1rZrcrdr)rrrarrrbrr%rr&rr+rrErYrArrrns r rresJ&&&8'3,=???I[+{CCC ++)>;;; --- k+;<<<   2D  E EF 9 r"rcd|d|dtz}tjtjdt ||dS)Nz Generate zZ documents from standalone reStructuredText sources . r)r+r=)default_descriptionlocale setlocaleLC_ALLr)r documenttypedoc_pathr=s r rst2somethingrsj  @L @ @19 @ @ @    V]B'''K@@@@@@r"c(tddddS)NhtmlHTMLzuser/html.html#htmlrrVr"r rst2htmlrs&&"788888r"c(tddddS)Nhtml4z XHTML 1.1zuser/html.html#html4css1rrVr"r rst2html4rs';(BCCCCCr"c(tddddS)Nhtml5HTML5zuser/html.html#html5-polyglotrrVr"r rst2html5rs'7$CDDDDDr"c(tddddS)NlatexLaTeXuser/latex.htmlrrVr"r rst2latexrs'7$566666r"c(tddddS)NmanpagezUnix manual (troff)zuser/manpage.htmlrrVr"r rst2manrs)24GHHHHHr"c(tddddS)NodtzOpenDocument text (ODT)z user/odt.htmlrrVr"r rst2odtrs%2ODDDDDr"c(tddddS)Nrzpseudo-XML (test)ref/doctree.htmlrrVr"r rst2pseudoxmlr s+24FGGGGGr"c(tddddS)Ns5zS5 HTML slideshowzuser/slide-shows.htmlrrVr"r rst2s5r s$+-DEEEEEr"c(tddddS)NxetexzLaTeX (XeLaTeX/LuaLaTeX)rrrVr"r rst2xetexrs'57HIIIIIr"c(tddddS)NxmlzDocutils-native XMLrrrVr"r rst2xmlr s%.0BCCCCCr")NNNNNrNrNrNNNNF) NNNrNrNrNNNNF)NNrNNNNF)r)+r __docformat__rrrr\r>docutilsrrrrrr r docutils.frontendr docutils.readersr r default_usagerrrrrrrrBinaryFileOutputrrrrrrrrrr r rrrVr"r rsa  # 333333333333333333******$$$$$$J5J5J5J5J5J5J5J5Z = ) \-?[!'+D'+$'5H :+/48*6*<*5GK9> 8?C,8,>,704;?&+ ####L'+#'<+=;t%)$%*#"#"#"#"L)-!#\-?!'+D', 4592=6:AE,1 "D"D"D"DJ&*|%)7I%){'+,015-115#'$1*=*.020C####Lnnnh A A A A999DDDEEE777IIIEEEHHHFFFJJJDDDDDr"