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 05-06-2016, 11:16 AM   #1
chaot
Head of lunatic asylum
chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.
 
chaot's Avatar
 
Posts: 349
Karma: 77620
Join Date: Jun 2012
Location: UTC +1
Device: Tolino Vision 3HD
Edit Book: Inconsistency in Differences between books



With F&R (Find and Replace) (in MR also called S&R (Search and Replace)) I want to reduce double spaces to one, with command Replace all. I repeated the procedure several times, waited, no changes!

Find: *SPACE**SPACE*
Replace: *SPACE*

Click image for larger version

Name:	Searching done_1212 occurrences.png
Views:	255
Size:	75.9 KB
ID:	148480
1212 occurrences

Click: See what changed

Click image for larger version

Name:	Calculating differences, please wait.png
Views:	227
Size:	21.3 KB
ID:	148481
Calculating differences, please wait This window does not appear!?

Click image for larger version

Name:	No changes found.png
Views:	247
Size:	18.1 KB
ID:	148478
No changes found In fact, there was also nothing changed.


My e-reader displays the locally occurring spaces in the words, but not the double spaces between.

A similar (cosmetic) procedure I have already done some time before, successfully carried out in another book, there were more than 150000 occurrences.

Interna: Roche (F)

Last edited by chaot; 05-17-2016 at 05:59 AM. Reason: add image Calculating differences, please wait
chaot is offline   Reply With Quote
Old 05-06-2016, 11:31 AM   #2
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,818
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
If in doubt, COPY (select, the ctrl-F) the search value (space pair), the underlying migt be another form of whitespace

REGEX \s\s might work, BUT it might also get line ends
theducks is offline   Reply With Quote
Advert
Old 05-06-2016, 12:36 PM   #3
chaot
Head of lunatic asylum
chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.
 
chaot's Avatar
 
Posts: 349
Karma: 77620
Join Date: Jun 2012
Location: UTC +1
Device: Tolino Vision 3HD
Quote:
REGEX \s\s might work, BUT it might also get line ends
I chose this approach.

Run Fix HTML - all files & Beautify all files

Find: \s\s
Replace: *SPACE*

Click image for larger version

Name:	Replaced 3494 occurrences.png
Views:	275
Size:	94.1 KB
ID:	148482
Replaced 3494 occurrences

Click image for larger version

Name:	Differences between books (example).png
Views:	227
Size:	271.8 KB
ID:	148483
Differences between books (excerpt)

Click image for larger version

Name:	Result: Optic confusion.png
Views:	232
Size:	99.9 KB
ID:	148486
Result: Optical confusion

Run again Fix HTML - all files & Beautify all files

Click image for larger version

Name:	Seems OK.png
Views:	239
Size:	81.0 KB
ID:	148485
Seems OK

Checkbook was before, during and after the procedure OK.

Or do you see/know something that I overlooked? Line end problems!?


Last edited by chaot; 05-17-2016 at 05:05 AM. Reason: add: Line end problems, example→excerpt
chaot is offline   Reply With Quote
Old 05-06-2016, 02:48 PM   #4
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,212
Karma: 16534894
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
Quote:
Originally Posted by chaot View Post
Or do you see/know something that I overlooked?
Something to be careful of with your regex is that you might end up replacing consecutive non-breaking-spaces with a plain space. That might be important if nbsps have been used to create vertical whitespace scenebreaks. E.g.
Before: <p>*nbsp**nbsp*</p>
After: <p>*plainspace*</p>

The 'Before' paragraph will look like a blank line. The 'After' will be completely invisible.
jackie_w is offline   Reply With Quote
Old 05-06-2016, 06:01 PM   #5
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,590
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
I think the pink blobs in the third shot probably indicate the presence of a 'special' space character. In codeview window, position the cursor immediately after a blob and the character details will be displayed at the right end of the status line.

What does the fourth shot look like in Preview - it appears to have a space between almost every character - but if that's what you want I guess it's OK.

To address the issue jackie-w raises you could try replacing the nbsp at line beginnings with a marker, do the global replace, and then replace the markers with nbsp.

BR
BetterRed is offline   Reply With Quote
Advert
Old 05-18-2016, 12:22 PM   #6
chaot
Head of lunatic asylum
chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.
 
chaot's Avatar
 
Posts: 349
Karma: 77620
Join Date: Jun 2012
Location: UTC +1
Device: Tolino Vision 3HD
Quote:
Originally Posted by theducks View Post
If in doubt, COPY (select, the ctrl-F) the search value (space pair)
Also possible. It works once, then again different, to say, once there are 1361 occurences, then 291 and so on!?

To explain here my attempts with Find: \s\s respectively *SPACE**SPACE* (your and my way ) and Replace all would be very awkward. But the result is quite clear: It works unfortunately only unstable.

Whether that applies only to this book mentioned here I do not know?

Quote:
... the underlying mig[h]t be another form of whitespace
???
chaot is offline   Reply With Quote
Old 05-18-2016, 01:10 PM   #7
chaot
Head of lunatic asylum
chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.
 
