mirror of
https://github.com/beetbox/beets.git
synced 2025-12-28 11:32:30 +01:00
Enhance %title (#3059)
Use string.capwords in %title to lower char after apostrophe
This commit is contained in:
parent
b380a4c9a3
commit
fa1037ee28
3 changed files with 9 additions and 2 deletions
|
|
@ -23,6 +23,7 @@ import unicodedata
|
|||
import time
|
||||
import re
|
||||
import six
|
||||
import string
|
||||
|
||||
from beets import logging
|
||||
from beets.mediafile import MediaFile, UnreadableFileError
|
||||
|
|
@ -1456,7 +1457,7 @@ class DefaultTemplateFunctions(object):
|
|||
@staticmethod
|
||||
def tmpl_title(s):
|
||||
"""Convert a string to title case."""
|
||||
return s.title()
|
||||
return string.capwords(s)
|
||||
|
||||
@staticmethod
|
||||
def tmpl_left(s, chars):
|
||||
|
|
|
|||
|
|
@ -103,7 +103,9 @@ Fixes:
|
|||
Thanks to :user:`TaizoSimpson`.
|
||||
:bug:`3501`
|
||||
* Confusing typo when the convert plugin copies the art covers. :bug:`3063`
|
||||
|
||||
* The ``%title`` template function now works correctly with apostrophes.
|
||||
Thanks to :user:`GuilhermeHideki`.
|
||||
:bug:`3033`
|
||||
|
||||
.. _python-itunes: https://github.com/ocelma/python-itunes
|
||||
|
||||
|
|
|
|||
|
|
@ -589,6 +589,10 @@ class DestinationFunctionTest(_common.TestCase, PathFormattingMixin):
|
|||
self._setf(u'%title{$title}')
|
||||
self._assert_dest(b'/base/The Title')
|
||||
|
||||
def test_title_case_variable_aphostrophe(self):
|
||||
self._setf(u'%title{I can\'t}')
|
||||
self._assert_dest(b'/base/I Can\'t')
|
||||
|
||||
def test_asciify_variable(self):
|
||||
self._setf(u'%asciify{ab\xa2\xbdd}')
|
||||
self._assert_dest(b'/base/abC_ 1_2 d')
|
||||
|
|
|
|||
Loading…
Reference in a new issue