05-19-2022, 08:12 AM | #1 |
Junior Member
Posts: 7
Karma: 10
Join Date: May 2022
Device: kindle kwp4
|
question:regex of bionic reading
I want to modify the ebook to bionic reading using CSS styles, but I can't write the regex.
Code:
p{ font-weight: bolder; } Code:
=ROUNDDOWN(LEN(A1)/2,0) Code:
Sub bold() For i = 1 To [a65536].End(xlUp).Row Cells(i, 1).Characters(1, 5).Font.bold = True Next End Sub pls help me Finish that Additional CSS |
05-19-2022, 10:06 AM | #2 |
Grand Sorcerer
Posts: 12,167
Karma: 73448616
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
|
If people want some background on this see https://www.mobileread.com/forums/sh...d.php?t=346904
Sent from my Pixel 4a using Tapatalk |
Advert | |
|
05-19-2022, 11:12 PM | #3 |
Grand Sorcerer
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
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 |
05-20-2022, 01:05 AM | #4 | |
Junior Member
Posts: 7
Karma: 10
Join Date: May 2022
Device: kindle kwp4
|
Quote:
|
|
05-20-2022, 01:08 AM | #5 | |
Junior Member
Posts: 7
Karma: 10
Join Date: May 2022
Device: kindle kwp4
|
Quote:
Code:
p{ font-weight: bolder; } |
|
Advert | |
|
05-20-2022, 03:20 AM | #6 | ||
Grand Sorcerer
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
Quote:
Quote:
As to my code, that is used in the calibre editor. It would allow you to change one book at a time to see if it works for you. It is a regex function that is used as part of the search and replace. With it, you do a search using the regex specified, and the function doe the replace side of. I would suggest you look at the help for the editor to see how to use it. If you still have problems after that, then ask questions. And my code is just a sample. It is what I thought of when I saw the page that is referred to above. It is an simplistic implementation that would only be good to get an idea of whether the Bionic Reading would work for you. Which I only did as a I was curious about whether I could. And I see lots of problems that I have no interest in solving as I don't have an interest in reading in that way. If this was to be done "properly" it would probably need to be in a plugin. And, as the Bionic Reading clearly states, there are Patents around it, so it should be licensed to use their API. Maybe someone will be interested in doing that. |
||
05-20-2022, 04:47 AM | #7 | |
Junior Member
Posts: 7
Karma: 10
Join Date: May 2022
Device: kindle kwp4
|
Quote:
|
|
05-21-2022, 06:46 AM | #8 | |
Junior Member
Posts: 7
Karma: 10
Join Date: May 2022
Device: kindle kwp4
|
Quote:
Code:
>[^<]+< Code:
\b(\w+)\b |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Bionic Reading implementation on Kobo? | jeff47 | Kobo Developer's Corner | 28 | 06-03-2022 09:54 AM |
pdf regex question - regex that wraps to a new line | flyash | Conversion | 1 | 09-05-2021 09:00 AM |
Regex question | theaccountant | Library Management | 0 | 11-07-2016 02:29 PM |
Regex help on reading Metadata from file name. | JohnnyBook | Library Management | 11 | 03-05-2015 07:35 PM |
RegEx question (again) | phossler | Sigil | 12 | 01-20-2013 02:37 PM |