mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-30 01:25:36 +01:00
Merge from trunk
This commit is contained in:
commit
81ad8235da
1 changed files with 9 additions and 1 deletions
|
|
@ -717,10 +717,18 @@ def evaluate(self, formatter, kwargs, mi, locals, val, start_index, end_index):
|
|||
return ''
|
||||
si = int(start_index)
|
||||
ei = int(end_index)
|
||||
has_periods = '.' in val
|
||||
items = [v.strip() for v in val.split(',')]
|
||||
rv = set()
|
||||
if has_periods:
|
||||
pp = re.compile(r'(?<=[^\.\s])\.(?=[^\.\s])', re.U)
|
||||
else:
|
||||
pp = None
|
||||
for item in items:
|
||||
components = re.split(r'(?<=[^\.\s])\.(?=[^\.\s])', item, flags=re.U)
|
||||
if has_periods and '.' in item:
|
||||
components = pp.split(item)
|
||||
else:
|
||||
components = [item]
|
||||
try:
|
||||
if ei == 0:
|
||||
rv.add('.'.join(components[si:]))
|
||||
|
|
|
|||
Loading…
Reference in a new issue