o $a @sNdZddlZddlZddlZddlZddlmZmZddlm Z m Z m Z m Z m Z mZmZmZmZmZmZddlmZmZddlmZmZmZddlmZddlmZdd lm Z m!Z!dd l"m#Z#e rhdd l$m%Z%Gd d d Z&GdddZ'Gdddej(Z(dZ)dZ*e)fde+de,de dee+fddZ-Gdddej.Z/Gddde#Z0dS)z sphinx.writers.text ~~~~~~~~~~~~~~~~~~~ Custom docutils writer for plain text. :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. N)chaingroupby) TYPE_CHECKINGAnyDict GeneratorIterableListOptionalSetTupleUnioncast)nodeswriters)ElementNodeText column_width)addnodes)_admonitionlabels)SphinxTranslator) TextBuilderc @sZeZdZdZddedededdfd d Zdefd d Zdefd dZdeddfddZ dS)CellzVRepresents a cell in a table. It can span multiple columns or multiple lines. textrowspancolspanreturnNcCs(||_g|_||_||_d|_d|_dSN)rwrappedrr colrow)selfrrr r'5/usr/lib/python3/dist-packages/sphinx/writers/text.py__init__"s  z Cell.__init__cCsd|j|j|j|j|jS)Nz{}>)formatrr%rr$r r&r'r'r(__repr__*sz Cell.__repr__cCst|j|jfSr")hashr$r%r+r'r'r(__hash__/z Cell.__hash__widthcCst|j||_dSr")my_wraprr#)r&r0r'r'r(wrap2z Cell.wrap)rrr) __name__ __module__ __qualname____doc__strintr)r,r.r2r'r'r'r(rs rc@seZdZdZd&deeddfddZd'ddZd'd d Zd e ddfd d Z de eefde fddZ de eefd e ddfddZ deddfddZdeddfddZdefddZd e deedefddZedee ddffddZd'd d!Zdee defd"d#Zdefd$d%ZdS)(TableajRepresents a table, handling cells that can span multiple lines or rows, like:: +-----------+-----+ | AAA | BBB | +-----+-----+ | | | XXX | | | +-----+-----+ | DDD | CCC | +-----+-----------+ This class can be used in two ways, either: - With absolute positions: call ``table[line, col] = Cell(...)``, this overwrites any existing cell(s) at these positions. - With relative positions: call the ``add_row()`` and ``add_cell(Cell(...))`` as needed. Cells spanning multiple rows or multiple columns (having a colspan or rowspan greater than one) are automatically referenced by all the table cells they cover. This is a useful representation as we can simply check ``if self[x, y] is self[x, y+1]`` to recognize a rowspan. Colwidth is not automatically computed, it has to be given, either at construction time, or during the table construction. Example usage:: table = Table([6, 6]) table.add_cell(Cell("foo")) table.add_cell(Cell("bar")) table.set_separator() table.add_row() table.add_cell(Cell("FOO")) table.add_cell(Cell("BAR")) print(table) +--------+--------+ | foo | bar | |========|========| | FOO | BAR | +--------+--------+ Ncolwidthr!cCs.g|_d|_|dur |ng|_d|_d|_dSNr)lines separatorr; current_line current_col)r&r;r'r'r(r)ds  zTable.__init__cCs|jd7_d|_dS)zAdd a row to the table, to use with ``add_cell()``. It is not needed to call ``add_row()`` before the first ``add_cell()``. rrN)r?r@r+r'r'r(add_rowks z Table.add_rowcCst|j|_dS)z*Sets the separator below the current line.N)lenr=r>r+r'r'r( set_separatorrszTable.set_separatorcellcCsR||j|jfr|jd7_||j|jfs|||j|jf<|j|j7_dS)zAdd a cell to the current line, to use with ``add_row()``. To add a cell spanning multiple lines or rows, simply set the ``cell.colspan`` or ``cell.rowspan`` BEFORE inserting it into the table. rN)r?r@r )r&rDr'r'r(add_cellvs zTable.add_cellposcCs2|\}}||d||d|j||SNr)_ensure_has_line_ensure_has_columnr=)r&rFliner$r'r'r( __getitem__szTable.__getitem__cCsn|\}}|||j|||jt|jD]}t|jD]}||j||||<||_||_q qdSr")rHrrIr ranger=r%r$)r&rFrDrJr$dlinedcolr'r'r( __setitem__szTable.__setitem__rJcCs0t|j|kr|jgt|j|ksdSdSr")rBr=append)r&rJr'r'r(rHs zTable._ensure_has_liner$cCs2|jD]}t||kr|dt||ks qdSr")r=rBrP)r&r$rJr'r'r(rIs    zTable._ensure_has_columncCsddd|jDS)N cs|]}t|VqdSr")repr).0rJr'r'r( z!Table.__repr__..)joinr=r+r'r'r(r,zTable.__repr__sourcecCsDd}t||j|jfjD] }|||j|7}q ||jddS)zGive the cell width, according to the given source (either ``self.colwidth`` or ``self.measured_widths``). This takes into account cells spanning multiple columns. rr)rLr%r$r )r&rDrYr0ir'r'r( cell_widthszTable.cell_widthccsNt}t|jD]\}}t|D]\}}|r#||vr#|V||qq dSr")set enumerater=add)r&seenlinenorJcolnorDr'r'r(cellss  z Table.cellscCs|jdd|_|jD]9}|j|||jd|jsq ttdd|jD|j }t |j |j |j D] }t|j|||j|<q6q dS)zCall ``cell.wrap()`` on all cells, and measure each column width after wrapping (result written in ``self.measured_widths``). Nr0csrRr"rrTxr'r'r(rUrVzTable.rewrap..) r;measured_widthsrcr2r\r#mathceilmaxr rLr$)r&rDr0r$r'r'r(rewraps  z Table.rewrapcCs"d}|D] }t|t|j}q|S)zfFor a given line, compute the number of physical lines it spans due to text wrapping. r)rjrBr#)r&rJphysical_linesrDr'r'r(physical_lines_for_lineszTable.physical_lines_for_linec s:g}d dtdttdtffdd }tjD]u\}}jr0|jkr0||d|n||d|t |D]P}dg}t|D]>\}}|j |krRqH||j krZd } n|t |j krdd } n|j |} t | t| } |d | |jd | dqH|d |q?q||dd |S)N-charrar!csg}tjD]-\}}|dur+|dkr+||f|d|fur+|d|dq|||dq|dddkr?dnd}|d ddkrKdnd}d d t||ddD}|||d tt||S) zfCalled on the line *before* lineno. Called with no *lineno* for the last sep. Nrr rn+|cSs0g|]\}}|ddks|ddkrdndqS)rrnrrrsr')rTleftrightr'r'r( sz3Table.__str__..writesep..r)r^rgrPziprWr from_iterable)roraoutrbr0headtailgluer+r'r(writeseps zTable.__str__..writesep=rsrrprrQ)rnN)rkr8r r9r^r=r>rPrLrmr$r%rBr#rljustr\rgrW) r&rzr~rarJ physical_linelinestrrbrD physical_text adjust_lenr'r+r(__str__s>     z Table.__str__r"r!N)r4r5r6r7r r9r)rArCrrEr rKrOrHrIr8r,r\propertyrrcrkrmrr'r'r'r(r:6s"-        r:c seZdZdZedZdeedeefddZ dede de eeffd d Z d edeeffd d Z deedeede de ddf ddZZS) TextWrapperz;Custom subclass that uses a different word separator regex.zf(\s+|(?<=\s)(?::[a-z-]+:)?`\S+|[^\s\w]*\w+[a-zA-Z]-(?=\w+[a-zA-Z])|(?<=[\w\!\"\'\&\.\,\?])-{2,}(?=\w))chunksr!cCsg}|jdkrtd|j||rg}d}|r|j}n|j}|jt|}|jr8|ddkr8|r8|d=|rUt|d}|||krR|| ||7}nn|s:|rgt|d|krg| |||||jrw|rw|ddkrw|d=|r||d ||s|S)z_wrap_chunks(chunks : [string]) -> [string] The original _wrap_chunks uses len() to calculate width. This method respects wide/fullwidth characters for width adjustment. rzinvalid width %r (must be > 0)rtr) r0 ValueErrorreversesubsequent_indentinitial_indentrdrop_whitespacestriprPpop_handle_long_wordrW)r&rr=cur_linecur_lenindentr0lr'r'r( _wrap_chunkss8     !zTextWrapper._wrap_chunksword space_leftcCsVd}t|D] \}}|t|7}||kr&|d|d||ddfSq|dfS)z_break_word(word : string, space_left : int) -> (string, string) Break line by unicode width instead of len(word). rNrr)r^r)r&rrtotalr[cr'r'r( _break_word5s $zTextWrapper._break_wordrcsrdtdttffdd }g}||D]"}t|tD]\}}|dkr.||d|q|t|qq|S)z_split(text : string) -> [string] Override original method that only split by 'wordsep_re'. This '_split' splits wide-characters into chunks by one character. tr!cstt|Sr")superr_split)r) __class__r&r'r(splitGr/z!TextWrapper._split..splitrr)r8r rrextendrWlist)r&rrrchunkwgrr+r(rAs zTextWrapper._splitreversed_chunksrrr0NcCsXt||d}|jr||d|\}}||||d<dS|s*||dSdS)z_handle_long_word(chunks : [string], cur_line : [string], cur_len : int, width : int) Override original method for using self._break_word() instead of slice. rrtN)rjbreak_long_wordsrrPr)r&rrrr0rrrr'r'r(rRs  zTextWrapper._handle_long_word)r4r5r6r7recompile wordsep_rer r8rr9r rrr __classcell__r'r'rr(rs/ rFrZrr0kwargsr!cKstdd|i|}||S)Nr0r')rr2)rr0rrr'r'r(r1hs r1csJeZdZUdZdZiZeed<dZe ed<d fd d Z dd d Z Z S) TextWriter)r)zNo options here.rr'settings_defaultsNoutputbuilderrr!cst||_dSr")rr)r)r&rrr'r(r)t  zTextWriter.__init__cCs0|j|j|j}|j|tt|j|_dSr")rcreate_translatordocument walkaboutrTextTranslatorbodyr)r&visitorr'r'r( translatexs zTextWriter.translate)rrr!Nr) r4r5r6 supported settings_specrr__annotations__rr8r)rrr'r'rr(rms   rc sLeZdZUdZded<dejddddffdd Zdeddfd d Z e fd e ddfd d Z ddgdfde deededdfddZdeddfddZdeddfddZdeddfddZdeddfddZdeddfddZdeddfd d!ZeZeZdeddfd"d#Zdeddfd$d%Zdeddfd&d'Zdeddfd(d)Zdeddfd*d+Zdeddfd,d-Zdeddfd.d/Zdedefd0d1Z deddfd2d3Z!deddfd4d5Z"deddfd6d7Z#deddfd8d9Z$deddfd:d;Z%deddfdd?Z'deddfd@dAZ(deddfdBdCZ)deddfdDdEZ*deddfdFdGZ+deddfdHdIZ,deddfdJdKZ-deddfdLdMZ.deddfdNdOZ/deddfdPdQZ0deddfdRdSZ1deddfdTdUZ2deddfdVdWZ3deddfdXdYZ4deddfdZd[Z5deddfd\d]Z6deddfd^d_Z7deddfd`daZ8deddfdbdcZ9deddfdddeZ:deddfdfdgZ;deddfdhdiZdeddfdndoZ?deddfdpdqZ@deddfdrdsZAdeddfdtduZBdeddfdvdwZCdeddfdxdyZDdeddfdzd{ZEdeddfd|d}ZFdeddfd~dZGdeddfddZHdeddfddZIdeddfddZJdeddfddZKdeddfddZLdeddfddZMdeddfddZNdeddfddZOdeddfddZPdeddfddZQdeddfddZRdeddfddZSdeddfddZTdeddfddZUdeddfddZVdeddfddZWdeddfddZXdeddfddZYdeddfddZZdeddfddZ[deddfddZ\deddfddZ]deddfddZ^deddfddZ_deddfddZ`deddfddZadeddfddZbdeddfddZcdeddfddZddeddfddZededdfddZfdeddfddZgdeddfddZhdeddfddÄZideddfddńZjdeddfddDŽZkdeddfddɄZldeddfdd˄Zmdeddfdd̈́ZndeddfddτZodeddfddфZpdeddfddӄZqdeddfddՄZrdeddfddׄZsdeddfddلZtdeddfddۄZudeddfdd݄Zvdeddfdd߄ZwdeddfddZxdeddfddZydeddfddZzdeddfddZ{deddfddZ|deddfddZ}deddfddZ~deddfddZdeddfddZdeddfddZdeddfddZdeddfddZdeddfddZdeddfddZdeddfddZdeddfddZdeddfddZdeddfddZdeddfddZdeddfddZeZeZeZeZeZeZeZeZeZeZeZeZeZeZeZeZeZeZeZeZdeddfdd Zdeddfd d Zdeddfd d ZdeddfddZdeddfddZdeddfddZdeddfddZdeddfddZdeddfddZdeddfddZdeddfddZdeddfddZdeddfd d!Zdeddfd"d#Zdeddfd$d%Zdeddfd&d'Zdeddfd(d)Zdeddfd*d+Zdeddfd,d-Zdeddfd.d/Zdeddfd0d1Zdeddfd2d3Zdeddfd4d5Zdeddfd6d7Zdeddfd8d9Zdeddfd:d;Zdeddfd<d=Zdeddfd>d?Zdeddfd@dAZdeddfdBdCZdeddfdDdEZdeddfdFdGZdeddfdHdIZdeddfdJdKZdeddfdLdMZdeddfdNdOZdeddfdPdQZdeddfdRdSZdeddfdTdUZdeddfdVdWZdeddfdXdYZdeddfdZd[Zdeddfd\d]Zdeddfd^d_Zdeddfd`daZdeddfdbdcZdeddfdddeZdeddfdfdgZdeddfdhdiZdeddfdjdkZdeddfdldmZdeddfdndoZdeddfdpdqZdeddfdrdsZdeddfdtduZdeddfdvdwZdeddfdxdyZdeddfdzd{Zdeddfd|d}Zdeddfd~dZdeddfddZdeddfddZdeddfddZdeddfddZdeddfddZdeddfddZdeddfddZdeddfddZZS(rNrrrr!cst|||jj}|dkrd|_n |dkrtj|_nd|_|jj|_|jj |_ |jj |_ gg|_ dg|_g|_d|_d|_d|_dS)Nwindowsz nativerQr)rr)config text_newlinesnloslineseptext_sectionchars sectioncharstext_add_secnumbersadd_secnumberstext_secnumber_suffixsecnumber_suffixstates stateindent list_counter sectionlevellineblockleveltable)r&rrnewlinesrr'r(r)s      zTextTranslator.__init__rcCs|jdd|fdSNrt)rrP)r&rr'r'r(add_textszTextTranslator.add_textrcCs|jg|j|dSr")rrPr)r&rr'r'r( new_states zTextTranslator.new_stateTrr2endfirstc s|j}t|j|jggdfdd }|D]\}}|dkr/|q!|||fgq!||durvrvdd}dddgkrbd||gfn|ddd} d|| gf|jddS) Nr!csPsdSrtdtd}nd}r|7}|fdS)Nrrd)r1rWMAXWIDTH splitlinesrP)resrr maxindentresulttoformatr2r'r( do_formatsz+TextTranslator.end_state..do_formatrtrrrr)rrsumrrPinsertr) r&r2rrcontentr itemindentitem newindentrr'rr( end_states(      zTextTranslator.end_statenodecC|ddSr<rr&rr'r'r(visit_documentzTextTranslator.visit_documentcCs*||jdd|jdD|_dS)Ncss.|]\}}|D] }|od||VqqdS)rpNr')rTrr=rJr'r'r(rUsz1TextTranslator.depart_document..r)rrrWrrrr'r'r(depart_documents zTextTranslator.depart_documentcCs |j|j|_|jd7_dSrG)rr _title_charrr'r'r( visit_sectionszTextTranslator.visit_sectioncCs|jd8_dSrG)rrr'r'r(depart_sectionr3zTextTranslator.depart_sectioncCrr<rrr'r'r( visit_topicrzTextTranslator.visit_topiccC |dSr"rrr'r'r( depart_topic zTextTranslator.depart_topiccCs|d|ddS)Nrz-[ )rrrr'r'r( visit_rubrics zTextTranslator.visit_rubriccCs|d|dS)Nz ]-rrrr'r'r( depart_rubrics  zTextTranslator.depart_rubriccCdSr"r'rr'r'r(visit_compoundzTextTranslator.visit_compoundcCrr"r'rr'r'r(depart_compoundrzTextTranslator.depart_compoundcCrr"r'rr'r'r(visit_glossaryrzTextTranslator.visit_glossarycCrr"r'rr'r'r(depart_glossaryrzTextTranslator.depart_glossarycCs4t|jtjr||dtj|ddS)N: r) isinstanceparentr AdmonitionrastextSkipNoderrr'r'r( visit_titleszTextTranslator.visit_titlecCsft|jtjr1d|jdd}|jj|}|dur"|jjd}|dur1dtt ||j SdS)N#idsrr.) rrrsectionr secnumbersgetrWmapr8r)r&r anchornamenumbersr'r'r(get_section_number_stringsz(TextTranslator.get_section_number_stringcCst|jtjr |j}nd}d}ddd|jD}|jr&| ||}|j d|d|t |dg}t |jdkrLt |jddkrL|d|jd d|fdS) N^rcss$|] }|ddkr|dVqdS)rrtrNr'rer'r'r(rUs"z.TextTranslator.depart_title..z%srqrtr)rrrr rrWrrrrrrrBrP)r&rrortitler'r'r( depart_titles   zTextTranslator.depart_titlecCrr"r'rr'r'r(visit_subtitlerzTextTranslator.visit_subtitlecCrr"r'rr'r'r(depart_subtitlerzTextTranslator.depart_subtitlecCr)Nz-- rrr'r'r(visit_attributionrz TextTranslator.visit_attributioncCrr"r'rr'r'r(depart_attributionrz!TextTranslator.depart_attributioncCrr"r'rr'r'r( visit_desc!rzTextTranslator.visit_desccCrr"r'rr'r'r( depart_desc$rzTextTranslator.depart_desccCrr<rrr'r'r(visit_desc_signature'rz#TextTranslator.visit_desc_signaturecCs|jddddS)NFr2rrrr'r'r(depart_desc_signature*sz$TextTranslator.depart_desc_signaturecCrr"r'rr'r'r(visit_desc_signature_line.rz(TextTranslator.visit_desc_signature_linecCrNrQrrr'r'r(depart_desc_signature_line1rz)TextTranslator.depart_desc_signature_linecCs|||jdSr")rrrrr'r'r(visit_desc_content4sz!TextTranslator.visit_desc_contentcCrr"rrr'r'r(depart_desc_content8rz"TextTranslator.depart_desc_contentcCrr"r'rr'r'r(visit_desc_inline;rz TextTranslator.visit_desc_inlinecCrr"r'rr'r'r(depart_desc_inline>rz!TextTranslator.depart_desc_inlinecCrr"r'rr'r'r(visit_desc_nameDrzTextTranslator.visit_desc_namecCrr"r'rr'r'r(depart_desc_nameGrzTextTranslator.depart_desc_namecCrr"r'rr'r'r(visit_desc_addnameJrz!TextTranslator.visit_desc_addnamecCrr"r'rr'r'r(depart_desc_addnameMrz"TextTranslator.depart_desc_addnamecCrr"r'rr'r'r(visit_desc_typePrzTextTranslator.visit_desc_typecCrr"r'rr'r'r(depart_desc_typeSrzTextTranslator.depart_desc_typecCr)Nz -> rrr'r'r(visit_desc_returnsVrz!TextTranslator.visit_desc_returnscCrr"r'rr'r'r(depart_desc_returnsYrz"TextTranslator.depart_desc_returnscCs|dd|_dS)N(r)r first_paramrr'r'r(visit_desc_parameterlist\rz'TextTranslator.visit_desc_parameterlistcCr)N)rrr'r'r(depart_desc_parameterlist`rz(TextTranslator.depart_desc_parameterlistcCs,|js |dnd|_||tj)N, r)r-rrrrrr'r'r(visit_desc_parametercs  z#TextTranslator.visit_desc_parametercCr)N[rrr'r'r(visit_desc_optionalkrz"TextTranslator.visit_desc_optionalcCr)N]rrr'r'r(depart_desc_optionalnrz#TextTranslator.depart_desc_optionalcCrr"r'rr'r'r(visit_desc_annotationqrz$TextTranslator.visit_desc_annotationcCrr"r'rr'r'r(depart_desc_annotationtrz%TextTranslator.depart_desc_annotationcCrr"rrr'r'r( visit_figureyrzTextTranslator.visit_figurecCrr"rrr'r'r( depart_figure|rzTextTranslator.depart_figurecCrr"r'rr'r'r( visit_captionrzTextTranslator.visit_captioncCrr"r'rr'r'r(depart_captionrzTextTranslator.depart_captioncCs|g}tttj|}|D] }||dqtdd|D}d}|D]0}|dr>||d|d|d}n|durM|ddt ||| |j q'|j ddt j) N tokennamecsrRr"rB)rTnamer'r'r(rUrVz6TextTranslator.visit_productionlist..z ::=z%s rpFr2)rrrr productionrPrjrrrBrrrrr)r&rnamesproductionlistrAmaxlenlastnamer'r'r(visit_productionlists   z#TextTranslator.visit_productionlistcCs6ttj|d}||_|t|jddS)NrrZ)rrlabelrr _footnoterrB)r&rrGr'r'r(visit_footnoteszTextTranslator.visit_footnotecC|jd|jddSNz[%s] r)rrHrr'r'r(depart_footnoterXzTextTranslator.depart_footnotecCsFt|rt|dtjr|d|_nd|_|t|jddS)NrrrZ)rBrrrGr _citlabelrrr'r'r(visit_citationszTextTranslator.visit_citationcCrJrK)rrNrr'r'r(depart_citationrXzTextTranslator.depart_citationcCtjr"rrrr'r'r( visit_labelzTextTranslator.visit_labelcCrr"r'rr'r'r( visit_legendrzTextTranslator.visit_legendcCrr"r'rr'r'r( depart_legendrzTextTranslator.depart_legendcCrr"r'rr'r'r(visit_option_listrz TextTranslator.visit_option_listcCrr"r'rr'r'r(depart_option_listrz!TextTranslator.depart_option_listcCrr<rrr'r'r(visit_option_list_itemrz%TextTranslator.visit_option_list_itemcCrr"rrr'r'r(depart_option_list_itemrz&TextTranslator.depart_option_list_itemcCs d|_dS)NT) _firstoptionrr'r'r(visit_option_group z!TextTranslator.visit_option_groupcCr)Nz rrr'r'r(depart_option_grouprz"TextTranslator.depart_option_groupcCs|jrd|_dS|ddS)NFr1)r[rrr'r'r( visit_options zTextTranslator.visit_optioncCrr"r'rr'r'r( depart_optionrzTextTranslator.depart_optioncCrr"r'rr'r'r(visit_option_stringrz"TextTranslator.visit_option_stringcCrr"r'rr'r'r(depart_option_stringrz#TextTranslator.depart_option_stringcCs||ddS)N delimiterrrr'r'r(visit_option_argumentr3z$TextTranslator.visit_option_argumentcCrr"r'rr'r'r(depart_option_argumentrz%TextTranslator.depart_option_argumentcCrr"r'rr'r'r(visit_descriptionrz TextTranslator.visit_descriptioncCrr"r'rr'r'r(depart_descriptionrz!TextTranslator.depart_descriptioncCrQr"rRrr'r'r(visit_tabular_col_specrTz%TextTranslator.visit_tabular_col_speccCs|jj|dtj)Nr;)rr;rPrrrr'r'r( visit_colspeczTextTranslator.visit_colspeccCrr"r'rr'r'r( visit_tgrouprzTextTranslator.visit_tgroupcCrr"r'rr'r'r( depart_tgrouprzTextTranslator.depart_tgroupcCrr"r'rr'r'r( visit_theadrzTextTranslator.visit_theadcCrr"r'rr'r'r( depart_theadrzTextTranslator.depart_theadcC|jdSr")rrCrr'r'r( visit_tbodyrzTextTranslator.visit_tbodycCrr"r'rr'r'r( depart_tbodyrzTextTranslator.depart_tbodycCs|jjr |jdSdSr")rr=rArr'r'r( visit_rowszTextTranslator.visit_rowcCrr"r'rr'r'r( depart_rowrzTextTranslator.depart_rowcCs4t|ddd|dddd|_|ddS)Nmorerowsrrmorecols)rr )rr entryrrr'r'r( visit_entryszTextTranslator.visit_entrycsJjfddjD}j|j_jjd_dS)Nc3s |] }j|dVqdS)rN)rrWrer+r'r(rUsz.TextTranslator.depart_entry..) rrWrrrrvrrrEr&rrr'r+r( depart_entrys   zTextTranslator.depart_entrycCs$|jrtd|dt|_dS)Nz Nested tables are not supported.r)rNotImplementedErrorrr:rr'r'r( visit_tables  zTextTranslator.visit_tablecCs&|t|jd|_|jdddSNFr@)rr8rrrr'r'r( depart_tableszTextTranslator.depart_tablecCsVttj|d}tttj|}|d|ddd|Dd|tj )Nrr1css|]}|VqdSr")r)rTnr'r'r(rUrVz,TextTranslator.visit_acks..r) rr bullet_listr list_itemrrrWrr)r&rr list_itemsr'r'r( visit_ackss  zTextTranslator.visit_ackscCs4d|jvr|td|d|tdtj)Naltz [image: %s]z[image]) attributesrrrrrr'r'r( visit_image!s zTextTranslator.visit_imagecCs4t|j}|d|dt||tj)Nrr)rrrrrrrr)r&rrr'r'r(visit_transition's  zTextTranslator.visit_transitioncC|jddSrrrPrr'r'r(visit_bullet_list.r/z TextTranslator.visit_bullet_listcCror"rrrr'r'r(depart_bullet_list1rz!TextTranslator.depart_bullet_listcCs|j|ddddS)Nstartr)rrPr rr'r'r(visit_enumerated_list4sz$TextTranslator.visit_enumerated_listcCror"rrr'r'r(depart_enumerated_list7rz%TextTranslator.depart_enumerated_listcCr)Nrrr'r'r(visit_definition_list:r/z$TextTranslator.visit_definition_listcCror"rrr'r'r(depart_definition_list=rz%TextTranslator.depart_definition_listcCs`|jddkr|ddS|jddkrdS|jdd7<|tt|jdddS)Nrtrqrr)rrrBr8rr'r'r(visit_list_item@s  zTextTranslator.visit_list_itemcCsJ|jddkr|jdddS|jddkrdS|jd|jdddS)Nrtz* rLrz%s. )rrrr'r'r(depart_list_itemLs zTextTranslator.depart_list_itemcCstt|tj|_dSr")rBrtraverser classifier_classifier_count_in_lirr'r'r(visit_definition_list_itemTsz)TextTranslator.visit_definition_list_itemcCrr"r'rr'r'r(depart_definition_list_itemWrz*TextTranslator.depart_definition_list_itemcCrr<rrr'r'r( visit_termZrzTextTranslator.visit_termcCs|js |jdddSdS)Nrrrrr'r'r( depart_term]szTextTranslator.depart_termcCr)Nz : rrr'r'r(visit_classifierarzTextTranslator.visit_classifiercCs(|jd8_|js|jdddSdS)Nrrrrr'r'r(depart_classifierdsz TextTranslator.depart_classifiercCrr"rrr'r'r(visit_definitionirzTextTranslator.visit_definitioncCrr"rrr'r'r(depart_definitionlrz TextTranslator.depart_definitioncCrr"r'rr'r'r(visit_field_listorzTextTranslator.visit_field_listcCrr"r'rr'r'r(depart_field_listrrz TextTranslator.depart_field_listcCrr"r'rr'r'r( visit_fieldurzTextTranslator.visit_fieldcCrr"r'rr'r'r( depart_fieldxrzTextTranslator.depart_fieldcCrr<rrr'r'r(visit_field_name{rzTextTranslator.visit_field_namecCs|d|jdddS)N:rrrr'r'r(depart_field_name~s z TextTranslator.depart_field_namecCrr"rrr'r'r(visit_field_bodyrzTextTranslator.visit_field_bodycCrr"rrr'r'r(depart_field_bodyrz TextTranslator.depart_field_bodycCrr"r'rr'r'r(visit_centeredrzTextTranslator.visit_centeredcCrr"r'rr'r'r(depart_centeredrzTextTranslator.depart_centeredcCrr"r'rr'r'r( visit_hlistrzTextTranslator.visit_hlistcCrr"r'rr'r'r( depart_hlistrzTextTranslator.depart_hlistcCrr"r'rr'r'r(visit_hlistcolrzTextTranslator.visit_hlistcolcCrr"r'rr'r'r(depart_hlistcolrzTextTranslator.depart_hlistcolcCrr<rrr'r'r(visit_admonitionrzTextTranslator.visit_admonitioncCrr"rrr'r'r(depart_admonitionrz TextTranslator.depart_admonitioncCr)Nrqrrr'r'r(_visit_admonitionrz TextTranslator._visit_admonitioncCst|j}t|jt|}t|jddkrK|jddddkrKt|tdd|jdddDkrK|jdt|7<|j|dddS|jddd|j gf|j|dddS) NrtrrcsrRr"r>)rTsr'r'r(rUrVz4TextTranslator._depart_admonition..rrLr) rtagnamerrrBrrrrr)r&rrGrr'r'r(_depart_admonitions (z!TextTranslator._depart_admonitioncCrr<rrr'r'r(visit_versionmodifiedrz$TextTranslator.visit_versionmodifiedcCrr"rrr'r'r(depart_versionmodifiedrz%TextTranslator.depart_versionmodifiedcCrr"rrr'r'r(visit_literal_blockrz"TextTranslator.visit_literal_blockcC|jdddSr|rrr'r'r(depart_literal_blockr/z#TextTranslator.depart_literal_blockcCrr<rrr'r'r(visit_doctest_blockrz"TextTranslator.visit_doctest_blockcCrr|rrr'r'r(depart_doctest_blockr/z#TextTranslator.depart_doctest_blockcCs||jd7_dSrG)rrrr'r'r(visit_line_blockszTextTranslator.visit_line_blockcCs4|jd8_|jddd|js|ddSdS)NrFrrQ)rrrrr'r'r(depart_line_blocks z TextTranslator.depart_line_blockcCrr"r'rr'r'r( visit_linerzTextTranslator.visit_linecCrrrrr'r'r( depart_linerzTextTranslator.depart_linecCrr"rrr'r'r(visit_block_quoterz TextTranslator.visit_block_quotecCrr"rrr'r'r(depart_block_quoterz!TextTranslator.depart_block_quotecCrr"r'rr'r'r(visit_compact_paragraphrz&TextTranslator.visit_compact_paragraphcCrr"r'rr'r'r(depart_compact_paragraphrz'TextTranslator.depart_compact_paragraphcCs.t|jtjrt|jtjr|ddSdSr<)rrrrrseealsorrr'r'r(visit_paragraphs  zTextTranslator.visit_paragraphcCs,t|jtjrt|jtjr|dSdSr")rrrrrrrrr'r'r(depart_paragraphs   zTextTranslator.depart_paragraphcCrQr"rRrr'r'r( visit_targetrTzTextTranslator.visit_targetcCrQr"rRrr'r'r( visit_indexrTzTextTranslator.visit_indexcCrQr"rRrr'r'r( visit_toctreerTzTextTranslator.visit_toctreecCrQr"rRrr'r'r(visit_substitution_definitionrTz,TextTranslator.visit_substitution_definitioncCrr"r'rr'r'r(visit_pending_xref rz!TextTranslator.visit_pending_xrefcCrr"r'rr'r'r(depart_pending_xref rz"TextTranslator.depart_pending_xrefcCs@|jr|d}|dur|dtt||jdSdSdS)N secnumberr)rr rrWr r8r)r&rrr'r'r(visit_references   zTextTranslator.visit_referencecCrr"r'rr'r'r(depart_referencerzTextTranslator.depart_referencecCs"t|dd}||tj)Nrr)rrr  visit_Textrrxr'r'r(visit_number_references z%TextTranslator.visit_number_referencecCrr"r'rr'r'r(visit_download_referencerz'TextTranslator.visit_download_referencecCrr"r'rr'r'r(depart_download_reference!rz(TextTranslator.depart_download_referencecCrN*rrr'r'r(visit_emphasis$rzTextTranslator.visit_emphasiscCrrrrr'r'r(depart_emphasis'rzTextTranslator.depart_emphasiscCrrrrr'r'r(visit_literal_emphasis*rz%TextTranslator.visit_literal_emphasiscCrrrrr'r'r(depart_literal_emphasis-rz&TextTranslator.depart_literal_emphasiscCrNz**rrr'r'r( visit_strong0rzTextTranslator.visit_strongcCrrrrr'r'r( depart_strong3rzTextTranslator.depart_strongcCrrrrr'r'r(visit_literal_strong6rz#TextTranslator.visit_literal_strongcCrrrrr'r'r(depart_literal_strong9rz$TextTranslator.depart_literal_strongcCr)Nrrrr'r'r(visit_abbreviation<rz!TextTranslator.visit_abbreviationcCs$|dr|d|ddSdS)N explanationz (%s))hasattrrrr'r'r(depart_abbreviation?s z"TextTranslator.depart_abbreviationcC ||Sr")rrr'r'r( visit_manpageCr]zTextTranslator.visit_manpagecCrr")rrr'r'r(depart_manpageFr]zTextTranslator.depart_manpagecCrrrrr'r'r(visit_title_referenceIrz$TextTranslator.visit_title_referencecCrrrrr'r'r(depart_title_referenceLrz%TextTranslator.depart_title_referencecCrN"rrr'r'r( visit_literalOrzTextTranslator.visit_literalcCrrrrr'r'r(depart_literalRrzTextTranslator.depart_literalcCr)Nrrrr'r'r(visit_subscriptUrzTextTranslator.visit_subscriptcCrr"r'rr'r'r(depart_subscriptXrzTextTranslator.depart_subscriptcCr)Nrrrr'r'r(visit_superscript[rz TextTranslator.visit_superscriptcCrr"r'rr'r'r(depart_superscript^rz!TextTranslator.depart_superscriptcC|d|tjNz[%s]rrrrrr'r'r(visit_footnote_referencearjz'TextTranslator.visit_footnote_referencecCrrrrr'r'r(visit_citation_referenceerjz'TextTranslator.visit_citation_referencecCs||dSr")rrrr'r'r(rir3zTextTranslator.visit_TextcCrr"r'rr'r'r( depart_TextlrzTextTranslator.depart_TextcCrr"r'rr'r'r(visit_generatedorzTextTranslator.visit_generatedcCrr"r'rr'r'r(depart_generatedrrzTextTranslator.depart_generatedcC*d|dvs d|dvr|ddSdSNxrefclassestermrrrr'r'r( visit_inlineuzTextTranslator.visit_inlinecCrrrrr'r'r( depart_inlineyrzTextTranslator.depart_inlinecCrr"r'rr'r'r(visit_container}rzTextTranslator.visit_containercCrr"r'rr'r'r(depart_containerrzTextTranslator.depart_containercCr)Nz>>rrr'r'r(visit_problematicrz TextTranslator.visit_problematiccCr)Nz<)rrrrrrrr'r'r(visit_system_messages z#TextTranslator.visit_system_messagecCrQr"rRrr'r'r( visit_commentrTzTextTranslator.visit_commentcCrQr"rRrr'r'r( visit_metaszTextTranslator.visit_metacCs>d|ddvr|d|||jddtj)Nrr*rrFr@)r rrrrrrrrr'r'r( visit_raws   zTextTranslator.visit_rawcCrr"r'rr'r'r( visit_mathrzTextTranslator.visit_mathcCrr"r'rr'r'r( depart_mathrzTextTranslator.depart_mathcCrr"rrr'r'r(visit_math_blockrzTextTranslator.visit_math_blockcCrr"rrr'r'r(depart_math_blockrz TextTranslator.depart_math_blockcCstd|jj)NzUnknown node: )rzrr4rr'r'r( unknown_visitr/zTextTranslator.unknown_visit)r4r5r6rrrrr)r8r STDINDENTr9rboolr rrrrrrrr visit_sidebardepart_sidebarrrrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r.r0r2r4r6r7r8r9r:r;r<rFrIrMrOrPrSrUrVrWrXrYrZr\r^r_r`rarbrdrerfrgrhrirkrlrmrnrprqrrrsrwryr{r}rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrvisit_attentiondepart_attention visit_cautiondepart_caution visit_danger depart_danger visit_error depart_error visit_hint depart_hintvisit_importantdepart_important visit_note depart_note visit_tip depart_tip visit_warningdepart_warning visit_seealsodepart_seealsorrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r rr rr'r'rr(r~s ($   r)1r7rhrrtextwrap itertoolsrrtypingrrrrrr r r r r rdocutilsrrdocutils.nodesrrrdocutils.utilsrsphinxr sphinx.localerrsphinx.util.docutilsrsphinx.builders.textrrr:rrrr8r9r1Writerrrr'r'r'r(s0 4    Hg"