chaot's Avatar
 
Posts: 349
Karma: 77620
Join Date: Jun 2012
Location: UTC +1
Device: Tolino Vision 3HD
Quote:
Originally Posted by jackie_w View Post
Something to be careful of with your regex is that you might end up replacing consecutive non-breaking-spaces with a plain space. That might be important if nbsps have been used to create vertical whitespace scenebreaks. E.g.
Before: <p>*nbsp**nbsp*</p>
After: <p>*plainspace*</p>

The 'Before' paragraph will look like a blank line. The 'After' will be completely invisible.
Consecutive non-breaking-spaces do not have a syntax?

The meaning of *nbsp* (non blanc spaces) is not clear to me. A *nbsp* must be syntactically somehow recognizable and different from the *plainspace* - or?

Quote:
Originally Posted by BetterRed View Post
I think the pink blobs in the third shot probably indicate the presence of a 'special' space character. In codeview window, position the cursor immediately after a blob and the character details will be displayed at the right end of the status line.
Click image for larger version

Name:	Differences between books (excerpt).png
Views:	213
Size:	271.8 KB
ID:	148745
Differences between books (excerpt) (Image with pink blobs)
Never mind which white or blanc spaces or plainspaces, the regular ones, the ones in some words or the double ones between the words: all called SPACE (in status line).



EDIT Soon my head is also an empty space - yet it hums.

There are NO-BREAK SPACES, colored yellow.

Click image for larger version

Name:	Code view.png
Views:	198
Size:	6.6 KB
ID:	148750
Code View (Yellow space)

Click image for larger version

Name:	NO-BREAK SPACE.png
Views:	223
Size:	75.6 KB
ID:	148751
NO-BREAK SPACE (Cursor behind yellow space)



Quote:
What does the fourth shot look like in Preview - it appears to have a space between almost every character - but if that's what you want I guess it's OK.
No! What I want is: One (normal) white space between words, none in the words.

Click image for larger version

Name:	without correction of double white spaces.png
Views:	202
Size:	188.9 KB
ID:	148742
without correction of double white spaces

Click image for larger version

Name:	with correction of double white spaces.png
Views:	227
Size:	188.4 KB
ID:	148743
with correction of double white spaces Looks exactly the same.

Quote:
To address the issue jackie-w raises you could try replacing the nbsp at line beginnings with a marker, do the global replace, and then replace the markers with nbsp.
??? Further explanations desired.

Last edited by chaot; 05-18-2016 at 02:42 PM. Reason: add EDIT
chaot is offline   Reply With Quote
Old 05-18-2016, 02:08 PM   #8
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,212
Karma: 16534894
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
Quote:
Originally Posted by chaot View Post
The meaning of *nbsp* (non blanc spaces) is not clear to me. A *nbsp* must be syntactically somehow recognizable and different from the *plainspace* - or?
By *nbsp* I meant 'non-breaking-space', a.k.a. the unicode char \xa0 - also often found as the html entity &nbsp;. The calibre Editor Check function will complain if your HTML contains entities. The Beautify function will always replace all html entities with their unicode char equivalent. The Editor visually differentiates normal space and unicode \xa0 by highlighting the latter (as it also does for the mdash and ndash unicode chars to distinguish them from a normal hyphen).

A Regex search for \s will match both a normal space and an \xa0 (and other 'whitespace' chars for that matter, e.g. newline). If you only want to search for '2 or more consecutive normal spaces' then perhaps a regex search for
Code:
[ ]{2,}
would be better than \s\s (there's a normal space between those square-brackets)
jackie_w is offline   Reply With Quote
Old 06-02-2016, 11:07 AM   #9
chaot
Head of lunatic asylum
chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.
 
chaot's Avatar
 
Posts: 349
Karma: 77620
Join Date: Jun 2012
Location: UTC +1
Device: Tolino Vision 3HD
Quote:
Originally Posted by jackie_w View Post
...
A Regex search for \s will match both a normal space and an \xa0 (and other 'whitespace' chars for that matter, e.g. newline). If you only want to search for '2 or more consecutive normal spaces' then perhaps a regex search for
Code:
[ ]{2,}
would be better than \s\s (there's a normal space between those square-brackets)
Brief interim report: Regex functions! And we see once again differences of occurences #3.
Click image for larger version

Name:	Replaced 1117 occurrences of [ ]{2,}.png
Views:	223
Size:	14.0 KB
ID:	149122
Replaced 1117 occurrences of [ ]{2,}
chaot is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calibre:Book Cover size in Book Details side pane & Edit Metadata Individually window Volfer Calibre 3 01-05-2016 01:56 PM
Default Edit Book Edit Window Font? lhuxley Editor 2 03-26-2015 11:11 PM
Aura Inconsistency between metadata in Calibre and on device MariaS Kobo Reader 5 08-30-2014 06:53 AM
Markdown: Anchor inconsistency on Kindle & Sony Snorkledorf Conversion 3 01-05-2012 09:06 AM


All times are GMT -4. The time now is 04:03 AM.


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