Update the escape_macros() function to deal with YAML style
Element.get() that may return datatypes other than str. This allows
for indiscriminately passing facets through the function without
recasting them.
"""Miscellaneous functions for the mudpy engine."""
"""Miscellaneous functions for the mudpy engine."""
-# Copyright (c) 2004-2015 Jeremy Stanley <fungi@yuggoth.org>. Permission
+# Copyright (c) 2004-2016 Jeremy Stanley <fungi@yuggoth.org>. Permission
# to use, copy, modify, and distribute this software is granted under
# terms provided in the LICENSE file distributed with this software.
# to use, copy, modify, and distribute this software is granted under
# terms provided in the LICENSE file distributed with this software.
-def escape_macros(text):
+def escape_macros(value):
"""Escapes replacement macros in text."""
"""Escapes replacement macros in text."""
- return text.replace("$(", "$_(")
+ if type(value) is str:
+ return value.replace("$(", "$_(")
+ else:
+ return value
def first_word(text, separator=" "):
def first_word(text, separator=" "):