View Single Post
Old 09-26-2021, 02:07 PM   #12
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 2,306
Karma: 13057279
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by kovidgoyal View Post
I have to say I dont really understand this use case. If you are reviewing each replacement individually you might as well do it by clicking "Replace and find" repeatedly and correcting any bad replaces with an undo when needed.
Heh, I probably got too excited and threw the entire kitchen sink in that single post!

I'll try to break it down into more manageable pieces/use-cases.

* * *

The Line-by-Line Merge

Similar to when you Compare entire documents in LibreOffice/Word.

You have:

File A: v1 of an ebook from a year ago
File B: v7 of an ebook from today

(Happens quite often in ebooks.)

Now, you wanted to create a File C, because not all changes are correct.

This is where the line-by-line, Left->Right override would be great.

1. You open up File B in Calibre Editor.

2. You File > Compare against File A.

3. You scroll through the comparison, and are able to override individual lines with File A's version.

4. This will give you "File C", which you can then save as a new EPUB.

Currently, you can only VIEW all the differences.

- - -

Note: Calibre's current Compare is extremely helpful though!

And the way it's displayed in Calibre is absolutely fantastic/beautiful!

Its visuals beat the pants off of Beyond Compare's (and any other code comparison tool I've tested so far).

- - -

I also believe this would be helpful in the normal large Find/Replaces (with a handful of edge cases).

Like this thread. A giant Find/Replace to switch all "123" -> "spelled-out numbers" form.

100 replaces were fine:
  • Chapter 21 -> Chapter Twenty-One
  • I was 2 years old -> I was two years old

But then there were a few exceptions. Like the ones theducks gave:
  • 21 Main Street -> Twenty-One Main Street
  • Call (123) 456-7890 -> Call (One Hundred and Twenty-Three) Four Hundred...
  • May 22, 1985 -> May Twenty-Two, One Thousand Nine Hundred Eighty Five

So, you'd see the fantastic Calibre diff, and you can scroll through and override certain lines with the "Left"/before version.

* * *

And then the other methods I rambled about are more extreme.

A Sortable/Searchable (List-Based?) Differ (Advanced Find/Replace?)

When the amount of changes are overwhelming (in the hundreds/thousands).

Similar to the Spellcheck List, you'd be able to type in a:

- Find
- Replace

Run this on a book (like pressing "Count All") and generate a list:

- Find: Chapter \d+

You'd get a list of all hits:

Code:
Found       |  Replace   |  Hits
Chapter 1   |            |     1
Chapter 2   |            |     1
Chapter 3   |            |     1
Chapter 4   |            |     1
[...]
Chapter 100 |            |     1
You'd be able to double-click on any entry and jump to its location.

And, similar to the Spellcheck List, you can search/sort through this:

- Search: 1

Code:
Found       |  Replace   |  Hits
Chapter 1   |            |     1
Chapter 10  |            |     1
Chapter 11  |            |     1
Chapter 12  |            |     1
[...]
Chapter 100 |            |     1
- Search: 10

Code:
Found       |  Replace   |  Hits
Chapter 10  |            |     1
Chapter 100 |            |     1
You'd also be able to do a Replace:

- Find: Chapter (\d+)
- Replace: Chap. \1

Code:
Found       |  Replace   |  Hits
Chapter 1   |  Chap. 1   |     1
Chapter 2   |  Chap. 2   |     1
Chapter 3   |  Chap. 3   |     1
Chapter 4   |  Chap. 4   |     1
[...]
Chapter 100 |  Chap. 100 |     1
Here, I can also scroll through the list and accept/reject certain replaces.

Maybe, sorting by Hits, there would be a:

Code:
Chapter 5   |  Chap. 5   |     5
so you scratch your head, take a closer look, and maybe the book has a few:
  • See Chapter 5 for more information.

You may want to treat that differently than:
  • <h2>Chapter 5</h2>

so you'd apply the change to all 99 other replaces first, then you can dig in to that oddity in more detail.

* * *

I think those 2 would take a large bite out of this "mass diff" use-case.

The other stuff was just thinking about categorizing/sorting through diffs specifically.

Like if you Compare two documents in LibreOffice/Word, there may be hundreds of changes where a comma/punctuation was added/removed. Going through these one-by-one is extremely slow.

Would be nice to sort through JUST THE COMMA diffs, then mass accept/reject those lines.

Then sort through JUST THE <i> diffs, then mass accept/reject those lines.

You just Smartened Punctuation the entire EPUB, now you only want to double-check that quotes around EM DASHES were done properly... so you can: "Search: —" and only focus on those diffs.

(Quite often, the Smarten Punctuation puts the wrongly flipped quotation mark: —“ instead of —” .)

Anyway, that would be a far-in-the-future type idea.

I think for now, those 2 listed above would be more helpful to the broader community.

Quote:
Originally Posted by Brett Merkey View Post
Wow. I've been using Calibre for years and never knew until now that part of the visible text of the search review window is double-clickable.

[...]

I hope I was the only one who did not suspect the window had a finer grain of functionality.
Me neither. Absolutely fantastic learning all these little things that have been there, but are hidden.

Just this week, I wrote about how I stumbled upon the Calibre Look&Feel > "Transform Styles" tab.

Thousands of conversions in Calibre, years and years... and this thing was sitting right under my nose.

Thanks for all the fantastic work, Kovid!

Last edited by Tex2002ans; 09-26-2021 at 02:35 PM.
Tex2002ans is offline   Reply With Quote