mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Tag Mapper: Allow Title-casing of tags. Fixes #1823097 [Feature Request: Tag Mapper Option - Title Case](https://bugs.launchpad.net/calibre/+bug/1823097)
This commit is contained in:
parent
6dd0f72bae
commit
7308f4073f
@ -82,6 +82,10 @@ def apply_rules(tag, rules):
|
||||
if ac == 'capitalize':
|
||||
ans.append(tag.capitalize())
|
||||
break
|
||||
if ac == 'titlecase':
|
||||
from calibre.utils.titlecase import titlecase
|
||||
ans.append(titlecase(tag))
|
||||
break
|
||||
if ac == 'lower':
|
||||
ans.append(icu_lower(tag))
|
||||
break
|
||||
@ -149,6 +153,7 @@ def find_tests():
|
||||
self.assertEqual(ans, expected)
|
||||
|
||||
run(rule('capitalize', 't1,t2'), 't1,x1', 'T1,x1')
|
||||
run(rule('titlecase', 'some tag'), 'some tag,x1', 'Some Tag,x1')
|
||||
run(rule('upper', 'ta,t2'), 'ta,x1', 'TA,x1')
|
||||
run(rule('lower', 'ta,x1'), 'TA,X1', 'ta,x1')
|
||||
run(rule('replace', 't1', 't2'), 't1,x1', 't2,x1')
|
||||
|
@ -47,6 +47,7 @@ class RuleEdit(QWidget):
|
||||
('replace', _('Replace')),
|
||||
('keep', _('Keep')),
|
||||
('capitalize', _('Capitalize')),
|
||||
('titlecase', _('Title-case')),
|
||||
('lower', _('Lower-case')),
|
||||
('upper', _('Upper-case')),
|
||||
('split', _('Split')),
|
||||
|
@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env python2
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
"""
|
||||
Original Perl version by: John Gruber https://daringfireball.net/ 10 May 2008
|
||||
|
Loading…
x
Reference in New Issue
Block a user