예제 #1
0
 def __getitem__(self, args):
     if not isinstance(args, (tuple, list)):
         args = (args, )
     newchildren = self._children[:]
     stuff = [(x, stan.raw(',')) for x in args]
     if stuff:
         stuff[-1] = stuff[-1][0]
     newchildren.extend([stan.raw("["), stuff, stan.raw("]")])
     return self.__class__(newchildren)
예제 #2
0
 def __getitem__(self, args):
     if not isinstance(args, (tuple, list)):
         args = (args,)
     newchildren = self._children[:]
     stuff = [(x, stan.raw(',')) for x in args]
     if stuff:
         stuff[-1] = stuff[-1][0]
     newchildren.extend([stan.raw("["), stuff, stan.raw("]")])
     return self.__class__(newchildren)
예제 #3
0
파일: livepage.py 프로젝트: calston/tums
def anonymous(block):
    """Turn block (any stan) into an anonymous JavaScript function
    which takes no arguments. Equivalent to

    function () {
        block
    }
    """
    return _js([stan.raw("function() {\n"), block, stan.raw("\n}")])
예제 #4
0
def anonymous(block):
    """Turn block (any stan) into an anonymous JavaScript function
    which takes no arguments. Equivalent to

    function () {
        block
    }
    """
    return _js([stan.raw("function() {\n"), block, stan.raw("\n}")])
예제 #5
0
 def __call__(self, *args):
     if not self._children:
         return self.__class__(args[0])
     newchildren = self._children[:]
     stuff = []
     for x in args:
         if isinstance(x, (basestring, stan.Tag, types.FunctionType,
                           types.MethodType, types.UnboundMethodType)):
             x = stan.raw("'"), SingleQuote(x), stan.raw("'")
         stuff.append((x, stan.raw(',')))
     if stuff:
         stuff[-1] = stuff[-1][0]
     newchildren.extend([stan.raw('('), stuff, stan.raw(')')])
     return self.__class__(newchildren)
예제 #6
0
 def __call__(self, *args):
     if not self._children:
         return self.__class__(args[0])
     newchildren = self._children[:]
     stuff = []
     for x in args:
         if isinstance(x, (
             basestring, stan.Tag, types.FunctionType,
             types.MethodType, types.UnboundMethodType)):
             x = stan.raw("'"), SingleQuote(x), stan.raw("'")
         stuff.append((x, stan.raw(',')))
     if stuff:
         stuff[-1] = stuff[-1][0]
     newchildren.extend([stan.raw('('), stuff, stan.raw(')')])
     return self.__class__(newchildren)
예제 #7
0
 def fromString(klass, st):
     scheme, netloc, path, query, fragment = urlparse.urlsplit(st)
     u = klass(
         scheme, netloc,
         [raw(urllib.unquote(seg)) for seg in path.split('/')[1:]],
         unquerify(query), fragment)
     return u
예제 #8
0
 def __getattr__(self, name):
     if name == 'clone':
         raise RuntimeError("Can't clone")
     if self._children:
         newchildren = self._children[:]
         newchildren.append(stan.raw('.' + name))
         return self.__class__(newchildren)
     return self.__class__(name)
예제 #9
0
 def __getattr__(self, name):
     if name == 'clone':
         raise RuntimeError("Can't clone")
     if self._children:
         newchildren = self._children[:]
         newchildren.append(stan.raw('.'+name))
         return self.__class__(newchildren)
     return self.__class__(name)
예제 #10
0
파일: url.py 프로젝트: UstadMobile/eXePUB
def _uqf(query):
    for x in query.split('&'):
        if '=' in x:
            yield tuple([raw(urllib.unquote(s)) for s in x.split('=')])
        elif x:
            yield (raw(urllib.unquote(x)), None)
예제 #11
0
def var(where, what):
    """Define local variable 'where' and assign 'what' to it.
    Equivalent to var where = what;
    """
    return _js([stan.raw("var "), where, stan.raw(" = "), what, stan.raw(";")])
예제 #12
0
def assign(where, what):
    """Assign what to where. Equivalent to
    where = what;
    """
    return _js([where, stan.raw(" = "), what])
예제 #13
0
 def __init__(self, name=None):
     if name is None:
         name = []
     if isinstance(name, str):
         name = [stan.raw(name)]
     self._children = name
예제 #14
0
 def __init__(self, name=None):
     if name is None:
         name = []
     if isinstance(name, str):
         name = [stan.raw(name)]
     self._children = name
예제 #15
0
def _uqf(query):
    for x in query.split("&"):
        if "=" in x:
            yield tuple([raw(urllib.unquote(s)) for s in x.split("=")])
        elif x:
            yield (raw(urllib.unquote(x)), None)
예제 #16
0
def assign(where, what):
    """Assign what to where. Equivalent to
    where = what;
    """
    return _js([where, stan.raw(" = "), what])
예제 #17
0
def _uqf(query):
    for x in query.split('&'):
        if '=' in x:
            yield tuple( [raw(urllib.unquote(s)) for s in x.split('=')] )
        elif x:
            yield (raw(urllib.unquote(x)), None)
예제 #18
0
파일: Snom.py 프로젝트: calston/tums
 def returnEntry(ret=None):
     print data
     if data:
         return stan.raw(snomDevConf % data)
     return ""
예제 #19
0
def var(where, what):
    """Define local variable 'where' and assign 'what' to it.
    Equivalent to var where = what;
    """
    return _js([stan.raw("var "), where, stan.raw(" = "), what, stan.raw(";")])
예제 #20
0
파일: url.py 프로젝트: UstadMobile/eXePUB
 def fromString(klass, st):
     scheme, netloc, path, query, fragment = urlparse.urlsplit(st)
     u = klass(scheme, netloc,
               [raw(urllib.unquote(seg)) for seg in path.split('/')[1:]],
               unquerify(query), fragment)
     return u
예제 #21
0
    def render_raw_header(self, ctx, data):
        """Render the top raw header."""
        return stan.raw('''\
<!--[if gte IE 5.5000]>
  <script type="text/javascript" src="/js/pngfix.js"></script>
<![endif]-->''')