Example #1
0
File: _pre.py Project: andreif/dmsl
def parse_inlines(s):
    if u':' not in s:
        return s, ''
    
    l = []
    inline = parse_inline(s, 0)
    i = 0
    while inline != u'':
        s = s.replace(u':'+inline, u'{'+str(i)+u'}')
        l.append(inline)
        inline = parse_inline(s, 0)
        i += 1
    l = u','.join(l)
    if l != u'':
        l += u','
    return s, l
Example #2
0
def parse_inlines(s):
    if u':' not in s:
        return s, ''

    l = []
    inline = parse_inline(s, 0)
    i = 0
    while inline != u'':
        s = s.replace(u':' + inline, u'{' + str(i) + u'}')
        l.append(inline)
        inline = parse_inline(s, 0)
        i += 1
    l = u','.join(l)
    if l != u'':
        l += u','
    return s, l
Example #3
0
def parse_inline(s, i):
    if u':' in s:
        a = s.index(u':', i)
    else:
        return u''
    if u'(' in s:
        b = s.index(u'(')
    else:
        return u''
    if u' ' in s[a:b] or a > b: # check a>b for attributes that have :
        try:
            a = s.index(u':', a+1)
            parse_inline(s, a)
        except ValueError:
            return u''

    c = s.index(u')')+1
    return s[a+1:c]
Example #4
0
def parse_inline(s, i):
    if u':' in s:
        a = s.index(u':', i)
    else:
        return u''
    if u'(' in s:
        b = s.index(u'(')
    else:
        return u''
    if u' ' in s[a:b] or a > b:  # check a>b for attributes that have :
        try:
            a = s.index(u':', a + 1)
            parse_inline(s, a)
        except ValueError:
            return u''

    c = s.index(u')') + 1
    return s[a + 1:c]