
    Uti                        S SK r S SKrS SKrS SKr S SKJr  SSK	J
r
   " S S\
5      r\S:X  a  \" 5       r\" S	\" \R!                  5       5      -   5        \" S
\" \R#                  5       5      -   5        \" S\" \R%                  5       5      -   5        \" S\R'                  5       -  5        \" S\R)                  5       -  5        gg! \ a	    S SKJr   Nf = f)    N)md5)new   )basicXmlModec                   `    \ rS rSrSrS rS rS rS rS r	S r
S	 rS
 rS rS rS rS rSrg)docbookXmlMode0   zClass for special handling of DocBook document types.

It sets lang attribute on article elements, and adds translators
to articleinfo/copyright.c                 (    / SQU l         / SQU l        g )N)itemizedlistorderedlistvariablelistsegmentedlist
simplelistcalloutlistvarlistentry)figure
textobjectimageobjectmediaobject
screenshotauthor
personname	firstnamesurname	othernameemaillistsobjectsselfs    5/builds/GNOME/gimp-help/tools/xml2po/modes/docbook.py__init__docbookXmlMode.__init__5   s    U
0    c                 4    U R                   U R                  -   $ )z$Returns array of tags to be ignored.r   r   r    s    r"   getIgnoredTagsdocbookXmlMode.getIgnoredTags<   s    tzz))r%   c                 >    / SQU R                   -   U R                  -   $ )z/Returns array of tags to be considered 'final'.)	para
formalparasimparareleaseinfo	revnumbertitledatetermprogramlistingr'   r    s    r"   getFinalTagsdocbookXmlMode.getFinalTags@   s'    248LLACG::N 	Nr%   c                 
    / SQ$ )z:Returns array of tags in which spaces are to be preserved.)classsynopsisinfocomputeroutputfuncsynopsisinfoliterallayoutr3   screensynopsis	userinput r    s    r"   getSpacePreserveTags#docbookXmlMode.getSpacePreserveTagsF   s    	 		r%   c                     g)z8Returns string which will be used to credit translators.ztranslator-creditsr>   r    s    r"   getStringForTranslators&docbookXmlMode.getStringForTranslatorsS   s    #r%   c                     g)zGReturns a comment to be added next to string for crediting translators.zFPut one translator per line, in the form of NAME <EMAIL>, YEAR1, YEAR2r>   r    s    r"   getCommentForTranslators'docbookXmlMode.getCommentForTranslatorsW   s    [r%   c                     UR                   S:X  d  UR                   S:X  a  U$ UR                  nU(       a/  U R                  U5      nU(       a  U$ UR                  nU(       a  M/  g )Narticleinfobookinfo)namechildren_find_articleinfonext)r!   nodechildrets       r"   rL    docbookXmlMode._find_articleinfo[   sW    99%j)@K((/C
JJE	 e
 r%   c                     UR                   (       d  g UR                  5       nUnU(       a*  UR                  S:X  a  Un U$ UR                  nU(       a  M*  U$ )N	copyright)rK   	lastChildrJ   prev)r!   rN   lasttmps       r"   _find_lastcopyright"docbookXmlMode._find_lastcopyrightf   sR    }}~~xx;& ((C	 c
 r%   c                     [        5       n[        US5      nUR                  S5      nU(       a+  UR                  U5        UR                  S5      nU(       a  M+  UR	                  5         UR                  5       $ )Nrbi   )md5_newopenreadupdateclose	hexdigest)r!   filenamehashinputr^   s        r"   _md5_for_filedocbookXmlMode._md5_for_filer   s_    yXt$zz$KK::d#D d 	~~r%   c                    U(       a  UR                   S:X  a  UR                  S:X  a  UR                  S5      nU(       a  [        R                  R                  UR                  5      n[        R                  R                  XC5      n[        R                  R                  U5      (       a  U R                  U5      nOSn[        SU-  [        R                  S9  UR                  SU< SU< 3UR                  5       S	5        g g U(       aM  UR                  (       a;  UR                  nU(       a'  U R!                  Xr5        UR"                  nU(       a  M&  g g g g )
Nelement	imagedatafilerefzTHIS FILE DOESN'T EXISTz#Warning: image file '%s' not found.)filez
@@image: 'z'; md5=zWhen image changes, this message will be marked fuzzy or untranslated for you.
It doesn't matter what you translate it to: it's not used at all.)typerJ   propospathdirnamerb   joinexistsre   printsysstderroutputMessagelineNorK   _output_imagesrM   )r!   rN   msgattrdirfullpathrc   rO   s           r"   rx   docbookXmlMode._output_images|   s    DIIy(TYY-C99Y'Dggoocll377<<277>>(++--h7D4D?(JQTQ[Q[\!!T4"H$++-#fg  dmmMME##E.

 % $Tr%   c                 F    UR                  5       nU R                  X25        g)z)Add additional messages of interest here.N)getRootElementrx   )r!   docry   roots       r"   preProcessXmldocbookXmlMode.preProcessXml   s    !!#D%r%   c                    UR                  5       nU(       aU  UR                  S:w  aE  UR                  S:w  a5  UR                  nU(       a"  UR                  S:w  a  UR                  S:w  a  M5  U(       a3  UR                  S:X  d  UR                  S:X  a  UR                  SU5        OgX0R	                  5       :X  a  gU(       Ga  U R                  U5      nU(       d  gUR                  S5      nU GHu  nUR                  5       n[        R                  " SU5      nU(       d  M4  U R                  U5      n	[        R                  " S5      n
U	(       a  U	R                  U
5      n
OUR                  U
5        UR                  S5      (       a"  U
R!                  SS	UR                  S5      5        UR                  S
5      (       a=  UR                  S5      (       a'  UR                  S
5      SUR                  S5      -  -   nORUR                  S
5      (       a  UR                  S
5      nO*UR                  S5      (       a  UR                  S5      nOSnU
R!                  SSU5        GMx     gg)zSets a language and translators in "doc" tree.

"translators" is a string consisted of "Name <email>, years" pairs
of each translator, separated by newlines.articlebooklangN
z$^([^<,]+)\s*(?:<([^>,]+)>)?,\s*(.*)$rS      yearr      z(%s)z???holder)r   rJ   rM   setProprB   rL   splitstriprematchrX   libxml2newNodeaddNextSiblingaddChildgroupnewChild)r!   r   languagetranslatorsr   ailinesliner   rV   copyr   s               r"   postProcessXmlTranslation(docbookXmlMode.postProcessXmlTranslation   s    !!#tyyI-$))v2E99D tyyI-$))v2ETYY)+tyyF/BLL*6688''-B  %%d+Ezz|!H$O533B7D"??;7D#2248D){{1~~dFEKKNC{{1~~%++a..!&QQ0G!GQ!&QQ!&Q!&MM$&9)  r%   r   N)__name__
__module____qualname____firstlineno____doc__r#   r(   r4   r?   rB   rE   rL   rX   re   rx   r   r   __static_attributes__r>   r%   r"   r   r   0   sE    !0*N$\	
 #.&
-:r%   r   __main__zIgnored tags       : zFinal tags         : zSpace-preserve tags: zCredits from string: '%s'zExplanation for credits:
	'%s')r   r   rn   rt   hashlibr   r\   ImportErrorr   basicr   r   r   testrs   reprr(   r4   r?   rB   rE   r>   r%   r"   <module>r      s   H 
  	 
#&  U:\ U:p zD	
!D)<)<)>$?
?@	
!D):):)<$=
=>	
!D)B)B)D$E
EF	
%(D(D(F
FG	
,t/L/L/N
NO {  #"#s   C CC