Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 03-24-2022, 04:16 PM   #76
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,772
Karma: 5446592
Join Date: Nov 2009
Device: many
We pass a single QStringList that effectively contains the values of match.group(0), match.group(1), ... created from our C++ match info object through the embedded python bridge code , to the replace function in mymod.py, and its returns a single string replacement value back via the bridge code.

We could pass along a counter, or an structure (tuple - think a list of QVariants) for memory storage as well.

It should work. Just one more embedded python routine.

It will be be a bit quick and dirty, and more limited in scope, but we have plugins to handle the fancy stuff.

Or we take advantage of the embedded python routines to return a Replacer object and invoke its routines so that object can have cross call storage until the we delete it. We used that approach for the pre Sigil 1.9 Opf parsing routine before it was rewritten in C++.

Or even just pass in a an QString that could hold serialized json for whatever storage they needed. And return a QString pair (replacement value and storage).

Last edited by KevinH; 03-24-2022 at 05:10 PM.
KevinH is online now   Reply With Quote
Old 03-24-2022, 04:29 PM   #77
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,772
Karma: 5446592
Join Date: Nov 2009
Device: many
I checked out how we internally handle ReplaceAll in Misc/SearchOperations.cpp and for each file we handle the replacements in reverse order so that all match objects are calculated just once. That means using python replacement functions would need changes if we wanted to use them for renumbering things as that would require a new routine that works in spine order from top to bottom in each file, unlike our current C++ approach which is done for better efficiency and speed.

I still think renumbering is better done by Doitsu's excellent plugin anyway.

Last edited by KevinH; 03-24-2022 at 05:11 PM. Reason: specify a good renumbering plugin!
KevinH is online now   Reply With Quote
Advert
Old 03-24-2022, 04:50 PM   #78
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,615
Karma: 23187563
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by KevinH View Post
I still think renumbering is better done by plugins anyway.
As I've already mentioned in this thread, I'm sure that my AddIDs plugin should cover most renumbering use cases and if I've missed one, I could easily add it.

Quote:
Originally Posted by Turtle91 View Post
Is it possible to incorporate something similar to Calibre's "regex-function" in the find/replace. It seems to add a huge range of options without requiring individual plugins...
@Turtle91 would you need full renumbering support in regex functions, or are you already using my AddIDs plugin or other tools for this?
Doitsu is offline   Reply With Quote
Old 03-24-2022, 05:05 PM   #79
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,772
Karma: 5446592
Join Date: Nov 2009
Device: many
Yes, I agree. I edited my post to indicate that.

Quote:
Originally Posted by Doitsu View Post
As I've already mentioned in this thread, I'm sure that my AddIDs plugin should cover most renumbering use cases and if I've missed one, I could easily add it.


@Turtle91 would you need full renumbering support in regex functions, or are you already using my AddIDs plugin or other tools for this?
KevinH is online now   Reply With Quote
Old 03-24-2022, 06:46 PM   #80
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,772
Karma: 5446592
Join Date: Nov 2009
Device: many
The more I think about it, even storage may not be useful since search order is not guaranteed. Saving something across calls is needed for counting/skipping, etc but reverse order would break that. Something to think about.

In addition, one off replaces make storage irrelevant. So providing storage would make sense just for Replace All type situations.

Last edited by KevinH; 03-24-2022 at 06:58 PM.
KevinH is online now   Reply With Quote
Advert
Old 03-24-2022, 10:13 PM   #81
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,121
Karma: 18727091
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
Quote:
Originally Posted by Doitsu View Post
As I've already mentioned in this thread, I'm sure that my AddIDs plugin should cover most renumbering use cases and if I've missed one, I could easily add it.


@Turtle91 would you need full renumbering support in regex functions, or are you already using my AddIDs plugin or other tools for this?
I use your plugin for renumbering and adding numbers to headings that don't have them.

I haven't looked at the possibilities of regex functions, other than its only limited by the programming talents of the user. I really liked the ability to use it to create Title Case, which Calibre used in their How To, but honestly didn't look into it further....life got in the way.
Turtle91 is offline   Reply With Quote
Old 03-25-2022, 04:45 PM   #82
democrite
Evangelist
democrite will give the Devil his due.democrite will give the Devil his due.democrite will give the Devil his due.democrite will give the Devil his due.democrite will give the Devil his due.democrite will give the Devil his due.democrite will give the Devil his due.democrite will give the Devil his due.democrite will give the Devil his due.democrite will give the Devil his due.democrite will give the Devil his due.
 
Posts: 425
Karma: 77256
Join Date: Sep 2011
Device: none
Perhaps one aspect to explain how I think of what Sigil could be is that coming from some experience of using shells and doing some amount of programming, as well as other things such as being used to automation on macOS as well as some familiarity with Vim and Emacs, is that I am used to being able to use the keyboard for nearly everything and avoiding having to use the mouse most of the time.

I understand most creating EPUBs may not seek such but then again much of EPUB creation is in some sense coding. Such is some of the consideration when I mention thing I would like. I am used to such efficiency yet many others may not be. Perhaps someday but I understand the goals may never align as such.
democrite is offline   Reply With Quote
Old 03-25-2022, 04:56 PM   #83
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,772
Karma: 5446592
Join Date: Nov 2009
Device: many
The point we are trying to make is to then use "open with" with emacs or whatever editor does things the way you want.

