
    -Ph                     R   d Z ddlZddlZddlmZ ddlZddlmZ ddlm	Z	  ed          Z
ej                            d ej         ed           ed	          d
           ej         ed           ed          d           ej         ed           ed          d           ej         ed           ed          d          g          d             Zej                            d ej        ddddd           ej        ddddd           ej        dd d!d"d#           ej        d$d d%d&d'           ej        d(d)d*d+d,           ej        d(d)d-d.d/           ej        d0dd1d2d3           ej        d4d5d6d7d8          g          d9             Zd: ZdS );ztest BlockParser.    N)dedent)BlockParser)DEFAULT_GALLERY_CONFz
    int x = 3;
    return;
zcomment, expected_docstringzp                // Title
                // =====
                //
                // description
            zU                Title
                =====

                description
            zsingle-line style)idzi                /*
                   Title
                   =====
                 */
                z<                Title
                =====
                zsimple multilinezi                /*
                 * Title
                 * =====
                 */
                zdecorated-multilinezi                /* Title
                 * =====
                 *
                 */
                zearly-multilinec                     | t           z   }t          dt                    }|                    |          \  }}}t	          |          dk    sJ |d         d         dk    sJ |d         d         |k    sJ d S )N*.cpp   r   text   )CXX_BODYr   r   _split_contentlen)commentexpected_docstringdocparser	file_confblocks_s          f/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/sphinx_gallery/tests/test_block_parser.pytest_cxx_titlesr      s    ^ H
C"677F!0055Ivqv;;!!9Q<6!!!!!9Q<-------    z"filetype, title, special, expectedz*.pyz# Titlez(# %%
# A simple comment
# with two linesz A simple comment
with two lines
simplez*.f90z! Titlez+    !%%
    !  Indented single-line commentzIndented single-line comment
zsingle-line-indentedr   z// TitlezB     // %%
     // First comment line
     // Second comment line
z'First comment line
Second comment line
zindented-separate-sentinelz*.cszj     //////////////////////////////
     // Indented multi-line comment
     //
     // with a blank line
z/Indented multi-line comment

with a blank line
zblock-two-paragraphsz*.cz/* Title */zW     /* %%  
        Indented multi-line comment
        continued on a second line */
z7Indented multi-line comment
continued on a second line
zmultiline-block-commentzN     /*%%
      * * List item
      * * Another item
      * * Item 3
      */z$* List item
* Another item
* Item 3
zmultiline-comment-short-formz*.jlzC    #=%%
    * list item 1
    * list item 2
      * subitem
    =#z(* list item 1
* list item 2
  * subitem
zjulia-multilinez*.mz% Titlez!%% Heading
% Extended descriptionz&Heading
-------

Extended description
zmatlab-autoheadingc                 4   | dt            d| dt            }t          j                    }ddi|d<   t          | |          }|                    |          \  }}}	t          |          dk    sJ |d         d         d	k    sJ |d         d
         |k    sJ d S )N
z

z.mMatlabfiletype_parsers   r	   r   r
   r   )r   r   copyr   r   r   )
filetypetitlespecialexpectedr   gallery_confr   r   r   r   s
             r   test_rst_blocksr%   l   s    Z 
9
9h
9
9G
9
9x
9
9C',..L(,h'7L#$<00F!0055Ivqv;;!!9Q<6!!!!!9Q<8######r   c                     d} t          j        ddd          5 }|                    |                                            d d d            n# 1 swxY w Y   	 t	          |j        t                    }|                    |j                  \  }}}t          j	        |j                   n# t          j	        |j                   w xY w|j
        dk    sJ |ddik    sJ d	|d
         d         v sJ d|d         d         v sJ d|d         d         v sJ d|d         d         v sJ d|                    |d         d                   vsJ |                    |d         d                   }d|vsJ d|v sJ d S )Na  // Do stuff
// --------

int main(int argc, char** argv) {
    //%% First heading
    //This is the start of ``main``

    // This is just a comment because of the preceding blank line
    int y = 4;

    // sphinx_gallery_start_ignore
    y = 5; // don't look: this is a secret!
    // sphinx_gallery_end_ignore
    if (y == 4) {
        return 1;
    }
    // sphinx_gallery_foobar = 14
}
wbz.cppF)suffixdeletezC++foobar   z.First heading
-------------

This is the startr	   r   z// This is just a comment   secretsphinx_gallery_foobarzy == 4)tempfileNamedTemporaryFilewriteencoder   namer   split_code_and_text_blocksosremovelanguageremove_config_commentsremove_ignore_blocks)CODEfr   r   r   r   cleaneds          r   test_cpp_file_to_rstr=      s   D( 
	$T&	G	G	G 1	              QV%9::%@@HH	61
	!&	!&?e####2&&&&>&)A,NNNN&&)A,6666vay|####"fQil2222"&*G*Gq	RS*U*UUUUU))&)A,77G7""""ws   (AAA8B, ,C)__doc__r5   r/   textwrapr   pytestsphinx_gallery.block_parserr   sphinx_gallery.gen_galleryr   r   markparametrizeparamr   r%   r=    r   r   <module>rG      sk     				         3 3 3 3 3 3 ; ; ; ; ; ;6  !F  F  ##	
 	
 	
( 	F  F  "	
 	
 	
$ 	F  F  %	
 	
 	
$ 	F  F  !	
 	
 	
sJM M\. .]M M\. (80	
 	
 	
 	:,%	
 	
 	
 	T7+	
 	
 	
 	.
 A%	
 	
 	
 	: H(
	
 
	
 
	
 	 7-	
 	
 	
 	V9 	
 	
 	
 	08#	
 	
 	
CHK KX	$ 	$YK KX	$+ + + + +r   