MCPcopy Index your code
hub / github.com/HelloZeroNet/ZeroNet / replacer

Method replacer

src/Translate/Translate.py:112–122  ·  view source on GitHub ↗
(match)

Source from the content-addressed store, hash-verified

110 patterns.append(re.escape(key))
111
112 def replacer(match):
113 target = translate_table[match.group(1)]
114 if mode == "js":
115 if target and target[0] == "|": # Strict string match
116 if match.string[match.start() - 2] == "_": # Only if the match if called between _(" ") function
117 return '"' + target[1:] + '"'
118 else:
119 return '"' + match.group(1) + '"'
120 return '"' + target + '"'
121 else:
122 return match.group(0)[0] + target + match.group(0)[-1]
123
124 if mode == "html":
125 pattern = '[">](' + "|".join(patterns) + ')["<]'

Callers

nothing calls this directly

Calls 1

startMethod · 0.45

Tested by

no test coverage detected