Cleanup of examine, escape inlinefuncs. Resolve #2172

This commit is contained in:
Griatch 2020-07-18 15:51:29 +02:00
parent f7b4193c84
commit 7aa6883b94
5 changed files with 141 additions and 92 deletions

View file

@ -514,6 +514,17 @@ def parse_inlinefunc(string, strip=False, available_funcs=None, stacktrace=False
return retval
def raw(string):
"""
Escape all inlinefuncs in a string so they won't get parsed.
Args:
string (str): String with inlinefuncs to escape.
"""
def _escape(match):
return "\\" + match.group(0)
return _RE_STARTTOKEN.sub(_escape, string)
#
# Nick templating
#

View file

@ -1842,8 +1842,8 @@ def display_len(target):
strip MXP patterns.
Args:
target (string): A string with potential MXP components
to search.
target (any): Something to measure the length of. If a string, it will be
measured keeping asian-character and MXP links in mind.
Return:
int: The visible width of the target.