Ejemplo n.º 1
0
def init_new_player(player):
    """
    Deprecated.
    """
    from evennia.utils import logger

    logger.log_dep("evennia.utils.utils.init_new_player is DEPRECATED and should not be used.")
Ejemplo n.º 2
0
def parse_inlinefunc(text, strip=False, session=None):
    """
    Parse inline function-replacement.

    Args:
        text (str): Text to parse.
        strip (bool, optional): Remove all supported inlinefuncs from text.
        session (bool): Session calling for the parsing.

    Returns:
        text (str): Parsed text with processed results of
            inlinefuncs.

    """

    if strip:
        # strip all functions
        return _FUNCCLEAN_REGEX.sub("", text)

    stack = []
    for part in _FUNCSPLIT_REGEX.split(text):
        endtag = _FUNCEND_REGEX.match(part)
        if endtag:
            # an end tag
            endname = endtag.group(1)
            while stack:
                new_part = stack.pop()
                part = new_part + part  # add backwards -> fowards
                starttag = _FUNCSTART_REGEX.match(new_part)
                if starttag:
                    startname = starttag.group(1)
                    if startname == endname:
                        part = _execute_inline_function(startname, part, session)
                        break
        stack.append(part)
    # handle single functions without matching end tags; these are treated
    # as being called with an empty string as text argument.
    outstack = []
    for part in _FUNCSPLIT_REGEX.split("".join(stack)):
        starttag = _FUNCSTART_REGEX.match(part)
        if starttag:
            logger.log_dep("The {func()-style inlinefunc is deprecated. Use the $func{} form instead.")
            startname = starttag.group(1)
            part = _execute_inline_single_function(startname, part, session)
        outstack.append(part)

    return "".join(outstack)
Ejemplo n.º 3
0
def init_new_player(player):
    """
    Deprecated.
    """
    from evennia.utils import logger
    logger.log_dep("evennia.utils.utils.init_new_player is DEPRECATED and should not be used.")