
    k7i9                       S r SSKJr  SrSSKrSSKrSSKrSSKJr  SSK	r	SSK	J
r
JrJr  SSKJr  \R                  " \R                   R#                  \R$                  " 5       S5      \R                   R#                  \R                   R'                  \5      S	5      5      rS
 r " S S\R.                  5      r " S S\R0                  5      rg)z
S5/HTML Slideshow Writer.
    )annotationsreStructuredTextN)Path)frontendnodesutils)	html4css1dummythemesc                    [         R                  R                  [        U 5      n[         R                  R	                  U5      (       d  [
        R                  " SU < SU< S35      eU$ )NzTheme directory not found: z (path: ))ospathjointhemes_dir_pathisdirdocutilsApplicationError)namer   s     [/home/james-whalen/.local/lib/python3.13/site-packages/docutils/writers/s5_html/__init__.py
find_themer      sM     77<<.D77=='':>EG 	GK    c                  <   \ rS rSr\R
                  R                  SSSS/SSSS	.4S
S/SSS.4SS/S\R                  S.4SS/SSS.4SS/SS/SSS.4SS/SS \R                  S!.4S"S#/S$SS.4S%S&/S\R                  S.4S'S(/S)SS.44	4-   rS*S+0r	S,r
S-rS1S. jrS/rg0)2Writer%   zS5 Slideshow Specific OptionszFor the S5/HTML writer, the --no-toc-backlinks option (defined in General Docutils Options above) is the default, and should not be changed.aB  Specify an installed S5 theme by name.  Overrides --theme-url.  The default theme name is "default".  The theme files will be copied into a "ui/<theme>" directory, in the same directory as the destination file (output HTML).  Note that existing theme files will not be overwritten (unless --overwrite-theme-files is used).z--themedefaultz<name>	theme_url)r   metavar	overrideszSpecify an S5 theme URL.  The destination file (output HTML) will link to this theme; nothing will be copied.  Overrides --theme.z--theme-urlz<URL>theme)r   r   z{Allow existing theme files in the ``ui/<theme>`` directory to be overwritten.  The default is not to overwrite theme files.z--overwrite-theme-files
store_true)action	validatorzfKeep existing theme files in the ``ui/<theme>`` directory; do not overwrite any.  This is the default.z--keep-theme-filesoverwrite_theme_filesstore_false)destr"   z@Set the initial view mode to "slideshow" [default] or "outline".z--view-mode	slideshowoutlinez<mode>)choicesr   r   zONormally hide the presentation controls in slideshow mode. This is the default.z--hidden-controlsT)r"   r   r#   z^Always show the presentation controls in slideshow mode.  The default is to hide the controls.z--visible-controlshidden_controlszMEnable the current slide indicator ("1 / 15").  The default is to disable it.z--current-slidez:Disable the current slide indicator.  This is the default.z--no-current-slidecurrent_slidetoc_backlinksr   zs5_html writer)writerszhtml writerszhtml4css1 writerc                X    [         R                  R                  U 5        [        U l        g N)r	   r   __init__S5HTMLTranslatortranslator_classselfs    r   r0   Writer.__init__[   s    !!$' 0r   )r2   NreturnNone)__name__
__module____qualname____firstlineno__r	   r   settings_specr   validate_booleansettings_default_overridesconfig_sectionconfig_section_dependenciesr0   __static_attributes__ r   r   r   r   %   sT   $$22'	%N
 +H#%
&L/G
4
6G$
%!0I0I
J
L1
 *m
D
F M/"I.; 
!!
!d 113
4
1
 $
>
@*
!0I0I
J
L G
 "m
<
>K'	@,6A ,AM\ #21!5%N#71r   r   c                      \ rS rSrSrSrSrSr Sr Sr	 Sr
 \
\	-   r SS	 jrS
 rS r\R                   " S5      rS rSS jrSS jrSS jrSS jrSS jrSS jrSrg)r1   `   a  <!-- configuration parameters -->
<meta name="defaultView" content="%(view_mode)s" />
<meta name="controlVis" content="%(control_visibility)s" />
<!-- style sheet links -->
<script src="%(path)s/slides.js" type="text/javascript"></script>
<link rel="stylesheet" href="%(path)s/slides.css"
      type="text/css" media="projection" id="slideProj" />
<link rel="stylesheet" href="%(path)s/outline.css"
      type="text/css" media="screen" id="outlineStyle" />
<link rel="stylesheet" href="%(path)s/print.css"
      type="text/css" media="print" id="slidePrint" />
<link rel="stylesheet" href="%(path)s/opera.css"
      type="text/css" media="projection" id="operaFix" />
zA
<style type="text/css">
#currentSlide {display: none;}
</style>
z<div class="layout">
<div id="controls"></div>
<div id="currentSlide"></div>
<div id="header">
%(header)s
</div>
<div id="footer">
%(title)s%(footer)s
</div>
</div>
r   __base__)z
slides.csszoutline.cssz	print.cssz	opera.cssz	slides.js)zs5-core.csszframing.cssz
pretty.cssc                   [         R                  R                  " U /UQ76   S U l         U R	                  5         U R                  R                  R                  nSU R                  R                  R                     nU R                  R                  U R                  U R                  UUS.-  5        U R                  R                  R                   (       d%  U R                  R                  U R"                  5        U R$                  R                  S5        / U l        / U l        SU l        S U l        g ! [
        R                   a0  nU R                  R                  R                  U5         S nAGN:S nAff = f)N)visiblehidden)r   	view_modecontrol_visibilityz)<meta name="version" content="S5 1.1" />
