#!/usr/bin/python
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2011 Sebastien Helleu <flashcode@flashtux.org>
+# color.py - remove/replace colors in WeeChat strings
+#
+# Copyright (C) 2011-2013 Sebastien Helleu <flashcode@flashtux.org>
#
# This file is part of QWeeChat, a Qt remote GUI for WeeChat.
#
# along with QWeeChat. If not, see <http://www.gnu.org/licenses/>.
#
-#
-# Remove or replace colors in WeeChat strings.
-#
-
import re
RE_COLOR_ATTRS = r'[*!/_|]*'
else:
return RE_COLOR.sub(self._convert_color, text)
- def remove(self, text):
- """Remove colors in a WeeChat string."""
- if not text:
- return ''
- return re.sub(RE_COLOR, '', text)
+def remove(text):
+ """Remove colors in a WeeChat string."""
+ if not text:
+ return ''
+ return re.sub(RE_COLOR, '', text)