mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Column coloring: Add a contains rules type. Fixes #1728464 [Enhancement - allow character match in rules](https://bugs.launchpad.net/calibre/+bug/1728464)
This commit is contained in:
parent
e0128dd60d
commit
d7282a8f00
@ -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'),
|
||||
|
@ -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))
|
||||
|
||||
# }}}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user