
Z\c        /   @  s"  d  d l  m Z d  d l Z d  d l m Z m Z d  d l j j Z e	 d e
 d e
 d e d e d e d	 e d
 e
 d e
 d e
 d e
 d e
 d e
 d e
 d e
 d e
 d e d e
 d e
 d e
 d e
 d e
 d e d e  Z e
 e d <d   Z d d d  Z d e f d     YZ d  e d!  Z d S("   i(   t   print_functionN(   t   TAGt	   PARAGRAPHt   alphat   artt   imaget   pt   wt   fastt   bt   it   ut   at   plaint   fontt   colort   outlinecolort   sizet   nwt   st   rtt   rbt   kt   cpst   spacet   vspacet    c   
      C  s  t  t  } t j j } | r. | j |  n  t j j } | r\ | j t  j | t   n  y t	 j
 t |    } Wn t k
 r } | j d SXg  } x | D] \ } } | t k r q n  | d d k r q n  | j d  d k r | | j d   } n  | rY| d d k rY| s#d | S| d | d k rId | | d f S| j   q n  | | k rmd	 | S| | r | j |  q q W| rd
 d j g  | D] }	 d |	 d ^ q Sd S(   s   
    :doc: lint

    Checks the text tags in s for correctness. Returns an error string if there is
    an error, or None if there is no error.
    i    t   #t   =it   /s4   Close text tag '%s' does not match an open text tag.i   s6   Close text tag '%s' does not match open text tag '%s'.s   Text tag '%s' is not known.s?   One or more text tags were left open at the end of the string: s   , t   'N(   t   dictt	   text_tagst   renpyt   configt   custom_text_tagst   updatet   self_closing_custom_text_tagst   fromkeyst   Falset   textsupportt   tokenizet   unicodet	   Exceptiont   argsR   t   findt   popt   appendt   joint   None(
   R   t   all_tagst   custom_tagst   self_closing_custom_tagst   tokenst   et	   tag_stackt   typet   textR
   (    (    sj   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\extras.pyt   check_text_tagsA   sB    

,c         C  sR  | d
 k r' | d
 k r' t d   n  | d
 k	 rN | d
 k	 rN t d   n  t j t |    } g  } x | D] \ } } | t k r | j d  qp | t k r4| j d  d } | r | d d k r | d } n  | d
 k	 r| | k r1| j d | d  q1qA| | k rA| j d | d  qAqp | j |  qp Wd	 j	 |  S(   sl  
    :doc: text_utility

    Returns a copy of `s` with the text tags filtered. Exactly one of the `allow` and `deny` keyword
    arguments must be given.

    `allow`
        A set of tags that are allowed. If a tag is not in this list, it is removed.

    `deny`
        A set of tags that are denied. If a tag is not in this list, it is kept in the string.
    sU   Only one of the allow and deny keyword arguments should be given to filter_text_tags.s   
R   i    R   i   t   {t   }R   N(
   R1   R+   R(   R)   R*   R   R/   R   t	   partitionR0   (   R   t   allowt   denyR5   t   rvt	   tokentypeR9   t   kind(    (    sj   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\extras.pyt   filter_text_tags|   s(    t   ParameterizedTextc           B  s)   e  Z d  Z d d  Z e Z d   Z RS(   sg  
    :name: ParameterizedText
    :doc: text

    This is a displayable that can be shown with an additional string
    parameter, which then shows that string as if it was an image.
    This is usually used as part of the pre-defined ``text`` image.

    For example, one can do::

        show text "Hello, World" at truecenter
        with dissolve
        pause 1
        hide text
        with dissolve

    You can use ParameterizedText directly to define similar images with
    different style properties. For example, one can write::

        image top_text = ParameterizedText(xalign=0.5, yalign=0.0)
    t   defaultc         K  s   | |  _  | |  _ d  S(   N(   t   stylet
   properties(   t   selfRF   RG   (    (    sj   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\extras.pyt   __init__   s    	c         C  sz   t  | j  d k r4 t d d j | j    n  d j | j  } t j j |  } t j j j	 | d |  j
 |  j S(   Ni    s%   '%s' takes a single string parameter.t    R   RF   (   t   lenR,   R+   R0   t   nameR!   t   pythont   py_evalR9   t   TextRF   RG   (   RH   R,   t   paramt   string(    (    sj   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\extras.pyt
   _duplicate   s
    (   t   __name__t
   __module__t   __doc__RI   t   Truet   _duplicatableRR   (    (    (    sj   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\extras.pyRD      s   iN   c   	      C  s  d d l  } g  } x t |   D] } | j |  } | d k sL | d k rU d } n* | d k ry | rp d } q d } n d } t j   } t |  | _ d | _ d | _ | | _	 | | _
 | j |  q Wt j | t d  t j j j | | d | d t  t j |  S(	   s  
    Wraps the unicode string `s`, and returns a list of strings.

    `width`
        The number of half-width characters that fit on a line.
    `asian`
        True if we should make ambiguous width characters full-width, as is
        done in Asian encodings.
    iNt   Ft   Wi   t   Ai
   i   (   t   unicodedataR*   t   east_asian_widthR(   t   Glypht   ordt	   charactert   ascentt   line_spacingt   widtht   advanceR/   t   annotate_unicodeR'   R!   R9   t   texwrapt   linebreak_text   linebreak_list(	   R   Rb   t   asianR[   t   glyphst   ct   eawt   gwidtht   g(    (    sj   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\extras.pyt   textwrap   s*    							$(   t
   __future__R    t
   renpy.textR!   t   renpy.text.textsupportR   R   R9   R(   R   RV   R'   R    R:   R1   RC   t   objectRD   Rn   (    (    (    sj   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\extras.pyt   <module>   s@   	
	;.(