mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
.format() to f-string from previous PR
This commit is contained in:
parent
9c5e88c332
commit
0b4a3a8661
@ -80,7 +80,7 @@ def remove_kindlegen_markup(parts, aid_anchor_suffix, linked_aids):
|
||||
aid = None
|
||||
replacement = ''
|
||||
if aid in linked_aids:
|
||||
replacement = ' id="{}"'.format(aid + '-' + aid_anchor_suffix)
|
||||
replacement = f' id="{aid + "-" + aid_anchor_suffix}"'
|
||||
tag = within_tag_aid_position_pattern.sub(replacement, tag, 1)
|
||||
srcpieces[j] = tag
|
||||
part = ''.join(srcpieces)
|
||||
@ -150,7 +150,7 @@ def update_flow_links(mobi8_reader, resource_map, log):
|
||||
num = int(m.group(1), 32)
|
||||
href = resource_map[num-1]
|
||||
if href:
|
||||
replacement = '"{}"'.format('../'+ href)
|
||||
replacement = f'"{"../"+ href}"'
|
||||
tag = img_index_pattern.sub(replacement, tag, 1)
|
||||
else:
|
||||
log.warn(f'Referenced image {num} was not recognized '
|
||||
@ -168,7 +168,7 @@ def update_flow_links(mobi8_reader, resource_map, log):
|
||||
num = int(m.group(1), 32)
|
||||
href = resource_map[num-1]
|
||||
if href:
|
||||
replacement = '"{}"'.format('../'+ href)
|
||||
replacement = f'"{"../"+ href}"'
|
||||
tag = url_img_index_pattern.sub(replacement, tag, 1)
|
||||
else:
|
||||
log.warn(f'Referenced image {num} was not recognized as a '
|
||||
@ -182,9 +182,9 @@ def update_flow_links(mobi8_reader, resource_map, log):
|
||||
log.warn(f'Referenced font {num} was not recognized as a '
|
||||
f'valid font in {tag}')
|
||||
else:
|
||||
replacement = '"{}"'.format('../'+ href)
|
||||
replacement = f'"{"../"+ href}"'
|
||||
if href.endswith('.failed'):
|
||||
replacement = '"{}"'.format('failed-'+href)
|
||||
replacement = f'"{"failed-"+href}"'
|
||||
tag = font_index_pattern.sub(replacement, tag, 1)
|
||||
|
||||
# process links to other css pieces
|
||||
@ -280,7 +280,7 @@ def insert_images_into_markup(parts, resource_map, log):
|
||||
except IndexError:
|
||||
href = ''
|
||||
if href:
|
||||
replacement = '"{}"'.format('../' + href)
|
||||
replacement = f'"{"../" + href}"'
|
||||
tag = img_index_pattern.sub(replacement, tag, 1)
|
||||
else:
|
||||
log.warn(f'Referenced image {num} was not recognized as '
|
||||
|
Loading…
x
Reference in New Issue
Block a user