mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
start_cfi startswith / so dont create a double slash
Also fix tests for highlight sorting
This commit is contained in:
parent
6595e00a19
commit
95ef1423d4
@ -20,7 +20,7 @@ def highlight_get_cfi(hl):
|
||||
cfi = hl.start_cfi
|
||||
if cfi:
|
||||
si = f'/{hl.spine_index}' if hl.spine_index? else no_cfi
|
||||
return f'{si}/{cfi}'
|
||||
return f'{si}{cfi}'
|
||||
return no_cfi
|
||||
|
||||
|
||||
|
@ -8,15 +8,15 @@ from testing import assert_equal, test, assert_true
|
||||
|
||||
def bm(title, bmid, year=20, first_cfi_number=1):
|
||||
return {
|
||||
'title': title, 'id': bmid, 'timestamp': str.format('20{}-06-29T03:21:48.895323+00:00', year),
|
||||
'title': title, 'id': bmid, 'timestamp': f'20{year}-06-29T03:21:48.895323+00:00',
|
||||
'pos_type': 'epubcfi', 'pos': str.format('epubcfi(/{}/4/8)', first_cfi_number)
|
||||
}
|
||||
|
||||
|
||||
def hl(uuid, hlid, year=20, first_cfi_number=1):
|
||||
return {
|
||||
'uuid': uuid, 'id': hlid, 'timestamp': str.format('20{}-06-29T03:21:48.895323+00:00', year),
|
||||
'start_cfi': str.format('epubcfi(/{}/4/8)', first_cfi_number)
|
||||
'uuid': uuid, 'id': hlid, 'timestamp': f'20{year}-06-29T03:21:48.895323+00:00',
|
||||
'start_cfi': '/4/8', 'spine_index': first_cfi_number
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user