View Single Post
Old 05-20-2022, 01:08 AM   #5
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.
Code:
p{    
font-weight: bolder; 
}
this is bolder all of text code in cailbre ,pls give me more help :谢谢:
evilone is offline   Reply With Quote