Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Editor

Notices

Reply
 
Thread Tools Search this Thread
Old 07-09-2021, 09:25 AM   #1
jiembe
Zealot
jiembe began at the beginning.
 
Posts: 142
Karma: 10
Join Date: Sep 2016
Location: Montréal Québec
Device: Kobo Glo; Kobo Libra
Can't replace space with no-break space with my function since 5.23

I had a function for replacing some spaces with no-break spaces looking like this snippet:

return match.group().replace(' ;', ' ;')

where: left a normal space, right a no-break space

but now I don't get any changes with version 5.23 (I didn't try 5.22).

What's change in Calibre and how can it make working?
jiembe is offline   Reply With Quote
Old 07-09-2021, 09:30 AM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,307
Karma: 27111242
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
There werent any changes to the editor search replace in 5.23, what version did you update from and post the full function
kovidgoyal is online now   Reply With Quote
Advert
Old 07-09-2021, 09:34 AM   #3
jiembe
Zealot
jiembe began at the beginning.
 
Posts: 142
Karma: 10
Join Date: Sep 2016
Location: Montréal Québec
Device: Kobo Glo; Kobo Libra
Quote:
Originally Posted by kovidgoyal View Post
There werent any changes to the editor search replace in 5.23, what version did you update from and post the full function
From 5.21.

def replace(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs):

return match.group().replace(' ?','*?').replace(' !','*!').replace(' ;','*;').replace(' :','*:').replace(' »','*»').replace('« ','«*')

(This present editor change the no-break space with an * as you can see)

the search string is <.*?>
jiembe is offline   Reply With Quote
Old 07-09-2021, 11:42 AM   #4
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,307
Karma: 27111242
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I'm confused are you saying the function definition has changed?
kovidgoyal is online now   Reply With Quote
Old 07-09-2021, 11:47 AM   #5
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,307
Karma: 27111242
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I tried creating a function that replaces spaces with nbsps and it works fine for me.
kovidgoyal is online now   Reply With Quote
Advert
Old 07-09-2021, 01:00 PM   #6
jiembe
Zealot
jiembe began at the beginning.
 
Posts: 142
Karma: 10
Join Date: Sep 2016
Location: Montréal Québec
Device: Kobo Glo; Kobo Libra
Quote:
Originally Posted by kovidgoyal View Post
I'm confused are you saying the function definition has changed?
Sorry I was unclear. The message editor of the present forum change the no-break space in my example to *. The real function is still composed of some no-break space.

Just forget all. It was my search string which was wrong.
jiembe is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
No break space and alignment roger64 ePub 40 11-24-2019 11:29 PM
Representing the no-break space roger64 Sigil 11 08-09-2017 02:09 AM
Narrow No-Break Space display roger64 Sigil 6 12-20-2012 02:43 PM
Narrow No-Break Space and commercial support. roger64 ePub 8 09-04-2012 01:08 PM
Is it possible to define rules for non break space? habanr Conversion 4 02-22-2011 07:36 AM


All times are GMT -4. The time now is 06:28 AM.


MobileRead.com is a privately owned, operated and funded community.