From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.

#/* Configuration DrTrigonBot */



#/* subster: postproc */



# create linked list in wiki format (shortcut and compatibility)

# syntax: ('wikilinkedlist', regex)

wikilinkedlist = lambda DATA, regex: formatedlist(DATA, regex, "* [[%s]]")



# create list in generic format (e.g. for sumcatdisc)

# syntax: ('formatedlist', regex, format [, sep])

def formatedlist(DATA, regex, format, sep="\n"):

    comp      = re.compile(regex, re.S | re.I)

    data_list = comp.findall(DATA0])

    if comp.groupindex:

        data_list =  dict([ (j, itemcomp.groupindexj-1]) for j in comp.groupindex ])

                          #+[ (str(j+1), itemj]) for j in range(len(comp.groupindex)) ])

                      for item in data_list 

        format    = re.sub(r'\\g\<(.*?)\>', r'%(\g<1>)s', format)

    DATA0 = sep.join(map(lambda x: format % x, data_list))



# create list in generic format from generic text matrix/table

# syntax: ('formatedlist_frommatrix', regex, format, cols, head, check [, types])

def formatedlist_frommatrix(DATA, regex, format, cols, head, check, types=[]):

    types     = dict(types)

    data_list = []

    for line in DATA0.splitlines()[head:]:

        line = re.search(regex, line).groups()

        if not check(line): continue

        data_list.append( format % tuple([types.get(i, str)(linei.strip()) for i in cols]) )

    DATA0 = "\n".join(data_list)



# syntax: ('formatedlist_frommatrix', regex, format, head, check [, types])

def _formatedlist_frommatrix(DATA, regex, format, head, check, types=[]):

    types     = dict(types)

    data_list = []

    for line in DATA0.splitlines()[head:]:

        comp = re.compile(regex)

        line = comp.search(line)

        line = dict([ (k, types.get(k, str)(line.group(k))) for k in comp.groupindex ])

        if check(line):

            data_list.append( format % line )

    DATA0 = "\n".join(data_list)



# remove or replace all occurences of regex in text (re.sub wrapper)

# syntax: ('replacetext', regex [, sub [, flags])

def replacetext(DATA, regex, sub=u'', flags=re.M):

    #DATA0 = re.sub(regex, sub, DATA0], flags=flags)

    DATA0 = re.compile(regex, flags=flags).sub(sub, DATA0])



# reverse the list given to change sorting order (list.reverse)

# syntax: ('reverselist',)

def reverselist(DATA):

    lines = DATA0.splitlines()

    lines.reverse()

    DATA0 = "\n".join(lines)



# allow to chain multiple postproc functions and combine them

# syntax: ('chain', postprocs [, index])

def chain(DATA, postprocs, index=0):

    for item in postprocs:

        DATA.append(DATA0])

        eval(item0])( *((DATA,) + item1:]) )

    DATA0 = DATAindex
From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.

#/* Configuration DrTrigonBot */



#/* subster: postproc */



# create linked list in wiki format (shortcut and compatibility)

# syntax: ('wikilinkedlist', regex)

wikilinkedlist = lambda DATA, regex: formatedlist(DATA, regex, "* [[%s]]")



# create list in generic format (e.g. for sumcatdisc)

# syntax: ('formatedlist', regex, format [, sep])

def formatedlist(DATA, regex, format, sep="\n"):

    comp      = re.compile(regex, re.S | re.I)

    data_list = comp.findall(DATA0])

    if comp.groupindex:

        data_list =  dict([ (j, itemcomp.groupindexj-1]) for j in comp.groupindex ])

                          #+[ (str(j+1), itemj]) for j in range(len(comp.groupindex)) ])

                      for item in data_list 

        format    = re.sub(r'\\g\<(.*?)\>', r'%(\g<1>)s', format)

    DATA0 = sep.join(map(lambda x: format % x, data_list))



# create list in generic format from generic text matrix/table

# syntax: ('formatedlist_frommatrix', regex, format, cols, head, check [, types])

def formatedlist_frommatrix(DATA, regex, format, cols, head, check, types=[]):

    types     = dict(types)

    data_list = []

    for line in DATA0.splitlines()[head:]:

        line = re.search(regex, line).groups()

        if not check(line): continue

        data_list.append( format % tuple([types.get(i, str)(linei.strip()) for i in cols]) )

    DATA0 = "\n".join(data_list)



# syntax: ('formatedlist_frommatrix', regex, format, head, check [, types])

def _formatedlist_frommatrix(DATA, regex, format, head, check, types=[]):

    types     = dict(types)

    data_list = []

    for line in DATA0.splitlines()[head:]:

        comp = re.compile(regex)

        line = comp.search(line)

        line = dict([ (k, types.get(k, str)(line.group(k))) for k in comp.groupindex ])

        if check(line):

            data_list.append( format % line )

    DATA0 = "\n".join(data_list)



# remove or replace all occurences of regex in text (re.sub wrapper)

# syntax: ('replacetext', regex [, sub [, flags])

def replacetext(DATA, regex, sub=u'', flags=re.M):

    #DATA0 = re.sub(regex, sub, DATA0], flags=flags)

    DATA0 = re.compile(regex, flags=flags).sub(sub, DATA0])



# reverse the list given to change sorting order (list.reverse)

# syntax: ('reverselist',)

def reverselist(DATA):

    lines = DATA0.splitlines()

    lines.reverse()

    DATA0 = "\n".join(lines)



# allow to chain multiple postproc functions and combine them

# syntax: ('chain', postprocs [, index])

def chain(DATA, postprocs, index=0):

    for item in postprocs:

        DATA.append(DATA0])

        eval(item0])( *((DATA,) + item1:]) )

    DATA0 = DATAindex

Videos

Youtube | Vimeo | Bing

Websites

Google | Yahoo | Bing

Encyclopedia

Google | Yahoo | Bing

Facebook