|
|
#1 |
|
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 510
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%;
}
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;
}
But other similar searches DO work... for example replacing Code:
.calibre {[\s.\w\p{P}]+?
}
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;
}
Last edited by ElMiko; Today at 09:14 AM. |
|
|
|
|
|
#2 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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. |
|
|
|
|
|
#3 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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. |
|
|
|
|
|
#4 |
|
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 510
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? |
|
|
|
|
|
#5 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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. |
|
|
|
|
|
#6 |
|
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 510
Karma: 65460
Join Date: Jun 2011
Device: Kindle
|
Alright, here goes.
I tried the "All CSS" setting, and it didn't work. In fact, it return NO results unless I ran the automated list in the css file in question. As you can see in image AL_03, when it ran the list in a file other than the css file, despite having selected "All CSS", it ran the list as "All HTML", bizarrely. The other attached images are: AL_01: which shows that as a standalone search (i.e. not automated), the "CSS - hr" search does work (in "current file" mode or the key board shortcut for searching within the current file). AL_02: which is the log for the automated list when it is run with "Current file" selected and the css file open. The same result is displayed if you run it with "All CSS" (or its ilk), but ONLY if you have that file open in the viewing tab. Otherwise, as I said above, it yields NO matches. A couple of additional notes: 1) You will see that in AL_02, the second-to-last search—"CSS - copyright"—similarly had no matches or replacements. It is like the "CSS - hr" search in that it too will match when the search is run discreetly and in "Current file", but will fail when it's run as part of the automated list. 2) I have tried running the "CSS - hr" search (automated) with the following search term instead: Code:
hr {[\s.\w\p{P}]+?
}
3) I've attached the ini file (see note #4) for the group of searches in the automated list. Only the first, "manual CSS candidates", is irrelevant to the automation. 4) MobileReads doesn't like ini files, apparently, so I changed it to "CSSReplacements.txt" Please let me know if I've forgotten something, or some additional info is needed! Last edited by ElMiko; Today at 09:35 PM. |
|
|
|
![]() |
|
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 |