+def texcommand(context, text):
+ """Remove non-letters"""
+ if isinstance(text, list):
+ text = ''.join(text)
+ return re.sub(r'[^a-zA-Z]', '', text).strip()
+
+
+def reg_texcommand():
+ _register_function(texcommand)
+
+
+def reg_get(format_):
+ def get(context, *args):
+ obj = format_
+ for arg in args:
+ if hasattr(obj, arg):
+ obj = getattr(obj, arg)
+ else:
+ try:
+ obj = obj[arg]
+ except (TypeError, KeyError), e:
+ # Just raise proper AttributeError.
+ getattr(obj, arg)
+ return obj
+ _register_function(get)