Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/unkn0w7n/calibre
Browse files Browse the repository at this point in the history
  • Loading branch information
kovidgoyal committed Feb 12, 2025
2 parents de0b3b9 + 81544b2 commit 746bb82
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions recipes/barrons.recipe
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,26 @@ def make_hlinks(zx):
for ad in zx['body']['additions']:
if ad.get('type', '') == 'link':
strt = ad['rangeStart']
end = ad['rangeLength']
n_txt = otxt[strt : (strt + end)]
end = ad['rangeStart'] + ad['rangeLength']
n_txt = otxt[strt:end]
lnk = ad['value']
lnk_txt = f'<a href="{lnk}">{n_txt}</a>'
txt = txt.replace(n_txt, lnk_txt)
if zx['body'].get('inlineTextStyles'):
for sty in zx['body']['inlineTextStyles']:
if 'Italic' in sty['textStyle']['fontName']:
estrt = sty['rangeStart']
eend = sty['rangeLength']
etxt = otxt[estrt : (estrt + eend)]
eend = sty['rangeStart'] + sty['rangeLength']
etxt = otxt[estrt:eend]
em_txt = f'<em>{etxt}</em>'
txt = txt.replace(etxt, em_txt)
return txt
if 'Bold' in sty['textStyle']['fontName']:
bstrt = sty['rangeStart']
bend = sty['rangeStart'] + sty['rangeLength']
btxt = otxt[bstrt:bend]
b_txt = f'<b>{btxt}</b>'
txt = txt.replace(btxt, b_txt)
return txt.replace('\n\n', '<div>').replace('\n', '</div>')


def make_html(a):
Expand Down

0 comments on commit 746bb82

Please sign in to comment.