|
![]() |
|
Thread Tools | Search this Thread |
![]() |
#1 | |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,504
Karma: 5703586
Join Date: Nov 2009
Device: many
|
Volunteer to write new Chapter on Python Function Replace for Sigil User Guide
Hi @Turtle91 and All,
Quote:
Well that time has come and I am looking for a volunteer or volunteers to create a new "Advanced Search - Python Function Replace" chapter that documents the new Sigil Python Function Replace tool that was available in the Betas (which can be used for screenshots) and will be available in the upcoming Sigil 2.5.0 release (real soon now!). Please warn users as this is a very advanced techniques that requires knowledge of the Python programming language, regular expressions, etc. Please include the screen caps to make it clear how to use it, when to use it, etc. And please document the new debug log file environment variable to capture debug output when trying to debug your python function. And maybe include a simple trivial example. If this is something you are willing to take a shot at, please let me know. If multiple people are interested we can use this thread to share xhtml source and screencaps. Please use the styles already defined in the Sigil User Guide. And when final, please make sure it passes epubcheck. Thanks! Kevin |
|
![]() |
![]() |
![]() |
#2 |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,321
Karma: 20171571
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
Oh dang! I completely forgot about volunteering for this after my hard drive crash, and the (literal) train wreck. I’ll need to download the beta again.
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,504
Karma: 5703586
Join Date: Nov 2009
Device: many
|
No rush. The user's guide update can come after the new Sigil release too.
|
![]() |
![]() |
![]() |
#4 |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,321
Karma: 20171571
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
Workin it...
Question though: Is the function result referenceable in the replace field? If I enter the find field with a normal search and use the regex function (as below) the function works, replacing the grouped section with the function result. Code:
<h2>SUPER DUPER</h2> returns <h2>Super Duper</h2> However, if I try and add any string before or after it in the replace field it simply treats the function as a string. Code:
<h2>SUPER DUPER</h2> returns <h3>\F<titlecase_ignore_tags></h3> Something like: Code:
Replace: <h3>\1:F<titlecase_ignore_tags></h3>
to achieve
<h3>Super Duper</h3>
|
![]() |
![]() |
![]() |
#5 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,504
Karma: 5703586
Join Date: Nov 2009
Device: many
|
No the function replace is the only thing specified in the replace field. It is not a substring replacement, it is a function doing the replacement.
All search match groups are provided to your function. So you get the entire string that was matched, plus all of the values for each match group to use as you see fit in your function. So can use your own python code to replace anything you want with anything you want. You can build the entire replacement value. You just can not try to squeeze it into the replace field, your function should handle that. Last edited by KevinH; Yesterday at 08:52 AM. |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,321
Karma: 20171571
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
okay. thanks!
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Looking for Volunteers for New Chapters for Sigil User's Guide | KevinH | Sigil | 283 | 03-16-2021 12:43 PM |
Sigil Find Replace Function | d351r3d | Sigil | 5 | 06-09-2020 12:17 AM |
Is Sigil 072 the latest User Guide? | Gregg Bell | Sigil | 46 | 04-24-2018 05:54 PM |
Sigil .9+ user guide | cyteen | Sigil | 2 | 12-29-2017 02:31 PM |
Sigil User Guide Not Working in IE9 | TrevN | Sigil | 5 | 09-12-2012 09:54 PM |