View Single Post
Old 02-06-2020, 08:30 PM   #1
omin
Enthusiast
omin began at the beginning.
 
Posts: 26
Karma: 10
Join Date: Feb 2020
Device: Boox Poke 3, prev Kindle Paperwhite 4
Can we run Function mode in Search & replace during the conversion process?

I came across an issue where if I had a list like this:
  • First item
  • Second Item
  • Third Item

after it's converted to MOBI in Calibre it's transformed to this:

  • First item

  • Second Item

  • Third Item

I realized that this is an issue with the Kindle and not the MOBI itself (I'm using MOBI and not AZW3 so that I can upload to Amazon Kindle and sync across devices).

I found a way to fix this by using the Function mode in Search & replace in the editor. However, I don't see the function mode for Search & replace in Common options > Search & replace. Am I missing something here? It seems intuitive to be able to run this automatically during the conversion process.

Thanks!

------------------------------------

Here's how to fix the bullet list spacing issue. I noticed that there are other people experiencing the same issue...
Find: <li.*?</li>
Function:
Code:
import re
def replace(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs):
    s = re.sub('<p[^>]*>', '', match.group())
    return re.sub('</p[^>]*>', '', s)
omin is offline   Reply With Quote