diff --git a/src/calibre/gui2/preferences/coloring.py b/src/calibre/gui2/preferences/coloring.py index 6ac9d9e743..3c9aefe452 100644 --- a/src/calibre/gui2/preferences/coloring.py +++ b/src/calibre/gui2/preferences/coloring.py @@ -79,6 +79,8 @@ class ConditionEditor(QWidget): # {{{ 'single' : ( (_('is'), 'is'), (_('is not'), 'is not'), + (_('contains'), 'contains'), + (_('does not contain'), 'does not contain'), (_('matches pattern'), 'matches pattern'), (_('does not match pattern'), 'does not match pattern'), (_('is set'), 'is set'), diff --git a/src/calibre/library/coloring.py b/src/calibre/library/coloring.py index b4ffad297e..7d1df7823b 100644 --- a/src/calibre/library/coloring.py +++ b/src/calibre/library/coloring.py @@ -199,6 +199,10 @@ class Rule(object): # {{{ return "contains(field('%s'), \"%s\", '1', '')"%(col, val) if action == 'does not match pattern': return "contains(field('%s'), \"%s\", '', '1')"%(col, val) + if action == 'contains': + return "contains(field('%s'), \"%s\", '1', '')"%(col, re.escape(val)) + if action == 'does not contain': + return "contains(field('%s'), \"%s\", '', '1')"%(col, re.escape(val)) # }}}