³ò ‹÷Ec @sÐddklZlZedeƒZdZd „Zd „Zd „Zd„Zd„Z d„Z d„Z d„Z d„Zd„Z d„Zy(ddklZeeƒee ƒWnej onXdS(iÿÿÿÿ(tUNICODEtcompiles \$\{[^${}]*\}s${time}s ${timestring}s ${timestamp}s${date}s${day}s${month}s${year}s ${author}cCs|djo+ddkl}|ƒ}t|dƒSn|djo+ddkl}|ƒ}t|dƒSn|djo+ddkl}|ƒ}t|dƒSn|d joLddkl}|ƒ}d t|dƒt|dƒt|dƒfSn|d joLddkl}|ƒ}d t|d ƒt|d ƒt|dƒfSn|djoddkl}|ƒSn|djomddkl}|ƒ}d|dt|dƒt|dƒt|d ƒt|d ƒt|dƒfSn|djo tƒSndS(s¢ Replaces a variable/'special placeholder' with it's value. Any variables added here need to be added to self.special_placeholders in self.__init_attributes s${day}iÿÿÿÿ(t localtimeis${month}is${year}is${date}s%s:%s:%ss${time}iiis ${timestring}(tctimes ${timestamp}s[%s-%s-%s] %s:%s:%ss ${author}N(ttimeRtpad_zeroRtget_author_name(t placeholderRtthetimeR((splugins/Templates/utils.pytreplace_special_placeholders:        3  3    T cCsè|idƒ}|i|ƒ}|iƒ}|iƒ}|iƒ|iƒ|i|ƒodSnddkl}l}xAto9|i ƒ||d|i ƒƒƒo|i ƒPq{q{W|i|ƒodSn|i ||ƒdS(sd Convert beginning tab characters to space characters on a line. @param sourceview: The gtksourceview buffer's container @type sourceview: A gtksourceview.SourceView object. @param line_number: The line to perform conversion operation on. @type line_number: An Integer object. @return: True if the line was converted. @rtype: An Boolean object. tbufferNiÿÿÿÿ(tnot_tcontainst s (R s ( t get_propertytget_iter_at_linetcopytforward_to_line_endtequaltoperatorR R tTruet backward_chartget_chart forward_chartdelete(t sourceviewt line_numbert sourcebuffertbegin_positionttransition_positiont end_positionR R ((splugins/Templates/utils.pytremove_trailing_spaces_on_line,s         cCsà|iƒodSn|iƒ}|iƒddkl}l}|d|iƒƒodSnxhto`|iƒoPn|iƒ|d|iƒƒo*||iƒdƒoPn|i ƒPqbqbW|i ||ƒ}|S(Niÿÿÿÿ(R teqR s t`(R s (R s R!( t starts_linetNoneRRRR R RRRtget_text(t textbuffertiteratort temporaryR R ttext((splugins/Templates/utils.pytword_to_cursorJs      csxddkl‰l‰ˆt|ƒƒogSn‡‡fd†}ddkl}l}|t||ƒ}t||ƒS(s Get all placeholders in a string if any. @param string: A string representing a template. @type string: A String object. @return: All placeholders in a template. @rtype: A List object. iÿÿÿÿ(R R csˆˆt|ƒƒS((tspecial_placeholders(R(R R (splugins/Templates/utils.pytfs(tfindallR( RR R thas_placeholderstreR,Rtplaceholder_patterntfilter(tstringtis_not_specialR,Rt placeholders((R R splugins/Templates/utils.pytget_placeholdersZs cCs5ddkl}l}|t||ƒotSntS(sÔ Check whether or not a string contains placeholders. @param string: A string representing a template. @type string: A String object. @return: True if a string has placeholders. @rtype: A Boolean object. iÿÿÿÿ(tsearchR(R.R5RR/RtFalse(R1R5R((splugins/Templates/utils.pyR-ls csTddkl‰ddkl}l}|t||ƒ}‡fd†}t||ƒS(sÁ Get all placeholders in a string if any. @param placeholders: A list of placeholders @type placeholders: A List object. @return: All placeholders in a template. @rtype: A List object. iÿÿÿÿ(R (R,Rcs ˆt|ƒS((R*(R(R (splugins/Templates/utils.pyR+ˆs(RR R.R,RR/R0(R1R,RR3thas_special_placeholder((R splugins/Templates/utils.pytget_special_placeholders{s cCsPddkl}||ƒ}|ot|di|ƒƒ}n|i|ƒdS(sÜ Insert a string into the editing area. @param textbuffer: The editor's editing area. @type textbuffer: A ScribesTextBuffer object. @param string: A string representing a template. @type string: A String object. iÿÿÿÿ(tget_beginning_spacestN(t SCRIBES.linesR9t__indent_stringtjointinsert_at_cursor(R%R1R9tspaces((splugins/Templates/utils.pyt insert_string‹s  # cs€|idƒ}ddkl}|t|ƒdƒo|Sn‡fd†}t||dƒ}|id|dƒdi|ƒS(s, Automatically indent string for insertion in editing area. @param string: A string to be indented. @type string: A String object. @param indentation: Space or tab characters to place before string. @type indentation: A String object. @return: An indented string. @rtype: A String object. s iÿÿÿÿ(R icsˆ|S(((tline(t indentation(splugins/Templates/utils.pyR+«si(tsplitRR tlentmaptinsertR=(R1RBtlinesR tindenttindented_lines((RBsplugins/Templates/utils.pyR<›s cCsè|idƒ}|i|ƒ}|iƒ}|iƒ}|iƒ|iƒ|i|ƒotSnddkl}l}xAt o9|i ƒ||d|i ƒƒƒo|i ƒPq{q{W|i|ƒotSn|i ||ƒt S(sd Convert beginning tab characters to space characters on a line. @param sourceview: The gtksourceview buffer's container @type sourceview: A gtksourceview.SourceView object. @param line_number: The line to perform conversion operation on. @type line_number: An Integer object. @return: True if the line was converted. @rtype: An Boolean object. R iÿÿÿÿ(R R R s (R s (RRRRRR6RR R RRRRR(RRRRRRR R ((splugins/Templates/utils.pyR°s         cCs)|djodt|ƒSnt|ƒS(Ni t0(tstr(tnum((splugins/Templates/utils.pyRÎs cCspddk}ddk}|i|iƒƒ}|didƒd}|djp |djo|d}n|S(s Get author name from /etc/passwd. This code was contributed by Herman Polloni. @return: Return name of author. @rtype: A String object. iÿÿÿÿNit,iR:(tpwdtposixtgetpwuidtgetuidRCR#(RNROtusertname((splugins/Templates/utils.pyRÓs (tbindN(s${time}s ${timestring}s ${timestamp}s${date}s${day}s${month}s${year}s ${author}(R.RRR/R*R RR)R4R-R8R@R<RRtpsycoRTt ImportError(((splugins/Templates/utils.pyss( %