r   )r	   HTMLTranslatorr0   theme_file_pathsetup_themer   r   documentreporterwarningsettingsrJ   r*   
stylesheetappends5_stylesheet_templater+   disable_current_slidemeta	s5_footer	s5_headersection_counttheme_files_copied)r4   argserJ   rK   s        r   r0   S5HTMLTranslator.__init__   s/     ))$66#	. MM**44	24==3I3I4COEt::*.*>*>/88J"L L 	M }}%%33OO""4#=#=>		EF"& (( 	.MM""**1--	.s   D5 5E9	%E44E9c                0   U R                   R                  R                  (       a  U R                  5         g U R                   R                  R                  (       a&  U R                   R                  R                  U l        g [        R                  " S5      e)Nz&No theme specified for S5/HTML writer.)rO   rR   r    
copy_themer   rM   r   r   r3   s    r   rN   S5HTMLTranslator.setup_theme   s`    ==!!''OO]]##--#'==#9#9#C#CD ++8: :r   c                6   U R                   R                  n[        UR                  5      nU/n0 U l        0 nSUR                  -  U l        UR                  (       d  [        R                  " S5      e[        R                  R                  [        R                  R                  UR                  5      SUR                  5      n[        R                  R                  U5      (       d  [        R                  " U5        SnU(       Gaq  [        R                  " U5       HB  nXpR                   :X  a  M  U R#                  XrU5      (       d  M-  XpR$                  ;   d  M>  SXG'   MD     U(       a  GO[        R                  R                  X R                   5      n[        R                  R'                  U5      (       a  [)        USS9 nUR+                  5       n	SSS5        W	 HX  n
U
R-                  5       n
U
(       d  M  U
R/                  S	5      (       a  M4  [        U
5      nX#;   a  SnOUR1                  U5          O   SnOSnU(       d(  [        U R2                  5      nUR1                  U5        SnU(       a  GMq  [5        U5      [5        U R$                  5      :w  al  [7        U R$                  5      nUR9                  5        H  nUR;                  U5        M     [        R                  " S
SR                  S U 5       5      -  5      eg! , (       d  f       GN:= f)z
Locate & copy theme files.

A theme may be explicitly based on another theme via a '__base__'
file.  The default base theme is 'default'.  Files are accumulated
from the specified theme, any base themes, and 'default'.
zui/%szjOutput path not specified, you may need to copy the S5 theme files "by hand" or set the "--output" option.uiFTzutf-8)encodingN#zTheme files not found: %sz, c              3  ,   #    U  H
  nS U-  v   M     g7f)z%rNrC   ).0fs     r   	<genexpr>.S5HTMLTranslator.copy_theme.<locals>.<genexpr>   s     7hD1Hhs   )rO   rR   r   r    r[   rM   output_pathr   r   r   r   r   dirnamer   makedirslistdirbase_theme_file	copy_filerequired_theme_filesisfileopen	readlinesstrip
startswithrT   default_themelenlistkeysremove)r4   rR   r   theme_pathsrequired_files_copiedr&   r   rh   ro   lineslinerequireds               r   r`   S5HTMLTranslator.copy_theme   sj    ==))(..)f"$ "&7##++NO O ww||GGOOH0014Iww}}T""KKZZ%,,,NN1D11666/3), &  ggll41E1EFOww~~o../G<KKME =!D::<DtDOOC$8$8)$/.#'D'..t4 "  D!$"4"45""4(? d@ $%T-F-F)GGD556H*//1" 2+++))7h7789 9 H' =<s   L		
Lz~$|\.bak$|#$|\.cvsignore$c           	        [         R                  R                  X!5      n[         R                  R                  X15      nXPR                  ;   a  gSU R                  U'   [         R                  R	                  U5      (       Ga:  U R
                  R                  U5      (       a  gU R                  R                  n[         R                  R                  U5      (       a-  UR                  (       d  UR                  R                  U5        g[        U5      R                  5       nUR                  [         R                   S5      n[        U5      R#                  UR                  SX3R%                  S5      S R'                  [(        R*                  " 5       5      5      5        UR                  R                  U5        g[         R                  R	                  U5      (       a  gg)zx
Copy file `name` from `source_dir` to `dest_dir`.
Return True if the file exists in either `source_dir` or `dest_dir`.
TN/s
   ui/defaultzui/)r   r   r   r[   rr   files_to_skip_patternsearchrO   rR   existsr$   record_dependenciesaddr   
read_bytesreplacesepwrite_bytesrfindencodesysgetfilesystemencoding)r4   r   
source_dirdest_dirsourcer&   rR   src_datas           r   rp   S5HTMLTranslator.copy_file   s`   
 j/ww||H+***,0D##D)77>>&!!))0088}}--Hww~~d##H,J,J,,006   <224#++BFFC8T
&&x'7'7!^^E234;;1135(6 7 ,,00877>>$  r   c                   U R                   R                  U R                  U R                  SU R                  R
                  0-  /5        U R                  R                  U R                  5        U R                  S S  U R                  -   U l	        U R                  (       a[  U R                  S:X  a&  U R                  R                  U R                  5        O%U R                  R                  U R                  5        U R                  R                  U R                  SS  5        U R                  R                  U R                  5        SR!                  U R"                  5      nSR!                  U R$                  5      nSR!                  U R&                  5      R)                  SS5      nU R*                  UUUS.-  nU R,                  R                  U5        U R,                  R                  S5        U R,                  R                  U R/                  S	/S
/S.S5      5        U R0                  (       d  U R                  R                  S5        U R2                  R5                  SS5        U R6                  R                  U R,                  SS  U R8                  -   U R:                  -   U R                  -   U R2                  S S -   5        g )Nlangmathjax    z<h1 class="title">z<h1>)headertitlefooterz<div class="presentation">
slideslide0)classesidsdivz</div>
r   )head_prefixextenddoctypehead_prefix_templaterR   language_codehtml_prologrT   rW   headmath_headermath_outputrS   	html_headfragmentbodyr   rY   rX   
html_titler   layout_templatebody_prefixstarttagrZ   body_suffixinsert	html_bodybody_pre_docinfodocinfo)r4   noder   r   r   layouts         r   depart_document S5HTMLTranslator.depart_document  s1   !%!:!:"($--*E*E!F"G!H 	I 	-IIaL499,	9,		  !1!12&&t'7'78diim,TYY'(((001EvN%%62739); ; 	' >?MMwi
CUK	M!!IIZ(:.d..qr2T5J5JJ $-/3yy9 $ 0 0" 56 	7r   c                   U R                   R                  5       nU R                  R                  S5        U R                  R	                  U R
                  US  5        U R                  R                  S5        U R
                  US 2	 g )Nz<h2>z</h2>)contextpoprX   rT   r   r   )r4   r   starts      r   depart_footerS5HTMLTranslator.depart_footer<  sc      "f%dii/0g&IIefr   c                    U R                   R                  5       nS/nUR                  U R                  US  5        UR	                  S5        U R                  US 2	 U R
                  R                  U5        g )Nz<div id="header">

</div>
)r   r   r   r   rT   rY   )r4   r   r   r   s       r   depart_headerS5HTMLTranslator.depart_headerC  s_      "'(dii'(l#IIeff%r   c                z   U R                   (       d  U R                  R                  S5        U =R                   S-  sl         U =R                  S-  sl        U R                  S:  a+  U R                  R                  U R	                  USSS95        g U R                  R                  U R	                  USSS95        g )Nr   r   r   section)CLASSr   )rZ   r   rT   section_levelr   r4   r   s     r   visit_sectionS5HTMLTranslator.visit_sectionK  s    !!II\*aa!IIT]]4i]HIIIT]]4g]FGr   c                z   [        UR                  [        R                  5      (       as  U R                  U R
                  -   S-
  nUS:X  a  SnSU-  nU R                  R                  U R                  XS5      5        U R                  R                  SU-  5        g [        R                  R                  X5        g )Nr      zh%sr   z</%s>
)
isinstanceparentr   r   r   initial_header_levelr   rT   r   r   r	   rL   visit_subtitle)r4   r   leveltags       r   r   S5HTMLTranslator.visit_subtitleV  s    dkk5==11&&)B)BBQFEz%-CIIT]]4b9:LL	C0$$33D?r   c                B    [         R                  R                  X5        g r/   )r	   rL   visit_titler   s     r   r   S5HTMLTranslator.visit_titlea  s      ,,T8r   )r   rX   rY   rZ   rM   r[   Nr6   )r9   r:   r;   r<   rU   rV   r   rw   ro   direct_theme_filesindirect_theme_filesrq   r0   rN   r`   recompiler   rp   r   r   r   r   r   r   rB   rC   r   r   r1   r1   `   s    ?$

O  M$ OALD4 02DD)'.:?9B JJ'CD:7B&	H	@9r   r1   )__doc__
__future__r   __docformat__r   r   r   pathlibr   r   r   r   r   docutils.writersr	   relative_pathr   r   getcwdrl   __file__r   r   r   rL   r1   rC   r   r   <module>r      s    #" 	 	 
   + + &%%GGLLg&GGLL*H57
81Y 81vB9y// B9r   