diff --git a/mwparserfromhell/nodes/template.py b/mwparserfromhell/nodes/template.py index 9da2295..1880680 100644 --- a/mwparserfromhell/nodes/template.py +++ b/mwparserfromhell/nodes/template.py @@ -59,14 +59,14 @@ class Template(Node): return True return False - def get_param(self, name): + def get(self, name): name = name.strip() if isinstance(name, basestring) else unicode(name) for param in self.params: if param.name.strip() == name: return param raise ValueError(name) - def add_param(self, name, value, showkey=None): + def add(self, name, value, showkey=None): name, value = parse_anything(name), parse_anything(value) surface_text = value.filter_text(recursive=False) for node in surface_text: @@ -93,7 +93,7 @@ class Template(Node): else: self.params.append(Parameter(name, value, showkey)) # CONFORM TO FORMATTING CONVENTIONS? - def remove_param(self, name, keep_field=False): # DON'T MESS UP NUMBERING WITH show_key = False AND keep_field = False + def remove(self, name, keep_field=False): # DON'T MESS UP NUMBERING WITH show_key = False AND keep_field = False name = name.strip() if isinstance(name, basestring) else unicode(name) for param in self.params: if param.name.strip() == name: diff --git a/mwparserfromhell/string_mixin.py b/mwparserfromhell/string_mixin.py index cc0a63b..7f6fae5 100644 --- a/mwparserfromhell/string_mixin.py +++ b/mwparserfromhell/string_mixin.py @@ -33,32 +33,32 @@ class StringMixIn(object): raise NotImplementedError() def __lt__(self, other): - if isinstance(other, StringMixin): + if isinstance(other, StringMixIn): return unicode(self) < unicode(other) return unicode(self) < other def __le__(self, other): - if isinstance(other, StringMixin): + if isinstance(other, StringMixIn): return unicode(self) <= unicode(other) return unicode(self) <= other def __eq__(self, other): - if isinstance(other, StringMixin): + if isinstance(other, StringMixIn): return unicode(self) == unicode(other) return unicode(self) == other def __ne__(self, other): - if isinstance(other, StringMixin): + if isinstance(other, StringMixIn): return unicode(self) != unicode(other) return unicode(self) != other def __gt__(self, other): - if isinstance(other, StringMixin): + if isinstance(other, StringMixIn): return unicode(self) > unicode(other) return unicode(self) > other def __ge__(self, other): - if isinstance(other, StringMixin): + if isinstance(other, StringMixIn): return unicode(self) >= unicode(other) return unicode(self) >= other @@ -82,3 +82,6 @@ class StringMixIn(object): def replace(self, old, new, count): return unicode(self).replace(old, new, count) + + def strip(self, chars=None): + return unicode(self).strip(chars)