View Single Post
Old 05-20-2022, 01:05 AM   #4
evilone
Junior Member
evilone began at the beginning.
 
Posts: 7
Karma: 10
Join Date: May 2022
Device: kindle kwp4
Quote:
Originally Posted by davidfor View Post
As mentioned in the other thread, you could do it using a regex function in the editor. A quick and dirty one would be:

Code:
import math
def replace(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs):
    boldlen = math.ceil(len(match[0])/2)
    boldedword = '<b>' + match[0][:boldlen] + '</b>' + match[0][boldlen:]
    return boldedword
With the search as "\b\w+\b", it will make the changes. But, it does not distinguish between words in the text and tags. And doesn't handle if you have already made the changes.
I am sorry about that code can't run in my cailbre additional CSS, I don't have program konwlege,think your reply,Can you give me some more code to make sure the additional CSS works on cailbre
evilone is offline   Reply With Quote