From 35cd0190667f0b73dd0eafef3558038d7ed511e4 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 19 Nov 2014 14:21:49 +0530 Subject: [PATCH] ... --- src/calibre/ebooks/oeb/polish/utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/calibre/ebooks/oeb/polish/utils.py b/src/calibre/ebooks/oeb/polish/utils.py index b196d7341f..fc3d067af6 100644 --- a/src/calibre/ebooks/oeb/polish/utils.py +++ b/src/calibre/ebooks/oeb/polish/utils.py @@ -172,12 +172,12 @@ def parse_css(data, fname='', is_declaration=False, decode=None, log_lev data = parser.parseString(data, href=fname, validate=False) return data -def apply_func_to_match_groups(match, func): +def apply_func_to_match_groups(match, func=icu_upper): '''Apply the specified function to individual groups in the match object (the result of re.search() or the whole match if no groups were defined. Returns the replaced string.''' found_groups = False i = 0 - parts, pos = [], 0 + parts, pos = [], match.start() while True: i += 1 try: @@ -191,6 +191,6 @@ def apply_func_to_match_groups(match, func): pos = end if not found_groups: return func(match.group()) - parts.append(match.string[pos:]) + parts.append(match.string[pos:match.end()]) return ''.join(parts)