
    -eL                        d Z ddlmZ ddlZ ej        e          ZddlmZ ddl	m
Z
 ddlmZ ddlmZ dd	lmZ d
Zd Zd Zd ZdZdZdZdS )a9   Generate a ``sitemap.txt`` to aid with search indexing.

``sitemap.txt`` is a plain text list of all the pages in the docs site.
Each URL is listed on a line in the text file. It is machine readable
and used by search engines to know what pages are available for indexing.

All that is required to generate the sitemap is to list this module
``bokeh.sphinxext.sitemap`` in the list of extensions in the Sphinx
configuration file ``conf.py``.

To enable this extension, add `"bokeh.sphinxext.bokeh_sitemap"` to the
extensions list in your Sphinx configuration module.

    )annotationsN)escape)join)SphinxError)status_iterator   )PARALLEL_SAFE)build_finishedhtml_page_contextsetupc                j    |d         }|d         }| j                             | | d| d           dS )z;Collect page names for the sitemap as HTML pages are built.SITEMAP_BASE_URLversion/z.htmlN)sitemap_linksadd)apppagenametemplatenamecontextdoctreesiter   s          =lib/python3.11/site-packages/bokeh/sphinxext/bokeh_sitemap.pyr   r   A   sJ    %&Di GT<7<<X<<<=====    c                |   t          | j        d          }t          t          | j                  ddt          | j                  | j                  }	 t          |d          5 }|                    t                     |D ]e}t          |                                                    dd                    }|                    t                              |                     f|                    t                     ddd           dS # 1 swxY w Y   dS # t           $ r}t#          d	|           d}~ww xY w)
z>Generate a ``sitemap.txt`` from the collected HTML page links.zsitemap.xmlzadding links to sitemap... brownwzhttps://zhttp://)linkNz"cannot write sitemap.txt, reason: )r   outdirr   sortedr   len	verbosityopenwrite_headerr   stripreplace_itemformat_footerOSErrorr   )r   	exceptionfilename
links_iterfr   	http_linkes           r   r
   r
   H   s~   CJ..H (9!:!:<Y[bdghkhydzdz|  }J  K  KJD(C   	AGGG" 6 6"4::<<#7#7
I#N#NOO	)445555GGG	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	  D D DBqBBCCCDs=   D #BD D DD DD 
D;$D66D;c                    |                      dt                     |                      dt                     t                      | _        t
          S )z+ Required Sphinx extension setup function. zhtml-page-contextzbuild-finished)connectr   r
   setr   r	   )r   s    r   r   r   Y   s?    KK#%6777KK .111Cr   zf<?xml version="1.0" encoding="UTF-8"?>

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">

z,   <url>
      <loc>{link}</loc>
   </url>

z
</urlset>
)__doc__
__future__r   logging	getLogger__name__loghtmlr   os.pathr   sphinx.errorsr   sphinx.utilr    r	   __all__r   r
   r   r%   r(   r*    r   r   <module>rB      s    $ # " " " " " g!!             & % % % % % ' ' ' ' ' '      > > >D D D"  	r   