From f0ac7c065375c1a94f84324a0c362768ffc431ec Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 15 Mar 2021 11:29:52 +0530 Subject: [PATCH] DRYer --- src/pyj/read_book/annotations.pyj | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pyj/read_book/annotations.pyj b/src/pyj/read_book/annotations.pyj index cb7718d55e..00cd98a4f2 100644 --- a/src/pyj/read_book/annotations.pyj +++ b/src/pyj/read_book/annotations.pyj @@ -13,13 +13,15 @@ no_cfi = '/99999999' def bookmark_get_cfi(b): if b.pos_type is 'epubcfi': return b.pos[8:-1] + return no_cfi def highlight_get_cfi(hl): cfi = hl.start_cfi if cfi: - si = hl.spine_index or 9999999999 - return f'/{si}/{cfi}' + si = f'/{hl.spine_index}' if hl.spine_index? else no_cfi + return f'{si}/{cfi}' + return no_cfi def sort_annot_list(annots, get_cfi_func):