Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old Today, 09:07 AM   #1
ElMiko
Fanatic
ElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileRead
 
ElMiko's Avatar
 
Posts: 509
Karma: 65460
Join Date: Jun 2011
Device: Kindle
Automate list not executing search/replace

I'm revising old CSS, and am trying to use the Automate List to replace old css with the new. One such example is replacing:

Code:
hr {
	border: 0;
	background-color: #000000;
	height: 4px;
	width: 85%;
	}
with

Code:
hr {
	border: 0;
	background-color: #000000;
	height: 4px;
	width: 85%;
	}
hr.hrsep {
	border: 0;
	background-color: #000000;
	height: 1px;
	width: 4em;
	margin-top: 0.75em;
	margin-bottom: 0.75em;
	}
If I do a "Current File" search for the first term, I get the match as desired, but if I try to automate it, it returns no matches (and therefore makes no replacements).

But other similar searches DO work... for example replacing

Code:
.calibre {[\s.\w\p{P}]+?
	}
with

Code:
.calibre {
	display: block;
	font-family: serif;
	font-size: 1em;
	line-height: 1.1;
	margin-bottom: 0;
	margin-left: 2pt;
	margin-right: 2pt;
	margin-top: 0;
	padding-left: 0;
	padding-right: 0;
	page-break-before: always;
	text-align: justify;
	}
p {
	display: block;
	margin-top: 0;
	margin-bottom: 0;
	margin-left: 0;
	margin-right: 0;
	line-height: 1.15em;
	}
Any ideas?

Last edited by ElMiko; Today at 09:14 AM.
ElMiko is offline   Reply With Quote
Old Today, 10:30 AM   #2
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: 9,083
Karma: 6379190
Join Date: Nov 2009
Device: many
The automate function runs specific named saved searches. So please show the exact named source in a screencap from your Saved Searches Editor including all the control fields, and of course the exact find and replace fields as well. Then show the automation log, and finally your automation list itself.

Have you tried using all css or selected CSS files in your controls?

If your control target is "current file", then the wrap control should probably be set as well given starting cursor position in the current file matters if that is determined by something earlier in the automation list.

But depending on your find field value, and because it is really an append you are doing and not a replace (the find target will always exist even after a replace) you may need to worry about an infinite loop.

Have you tried modifying the replace so that it modifies the code the find looks for to eliminate a loop? Or are you not using wrap? If not, how are you positioning the cursor in current file mode before running the automation list? Does your automation list run a saved search group or just a single saved search?

Using "selected css" as the target (or "all css") would probably be better than current file as they always starts each file at the top automatically for sequential named searches.

Last edited by KevinH; Today at 12:06 PM.
KevinH is offline   Reply With Quote
Old Today, 11:09 AM   #3
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: 9,083
Karma: 6379190
Join Date: Nov 2009
Device: many
And as with any bug report, adding a simplified epub example file, a file including the sample searches (they can be exported in the Saved Search Editor), and your automation list would really help so that others can try to recreate what you are seeing.

FWIW, I never use the "current file" mode for searches in an automate list as current file mode needs proper cursor positioning and wrap mode to work reliably so just running a search manually, and running the saved search directly is probably a better idea and manually watching for the wrap overlap condition to occur. That is why I suggested the "All CSS" or "Selected CSS" mode above.
KevinH is offline   Reply With Quote
Old Today, 11:55 AM   #4
ElMiko
Fanatic
ElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileRead
 
ElMiko's Avatar
 
Posts: 509
Karma: 65460
Join Date: Jun 2011
Device: Kindle
When I'm back at the computer tonight, I'll build a mock up file, and upload it along with the screenshots as well as the ini file for the group of searches and the automated list file.

Is there anything else that I should attach?
ElMiko is offline   Reply With Quote
Old Today, 12:13 PM   #5
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: 9,083
Karma: 6379190
Join Date: Nov 2009
Device: many
You can also export just selected saved searches using the SavedSearches context pop up menu. There is no need to send an entire ini file.

So epub with css file and a single html file, saved searches you use in automation list exported (as above), and a simplified automation list should be enough.

But as I said, first I would try changing the saved search itself to use Selected CSS mode or All CSS files mode and *NOT* the Current File mode as the current file mode does not keep state (ie it is like the old stateless search) and in automation modes you need to use searches that keep state (which is the whole reason the change to search to keep state was made in the first place) especially when you are appending and not replacing with find and replace.

Last edited by KevinH; Today at 02:25 PM.
KevinH is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
More than 3 Automate List functions ElMiko Sigil 14 06-16-2025 09:48 PM
Search and Replace from a List moldy Editor 37 03-27-2024 09:07 PM
Automate a page split... Find & Replace doesn't work for this LostOnTheLine Sigil 24 11-28-2022 01:55 PM
Automate list and S&R jmurphy Sigil 10 11-02-2022 08:47 AM
Regex in search problems (NOT Search&Replace; the search bar) lairdb Calibre 3 03-15-2017 08:10 PM


All times are GMT -4. The time now is 08:49 PM.


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