Using the keyboard predominantly is fine (BetterRed does that) but having different widgets fighting for focus is not. And there are some things that a mouse or mouse pad are better at including selecting specific but widely separated files in BookBrowser.

If you can program, then modify your own copy of Sigil to do what you want. BeckyEbook does that and adds menus and features she needs or wants.

Our goal is to make Sigil work like most users want (myself included) who do not want to memorize more than a handful of useful key sequences and rely on the menus and toolbar icons for all others.

Last edited by KevinH; 03-25-2022 at 04:58 PM.
KevinH is online now   Reply With Quote
Old 03-28-2022, 11:14 AM   #84
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,772
Karma: 5446592
Join Date: Nov 2009
Device: many
Show Dry-Run for any Replace or Replace All

Would anyone here find the following new feature for Sigil useful:

Add a "dry-run" mode for Find and Replace that would show the before and after results from a Regex Replace/Replace-All in a big table but not actually make any changes at all (or possibly wait until user says okay?). Maybe a simple Ctrl-Click on the Replace button to do the dry-run.

Imagine a table with two columns, the first showing a short context (3 to 5 words on each side of a match) for each match, and the second column showing the same short context with the replacement made. But no actual replacements are done ( or until the user okays it).

The number of words of context could be a user preference.

Effectively this would be a faster easier way of making a Checkpoint, doing the ReplaceAll, and comparing using File level highlighted diffs, and deciding whether to keep or revert to the Checkpoint all without Checkpointing at all.

Would this be a generally useful addition?
KevinH is online now   Reply With Quote
Old 03-28-2022, 11:47 AM   #85
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,615
Karma: 23187563
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by KevinH View Post
Add a "dry-run" mode for Find and Replace that would show the before and after results from a Regex Replace/Replace-All in a big table but not actually make any changes at all (or possibly wait until user says okay?).
IMHO, that would be a great addition. So far, I have been using a private regex tester plugin that shows all regex matches in the validation window, but a built-in option would be much better.
Doitsu is offline   Reply With Quote
Old 03-28-2022, 12:09 PM   #86
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,121
Karma: 18727091
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
Yes...that would be awesome.

I currently use "Count All" to see if I'm in the ballpark, then replace individual ones a couple times to make sure it's doing it properly, then replace/find until I get tired of it, then replace all - after saving, of course.

Seeing everything in a table that I could quick scan, especially with an "accept changes" button would be the bee's knees!
Turtle91 is offline   Reply With Quote
Old 03-28-2022, 12:54 PM   #87
BeckyEbook
Guru
BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.
 
BeckyEbook's Avatar
 
Posts: 705
Karma: 2180740
Join Date: Jan 2017
Location: Poland
Device: Misc
Quote:
Originally Posted by KevinH View Post
Imagine a table with two columns, the first showing a short context (3 to 5 words on each side of a match) for each match, and the second column showing the same short context with the replacement made. But no actual replacements are done ( or until the user okays it).
(…)
Would this be a generally useful addition?
This idea looks exciting!
It is especially useful when a given replacement is not unambiguous and depends on a contest. I don't like to mindlessly click "Replace All", so this dry-run preview could become my favorite tool.

I use a similar solution every day, but in a simplified form – through a plugin, but at least I can preview the results in the "Validation Results" window.
BeckyEbook is offline   Reply With Quote
Old 03-28-2022, 01:29 PM   #88
odamizu
just an egg
odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.
 
odamizu's Avatar
 
Posts: 1,604
Karma: 4798866
Join Date: Mar 2015
Device: Kindle, iOS
I like this idea a lot!

I currently do the same as Turtle91:

Quote:
Originally Posted by Turtle91 View Post
... "Count All" to see if I'm in the ballpark, then replace individual ones a couple times to make sure it's doing it properly, then replace/find until I get tired of it, then replace all ...
A dry-run table would be awesome!
odamizu is offline   Reply With Quote
Old 03-28-2022, 01:30 PM   #89
phillipgessert
Addict
phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.
 
phillipgessert's Avatar
 
Posts: 311
Karma: 3196258
Join Date: Oct 2015
Location: Madison, WI
Device: Kindle 5th Gen
I would also find that really useful.
phillipgessert is offline   Reply With Quote
Old 03-28-2022, 02:02 PM   #90
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,772
Karma: 5446592
Join Date: Nov 2009
Device: many
Okay, it appears to be quite popular. I will start looking at how to actually accomplish that.

Thanks to everyone that provided their feedback.
KevinH is online now   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Possible To-Do List for Future Sigil Releases Post Sigil 1.8 KevinH Sigil 143 02-05-2022 12:08 PM
Icon Redesign for future 1.0 Release of Sigil shorshe Sigil 38 06-06-2016 11:29 PM
Sigil on Nook vs Sigil on Kobo vs Sigil on iBook rosshalde Sigil 12 11-13-2014 09:34 AM
Sigil’s Future Direction (Post 0.4.x) user_none Sigil 90 10-11-2011 03:28 PM
Sigil's Future crutledge Sigil 36 07-26-2011 06:02 PM


All times are GMT -4. The time now is 09:58 AM.


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